FTP over SSL (explicit encryption)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Isaac

    #1

    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

    but that does not seem to provide any secure services.
    (Btw, Matt Croydon's intro is helpful for newbies:

    )

    I know about M2Crypto

    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


  • Eric Nieuwland

    #2
    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

    Comment

    • David Isaac

      #3
      Re: FTP over SSL (explicit encryption)


      "Eric Nieuwland" <eric.nieuwland @xs4all.nl> wrote in message
      news:mailman.29 51.1123698786.1 0512.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


      Comment

      • Andrew MacIntyre

        #4
        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@bullsey e.apana.org.au (pref) | Snail: PO Box 370
        andymac@pcug.or g.au (alt) | Belconnen ACT 2616
        Web: http://www.andymac.org/ | Australia

        Comment

        • David Isaac

          #5
          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@bullse ye.apana.org.au > wrote in message
          news:mailman.29 57.1123722670.1 0512.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

          However it requires the PyCrypto module.


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

          Thanks,
          Alan Isaac


          Comment

          • David Isaac

            #6
            Re: FTP over SSL (explicit encryption)

            "Alan Isaac" <aisaac0@verizo n.net> wrote in message
            news:CMTKe.6597 $0d.5053@trnddc 03...[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(s ocket.AF_INET, socket.SOCK_STR EAM)
            sock.settimeout (20)
            sock.connect((h ostname, port))
            my_t = paramiko.Transp ort(sock)
            my_t.connect(ho stkey=None ,username=usern ame, password=passwo rd, pkey=None)
            my_chan = my_t.open_sessi on()
            my_chan.get_pty ()
            my_chan.invoke_ shell()
            my_sftp = paramiko.SFTP.f rom_transport(m y_t)

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

            Alan Isaac


            Comment

            • David Isaac

              #7
              Re: FTP over SSL (explicit encryption)

              "Eric Nieuwland" <eric.nieuwland @xs4all.nl> wrote in message
              news:mailman.29 51.1123698786.1 0512.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:

              I haven't even had time to try it,
              but I thought you'd want to know.

              Cheers,
              Alan Isaac


              Comment

              • David Isaac

                #8
                Re: FTP over SSL (explicit encryption)

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

                "Alan Isaac" <aisaac0@verizo n.net> wrote in message
                news:S04Le.303$ Rp5.100@trnddc0 3...[color=blue]
                > sock = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
                > sock.settimeout (20)
                > sock.connect((h ostname, port))
                > my_t = paramiko.Transp ort(sock)
                > my_t.connect(ho stkey=None ,username=usern ame, password=passwo rd,[/color]
                pkey=None)[color=blue]
                > my_chan = my_t.open_sessi on()
                > my_chan.get_pty ()
                > my_chan.invoke_ shell()
                > my_sftp = paramiko.SFTP.f rom_transport(m y_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

                uses paramiko and provides a GUI.

                Cheers,
                Alan Isaac


                Comment

                • Paul Rubin

                  #9
                  Re: FTP over SSL (explicit encryption)

                  "David Isaac" <aisaac0@verizo n.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.

                  Comment

                  Working...