remote_file resource for FTP with username and password

All,

I checked the documentation for remote_file resource but could not find if there is a way to define attributes for FTP username and password. Any idea if that is supported?

Thanks

-Kapil


This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

Hi

It looks like it (
https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_file/ftp.rband

)
Have you tried setting the uri to "ftp://USER:PASS@foo.tld" ?

Sölvi

On Tue, Mar 11, 2014 at 5:57 PM, Kapil Shardha <
Kapil.Shardha@simulationiq.com> wrote:

All,

I checked the documentation for remote_file resource but could not find
if there is a way to define attributes for FTP username and password. Any
idea if that is supported?

Thanks

-Kapil


This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of Education
Management Solutions, Inc. If you are not the intended recipient, please
immediately advise the sender by reply email & delete the message & any
attachments without using, copying or disclosing the contents. Thank you.

I tried that. In my case, the user account is a domain account so this is how my resource looks like

remote_file “Download Install File” do
source "ftp://domain\user:Password@myftpserver.com//install.exe"
path "C:\Temp\install.exe"
end

It does not like the value of source attribute. I also tried using user@domain.commailto:user@domain.com format too but chef-client resulted in same error.

Following is the error:

FATAL: Chef::Exceptions::InvalidRemoteFileURI: is not a valid source parameter for remote_file. Source must be an absolute URI or an array of URIs.

Thanks

-Kapil

From: Sölvi Páll Ásgeirsson [mailto:solvip@gmail.com]
Sent: Tuesday, March 11, 2014 4:26 PM
To: chef@lists.opscode.com
Subject: [chef] Re: remote_file resource for FTP with username and password

Hi

It looks like it (https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_file/ftp.rb and https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_file/content.rb)
Have you tried setting the uri to “ftp://USER:PASS@foo.tld” ?

Sölvi

On Tue, Mar 11, 2014 at 5:57 PM, Kapil Shardha <Kapil.Shardha@simulationiq.commailto:Kapil.Shardha@simulationiq.com> wrote:
All,

I checked the documentation for remote_file resource but could not find if there is a way to define attributes for FTP username and password. Any idea if that is supported?

Thanks

-Kapil


This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.


This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

The Chef error is just being rethrown because URI.parse() in ruby can't
handle those URIs and I just tested on ruby-2.1.1 and that class still
doesn't know how to deal with AD domain users in FTP urls. It looks
like it would be possible to extend remote_file to take "username" and
"password" attributes and pass those into the remote_file FTP
downloader class and use those instead of trying to extract the user +
pass out of the URI. Right now the username and password look like
they have to come from the URI though so its not possible to use
usernames and passwords that ruby cannot parse. You should look for an
open chef ticket on this or open a new one up if you can't find one.

On Wed Mar 12 10:47:26 2014, Kapil Shardha wrote:

I tried that. In my case, the user account is a domain account so this
is how my resource looks like

remote_file "Download Install File" do

        source

"ftp://domain\\user:Password@myftpserver.com//install.exe"

        path "C:\\Temp\\install.exe"

end

It does not like the value of source attribute. I also tried using
user@domain.com mailto:user@domain.com format too but chef-client
resulted in same error.

Following is the error:

FATAL: Chef::Exceptions::InvalidRemoteFileURI: is not a valid
source parameter for remote_file. Source must be an absolute URI or an
array of URIs.

Thanks

-Kapil

*From:*Sölvi Páll Ásgeirsson [mailto:solvip@gmail.com]
Sent: Tuesday, March 11, 2014 4:26 PM
To: chef@lists.opscode.com
Subject: [chef] Re: remote_file resource for FTP with username and
password

Hi

It looks like it
(https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_file/ftp.rb
and
https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_file/content.rb)

Have you tried setting the uri to "ftp://USER:PASS@foo.tld" ?

Sölvi

On Tue, Mar 11, 2014 at 5:57 PM, Kapil Shardha
<Kapil.Shardha@simulationiq.com
mailto:Kapil.Shardha@simulationiq.com> wrote:

All,

I checked the documentation for *remote_file* resource but could
not find if there is a way to define attributes for FTP username
and password. Any idea if that is supported?

Thanks

-Kapil

------------------------------------------------------------------------


This email and any accompanying documents may contain privileged
or otherwise confidential information of, and/or is the property
of Education Management Solutions, Inc. If you are not the
intended recipient, please immediately advise the sender by reply
email & delete the message & any attachments without using,
copying or disclosing the contents. Thank you.

This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of
Education Management Solutions, Inc. If you are not the intended
recipient, please immediately advise the sender by reply email &
delete the message & any attachments without using, copying or
disclosing the contents. Thank you.

Thanks! I have created following ticket : https://tickets.opscode.com/browse/CHEF-5114

-Kapil

-----Original Message-----
From: Lamont Granquist [mailto:lamont@opscode.com]
Sent: Wednesday, March 12, 2014 2:46 PM
To: chef@lists.opscode.com
Cc: Kapil Shardha
Subject: Re: [chef] RE: Re: remote_file resource for FTP with username and password

The Chef error is just being rethrown because URI.parse() in ruby can't handle those URIs and I just tested on ruby-2.1.1 and that class still doesn't know how to deal with AD domain users in FTP urls. It looks like it would be possible to extend remote_file to take "username" and "password" attributes and pass those into the remote_file FTP downloader class and use those instead of trying to extract the user + pass out of the URI. Right now the username and password look like they have to come from the URI though so its not possible to use usernames and passwords that ruby cannot parse. You should look for an open chef ticket on this or open a new one up if you can't find one.

On Wed Mar 12 10:47:26 2014, Kapil Shardha wrote:

I tried that. In my case, the user account is a domain account so this
is how my resource looks like

remote_file "Download Install File" do

        source

"ftp://domain\\user:Password@myftpserver.com//install.exe"

        path "C:\\Temp\\install.exe"

end

It does not like the value of source attribute. I also tried using
user@domain.com mailto:user@domain.com format too but chef-client
resulted in same error.

Following is the error:

FATAL: Chef::Exceptions::InvalidRemoteFileURI: is not a valid
source parameter for remote_file. Source must be an absolute URI or an
array of URIs.

Thanks

-Kapil

*From:*Sölvi Páll Ásgeirsson [mailto:solvip@gmail.com]
Sent: Tuesday, March 11, 2014 4:26 PM
To: chef@lists.opscode.com
Subject: [chef] Re: remote_file resource for FTP with username and
password

Hi

It looks like it
(https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_
file/ftp.rb
and
https://github.com/opscode/chef/blob/master/lib/chef/provider/remote_f
ile/content.rb)

Have you tried setting the uri to "ftp://USER:PASS@foo.tld" ?

Sölvi

On Tue, Mar 11, 2014 at 5:57 PM, Kapil Shardha
<Kapil.Shardha@simulationiq.com
mailto:Kapil.Shardha@simulationiq.com> wrote:

All,

I checked the documentation for *remote_file* resource but could
not find if there is a way to define attributes for FTP username
and password. Any idea if that is supported?

Thanks

-Kapil

--

This email and any accompanying documents may contain privileged
or otherwise confidential information of, and/or is the property
of Education Management Solutions, Inc. If you are not the
intended recipient, please immediately advise the sender by reply
email & delete the message & any attachments without using,
copying or disclosing the contents. Thank you.

--

This email and any accompanying documents may contain privileged or
otherwise confidential information of, and/or is the property of
Education Management Solutions, Inc. If you are not the intended
recipient, please immediately advise the sender by reply email &
delete the message & any attachments without using, copying or
disclosing the contents. Thank you.


This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

On Wednesday, March 12, 2014 at 12:00 PM, Kapil Shardha wrote:

Thanks! I have created following ticket : https://tickets.opscode.com/browse/CHEF-5114

-Kapil
I did some investigation, and according to the RFCs, you’re supposed to use percent escaping for backslashes in the user info portion of a URI. FWIW, the percent-escaped version of backslash is “%5C”. Can you see if that works?

More info here: https://tickets.opscode.com/browse/CHEF-5114?focusedCommentId=48046&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48046

HTH,

--
Daniel DeLeo