[Python-Dev] ssl - how to switch back to a plain text socket?

Giampaolo Rodola' gnewsg at gmail.com
Wed Feb 20 13:51:21 CET 2008


On 20 Feb, 06:08, Bill Janssen <jans... at parc.com> wrote:
> I suggest using socket.dup(sslsock) to simply create a non-encrypted
> copy of the socket, and switch to using that copy.  There's no way to
> "unwrap" an SSLSocket.

It does not seem to work:

 File "C:\python26\lib\ssl.py", line 115, in read
   return self._sslobj.read(len)
ssl.SSLError: [Errno 1] _ssl.c:1276: error:1408F10B:SSL
routines:SSL3_GET_RECORD:wrong version number


> > IIUC, RFC 4217 mandates that a TLS shutdown is exchanged (although they
> > apparently didn't read the TLS spec when they wrote the RFC, as the
>
> I'm pretty dubious about section 5 there.  I don't think reverting to
> a plaintext state, once you've been in TLS, happens in real life to
> real connections being used for FTP.
>
> Bill

I'm not sure, I've seen more than one library and server supporting
the CCC command.
For example proftpd and tnftpd servers support it.


More information about the Python-Dev mailing list