Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #69980
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '__init__': 0.09; 'host,': 0.09; 'subject:version': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; '-tkc': 0.16; 'experiments': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'port)': 0.16; 'port))': 0.16; 'self.file': 0.16; 'self.port': 0.16; 'self.sock': 0.16; 'self.sslobj': 0.16; 'subject:SSL': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'specify': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'skip:" 30': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'file': 0.32; 'class': 0.32; 'could': 0.34; 'skip:s 30': 0.35; 'something': 0.35; 'version': 0.36; 'charset :us-ascii': 0.36; 'subject:?': 0.36; 'error.': 0.37; 'skip:p 20': 0.39; 'how': 0.40; 'tell': 0.60; 'show': 0.63; 'skip:r 30': 0.69; 'received:50.22': 0.84; 'edwards': 0.91 |
| Date | Wed, 9 Apr 2014 15:26:22 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| To | Grant Edwards <invalid@invalid.invalid> |
| Subject | Re: imaplib: how to specify SSL/TLS protocol version? |
| In-Reply-To | <li49ik$f94$1@reader1.panix.com> |
| References | <li49ik$f94$1@reader1.panix.com> |
| X-Mailer | Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-Get-Message-Sender-Via | boston.accountservergroup.com: authenticated_id: tim@thechases.com |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9094.1397075181.18130.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1397075181 news.xs4all.nl 2909 [2001:888:2000:d::a6]:53233 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:69980 |
Show key headers only | View raw
On 2014-04-09 20:12, Grant Edwards wrote:
> File "/usr/lib64/python2.7/imaplib.py", line 1148, in __init__
> IMAP4.__init__(self, host, port)
> SSLError: [Errno 1] _ssl.c:1419: error:1408F10B:SSL
> routines:SSL3_GET_RECORD:wrong version number
>
> Experiments show that when calling ssl.wrap_socket() I have to
> specify ssl_version=PROTOCOL_TLSv1 to avoid the above error.
>
> How do I tell imaplib to use TLS1 instead of SSL3?
Sounds like you'd need to make a subclass, something like
class IMAP4_TLS(imaplib.IMAP4_SSL):
def open(self, host="", port=IMAP4_SSL_PORT):
self.host = host
self.port = port
self.sock = socket.create_connection((host, port))
self.sslobj = ssl.wrap_socket(
self.sock,
self.keyfile,
self.certfile,
ssl_version=PROTOCOL_TLSv1,
)
self.file = self.sslobj.makefile('rb')
Alternatively, you could genericify it something like
class IMAP4_TLS(imaplib.IMAP4_SSL):
def open(self, host="",
port=IMAP4_SSL_PORT,
ssl_version=PROTOCOL_SSLv23,
):
self.host = host
self.port = port
self.sock = socket.create_connection((host, port))
self.sslobj = ssl.wrap_socket(
self.sock,
self.keyfile,
self.certfile,
ssl_version=ssl_version,
)
self.file = self.sslobj.makefile('rb')
and then call .open(..., ssl_version=PROTOCOL_TLSv1) or specify any
other protocol that you need.
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
imaplib: how to specify SSL/TLS protocol version? Grant Edwards <invalid@invalid.invalid> - 2014-04-09 20:12 +0000
Re: imaplib: how to specify SSL/TLS protocol version? Grant Edwards <invalid@invalid.invalid> - 2014-04-09 20:20 +0000
Re: imaplib: how to specify SSL/TLS protocol version? Tim Chase <python.list@tim.thechases.com> - 2014-04-09 15:33 -0500
Re: imaplib: how to specify SSL/TLS protocol version? Grant Edwards <invalid@invalid.invalid> - 2014-04-09 20:55 +0000
Re: imaplib: how to specify SSL/TLS protocol version? Grant Edwards <invalid@invalid.invalid> - 2014-04-09 21:10 +0000
Re: imaplib: how to specify SSL/TLS protocol version? Chris Angelico <rosuav@gmail.com> - 2014-04-10 11:55 +1000
Re: imaplib: how to specify SSL/TLS protocol version? Tim Chase <python.list@tim.thechases.com> - 2014-04-09 15:26 -0500
Re: imaplib: how to specify SSL/TLS protocol version? Antoine Pitrou <solipsis@pitrou.net> - 2014-04-10 19:57 +0000
csiph-web