Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 10th, 2005, 03:45 PM
David Isaac
Guest
 
Posts: n/a
Default FTP over SSL (explicit encryption)

I am looking for a pure Python secure ftp solution.
Does it exist?

I would have thought that the existence of OpenSSL
would imply "yes" but I cannot find anything.

ftplib does not seem to provide any secure services.

I know about fptutil
http://codespeak.net/mailman/listinfo/ftputil
but that does not seem to provide any secure services.
(Btw, Matt Croydon's intro is helpful for newbies:
http://postneo.com/stories/2003/01/0...ibExample.html
)

I know about M2Crypto
http://sandbox.rulemaker.net/ngps/m2/
but that requires installing SWIG and OpenSSL.
(If someone tells me they have found this trivial
under Windows, I am willing to try ... )

I would have thought that this was a common need with
a standard Python solution, so I suspect I'm overlooking
something obvious.

Hoping,
Alan Isaac


  #2  
Old August 10th, 2005, 07:45 PM
Eric Nieuwland
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

David Isaac wrote:[color=blue]
> I am looking for a pure Python secure ftp solution.
> Does it exist?[/color]
Do you want SFTP or FTP/S?
[color=blue]
> I would have thought that the existence of OpenSSL
> would imply "yes" but I cannot find anything.
>
> ftplib does not seem to provide any secure services.[/color]
Indeed. If you want SFTP, just make a copy of ftplib and modify so it
will use an SSL socket instead of a normal socket. After that, only
some minor point may remain.
[color=blue]
> [...]I know about M2Crypto
> http://sandbox.rulemaker.net/ngps/m2/
> but that requires installing SWIG and OpenSSL.
> (If someone tells me they have found this trivial
> under Windows, I am willing to try ... )[/color]
I guess SFTP should work on Windows as well.
[color=blue]
> I would have thought that this was a common need with
> a standard Python solution, so I suspect I'm overlooking
> something obvious.[/color]
AFAIK you're not. I'm having a look at FTP/S right now. That's a little
more complicated, but it seems doable.
If I succeed, I guess I'll donate the stuff as an extension to ftplib.

--eric

  #3  
Old August 10th, 2005, 09:55 PM
David Isaac
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)


"Eric Nieuwland" <eric.nieuwland@xs4all.nl> wrote in message
news:mailman.2951.1123698786.10512.python-list@python.org...[color=blue]
> Do you want SFTP or FTP/S?[/color]

The latter.
[color=blue]
> I'm having a look at FTP/S right now. That's a little
> more complicated, but it seems doable.
> If I succeed, I guess I'll donate the stuff as an extension to ftplib.[/color]

Great!
Please post a link as soon as it is usable!

Thanks,
Alan Isaac


  #4  
Old August 11th, 2005, 02:15 AM
Andrew MacIntyre
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

David Isaac wrote:[color=blue]
> I am looking for a pure Python secure ftp solution.
> Does it exist?[/color]

I recall coming across an extension package (pretty sure it wasn't pure
Python anyway, certainly not for the SSL bits) with SFTP - I think the
name was Paramiko or something like that.

-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370
andymac@pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
  #5  
Old August 12th, 2005, 03:35 AM
David Isaac
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

> David Isaac wrote:[color=blue][color=green]
> > I am looking for a pure Python secure ftp solution.
> > Does it exist?[/color][/color]

"Andrew MacIntyre" <andymac@bullseye.apana.org.au> wrote in message
news:mailman.2957.1123722670.10512.python-list@python.org...[color=blue]
> I recall coming across an extension package (pretty sure it wasn't pure
> Python anyway, certainly not for the SSL bits) with SFTP - I think the
> name was Paramiko or something like that.[/color]

Unfortunately that's SSH2 only.
It is indeed pure Python
http://www.lag.net/paramiko/
However it requires the PyCrypto module.
http://www.amk.ca/python/code/crypto

Can you briefly outline how to use this as a client
to upload and down files from a server using SFTP?

Thanks,
Alan Isaac


  #6  
Old August 12th, 2005, 05:25 PM
David Isaac
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

"Alan Isaac" <aisaac0@verizon.net> wrote in message
news:CMTKe.6597$0d.5053@trnddc03...[color=blue]
> http://www.lag.net/paramiko/
> However it requires the PyCrypto module.
> http://www.amk.ca/python/code/crypto
>
> Can you briefly outline how to use this as a client
> to upload and down files from a server using SFTP?[/color]


OK, the mechanics are pretty easy.

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(20)
sock.connect((hostname, port))
my_t = paramiko.Transport(sock)
my_t.connect(hostkey=None ,username=username, password=password, pkey=None)
my_chan = my_t.open_session()
my_chan.get_pty()
my_chan.invoke_shell()
my_sftp = paramiko.SFTP.from_transport(my_t)

Now my_sftp is a paramiko sftp_client.
See paramiko's sftp_client.py to see what it can do.

Alan Isaac


  #7  
Old August 14th, 2005, 08:05 PM
David Isaac
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

"Eric Nieuwland" <eric.nieuwland@xs4all.nl> wrote in message
news:mailman.2951.1123698786.10512.python-list@python.org...[color=blue]
> I'm having a look at FTP/S right now. That's a little
> more complicated, but it seems doable.
> If I succeed, I guess I'll donate the stuff as an extension to ftplib.[/color]


Just found this:
http://trevp.net/tlslite/
I haven't even had time to try it,
but I thought you'd want to know.

Cheers,
Alan Isaac


  #8  
Old August 14th, 2005, 08:05 PM
David Isaac
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

> > http://www.lag.net/paramiko/

"Alan Isaac" <aisaac0@verizon.net> wrote in message
news:S04Le.303$Rp5.100@trnddc03...[color=blue]
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> sock.settimeout(20)
> sock.connect((hostname, port))
> my_t = paramiko.Transport(sock)
> my_t.connect(hostkey=None ,username=username, password=password,[/color]
pkey=None)[color=blue]
> my_chan = my_t.open_session()
> my_chan.get_pty()
> my_chan.invoke_shell()
> my_sftp = paramiko.SFTP.from_transport(my_t)
>
> Now my_sftp is a paramiko sftp_client.
> See paramiko's sftp_client.py to see what it can do.[/color]


When it rains it pours. wxSFTP
http://home.gna.org/wxsftp/
uses paramiko and provides a GUI.

Cheers,
Alan Isaac


  #9  
Old August 14th, 2005, 08:15 PM
Paul Rubin
Guest
 
Posts: n/a
Default Re: FTP over SSL (explicit encryption)

"David Isaac" <aisaac0@verizon.net> writes:[color=blue]
> Just found this:
> http://trevp.net/tlslite/
> I haven't even had time to try it,
> but I thought you'd want to know.[/color]

Tlslite is a very well done and promising package, but in its present
form it's not really complete. It's missing important functionality
(the ability to validate certificates) that it relies on complex 3rd
party C libraries to provide. Hopefully tlslite will be able to do
this by itself sometime soon.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles