support for starttls

dtk d.t.k at gmx.de
Tue Apr 5 21:26:33 UTC 2011


Hi Sebastian,

On 04/05/2011 02:08 PM, Sebastian Spaeth wrote:
> On Mon, 4 Apr 2011 00:02:39 +0200, dtk <d.t.k at gmx.de> wrote:
>> I tried to use offlineimap[0] with an IMAP server that only[1][2] speaks
>> STARTTLS and got the known 'unknown protocol' error[3] when specifying
>> remoteport = 143 and ssl = yes.
> 
> No, python's imaplib doesn't support STARTTLS and so we never supported
> it. That having said, the capability was just added to python 3.2 and it
> is also available in imaplib2 (which we bundle since this version), so
> we should be able to implement STARTTLS support quite easily.
that would be rather cool!

> I added
> this as a reminder to my tracker: http://trac.sspaeth.de/issue17
cool! thx!

> Sorry that I don't have better news.
Never mind, thanks for your kind reply!


On 04/05/2011 02:26 PM, Sebastian Spaeth wrote:
> Can you try this patch on top of master? It could be that this is all
> we need for starttls support.
I'm afraid, it doesn't work for me. Most of the time the

=== connection cannot be established ===
$ time ./offlineimap.py
 OfflineIMAP 6.3.2
Copyright (C) 2002 - 2010 John Goerzen <john at complete.org>

This software comes with ABSOLUTELY NO WARRANTY; see the file
COPYING for details.  This is free software, and you are welcome
to distribute it under the conditions laid out in COPYING.
Account sync Test:
 ***** Processing account Test
 Copying folder structure from IMAP to Maildir
 Establishing connection to mail.jade-hamburg.de:143.
^CCTRL-C pressed, aborting...

real	6m41.092s
user	0m0.324s
sys	0m0.276s
$


Irregularly I do encounter two other errors, though:
=== wrong version number ===
$ ./offlineimap.py
 OfflineIMAP 6.3.2
Copyright (C) 2002 - 2010 John Goerzen <john at complete.org>

This software comes with ABSOLUTELY NO WARRANTY; see the file
COPYING for details.  This is free software, and you are welcome
to distribute it under the conditions laid out in COPYING.
Account sync Test:
 ***** Processing account Test
 Copying folder structure from IMAP to Maildir
 Establishing connection to mail.jade-hamburg.de:143.
 WARNING: Error occured attempting to sync account Test: Traceback (most
recent call last):
  File "/media/dump/offlineimap/offlineimap/accounts.py", line 191, in
syncrunner
    self.sync(siglistener)
  File "/media/dump/offlineimap/offlineimap/accounts.py", line 246, in sync
    remoterepos.syncfoldersto(localrepos, [statusrepos])
  File "/media/dump/offlineimap/offlineimap/repository/Base.py", line
121, in syncfoldersto
    srcfolders = src.getfolders()
  File "/media/dump/offlineimap/offlineimap/repository/IMAP.py", line
242, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/media/dump/offlineimap/offlineimap/imapserver.py", line 286, in
acquireconnection
    imapobj.starttls()
  File "/media/dump/offlineimap/offlineimap/imaplib2.py", line 999, in
starttls
    self.sock = ssl.wrap_socket(self.sock, keyfile, certfile)
  File "/usr/lib/python2.6/ssl.py", line 338, in wrap_socket
    suppress_ragged_eofs=suppress_ragged_eofs)
  File "/usr/lib/python2.6/ssl.py", line 120, in __init__
    self.do_handshake()
  File "/usr/lib/python2.6/ssl.py", line 279, in do_handshake
    self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:490: error:1408F10B:SSL
routines:SSL3_GET_RECORD:wrong version number

 ***** Finished processing account Test
$


=== excessive message size ===
$ ./offlineimap.py
 OfflineIMAP 6.3.2
Copyright (C) 2002 - 2010 John Goerzen <john at complete.org>

This software comes with ABSOLUTELY NO WARRANTY; see the file
COPYING for details.  This is free software, and you are welcome
to distribute it under the conditions laid out in COPYING.
Account sync Test:
 ***** Processing account Test
 Copying folder structure from IMAP to Maildir
 Establishing connection to mail.jade-hamburg.de:143.
 WARNING: Error occured attempting to sync account Test: Traceback (most
recent call last):
  File "/media/dump/offlineimap/offlineimap/accounts.py", line 191, in
syncrunner
    self.sync(siglistener)
  File "/media/dump/offlineimap/offlineimap/accounts.py", line 246, in sync
    remoterepos.syncfoldersto(localrepos, [statusrepos])
  File "/media/dump/offlineimap/offlineimap/repository/Base.py", line
121, in syncfoldersto
    srcfolders = src.getfolders()
  File "/media/dump/offlineimap/offlineimap/repository/IMAP.py", line
242, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/media/dump/offlineimap/offlineimap/imapserver.py", line 286, in
acquireconnection
    imapobj.starttls()
  File "/media/dump/offlineimap/offlineimap/imaplib2.py", line 999, in
starttls
    self.sock = ssl.wrap_socket(self.sock, keyfile, certfile)
  File "/usr/lib/python2.6/ssl.py", line 338, in wrap_socket
    suppress_ragged_eofs=suppress_ragged_eofs)
  File "/usr/lib/python2.6/ssl.py", line 120, in __init__
    self.do_handshake()
  File "/usr/lib/python2.6/ssl.py", line 279, in do_handshake
    self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:490: error:1408E098:SSL
routines:SSL3_GET_MESSAGE:excessive message size

 ***** Finished processing account Test
$


FWIW I attached some wireshark dumps.

Thx for your support
dtk


-------------- next part --------------
A non-text attachment was scrubbed...
Name: starttls_excessive_message_size.pcap
Type: application/cap
Size: 8071 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/offlineimap-project/attachments/20110405/05969641/attachment-0003.pcap>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: starttls_no_connection.pcap
Type: application/cap
Size: 7982 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/offlineimap-project/attachments/20110405/05969641/attachment-0004.pcap>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: starttls_wrong_version_number.pcap
Type: application/cap
Size: 8071 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/offlineimap-project/attachments/20110405/05969641/attachment-0005.pcap>


More information about the OfflineIMAP-project mailing list