This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Grégoire Chauvet
Recipients Grégoire Chauvet, Matthieu Pepin, christian.heimes, corona10, jonathan-lp, paul.moore, steve.dower, tim.golden, zach.ware
Date 2018-05-14.16:39:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526315993.89.0.682650639539.issue31727@psf.upfronthosting.co.za>
In-reply-to
Content
I want to confirm that I have this exact same issue as described.

To add some information, it occurs on:
Python 3.6.3 on Windows
Python 3.6.5 on Debian, with OpenSSL 1.0.1t  3 May 2016
Python 3.5.3 on Debian, with OpenSSL 1.1.0f  25 May 2017
Python 3.6.5 on Fedora, with OpenSSL 1.1.0h-fips  27 Mar 2018
Python 3.8.0a0 on Fedora, with OpenSSL 1.1.0h-fips  27 Mar 2018

The server is FileZilla server 0.9.60 beta (this is the last version available as of today).

Depending on the version of python or OpenSSL, the error is :
  [...]
  File "/usr/lib64/python3.6/ssl.py", line 645, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error

Or:
  [...]
  File "/usr/local/lib/python3.6/ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:833)


Here is my code:
# I use a workaround to connect with implicit TLS as described here:
# https://stackoverflow.com/a/36049814/3859915
# But from what I can see, it is not related to this.

import ssl
import ftplib

class ImplicitFTP_TLS(ftplib.FTP_TLS):
    """FTP_TLS subclass that automatically wraps sockets in SSL to support implicit FTPS."""
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._sock = None

    @property
    def sock(self):
        """Return the socket."""
        return self._sock

    @sock.setter
    def sock(self, value):
        """When modifying the socket, ensure that it is ssl wrapped."""
        if value is not None and not isinstance(value, ssl.SSLSocket):
            value = self.context.wrap_socket(value)
        self._sock = value

ftps = ImplicitFTP_TLS()
ftps.set_debuglevel(2)
ftps.connect(host="hostname", port=990)
ftps.login(user="user", passwd="password")
ftps.prot_p()
ftps.nlst()

I can connect, create directories, retrieve modification date, but I cannot list files nor download them.
History
Date User Action Args
2018-05-14 16:39:53Grégoire Chauvetsetrecipients: + Grégoire Chauvet, paul.moore, christian.heimes, tim.golden, zach.ware, steve.dower, Matthieu Pepin, corona10, jonathan-lp
2018-05-14 16:39:53Grégoire Chauvetsetmessageid: <1526315993.89.0.682650639539.issue31727@psf.upfronthosting.co.za>
2018-05-14 16:39:53Grégoire Chauvetlinkissue31727 messages
2018-05-14 16:39:53Grégoire Chauvetcreate