offlineimap icon indicating copy to clipboard operation
offlineimap copied to clipboard

IMAP4 protocol error: socket error: <type 'exceptions.IOError'>

Open isfttr opened this issue 6 years ago • 3 comments

General Informations

  • system/distribution (with version):
    $ uname -a
    
    Linux localhost 4.19.13-1-lts #1 SMP Sun Dec 30 07:38:47 CET 2018 x86_64 GNU/Linux
    
    $ lsb_release -a
    
    LSB Version:    1.4
    Distributor ID: ArchLabs
    Description:    ArchLabs Linux
    Release:        2018.12.17
    Codename:       ArchLabs
    
  • offlineimap version (offlineimap -V):
    $ offlineimap -V
    offlineimap v7.2.2, imaplib2 v2.57 (bundled), Python v2.7.15, OpenSSL 1.1.1a  20 Nov 2018
    
  • Python version:
    $ python --version
    Python 3.7.2
    ┌ ~
    └> $ python2 --version
    Python 2.7.15
    
  • server name or domain:
  • CLI options:

Configuration file offlineimaprc

[general]
accounts = accountname
pythonfile = ~/.config/mutt/credentials/imappwd.py

[Account accountname]
localrepository = accountname-local
remoterepository = accountname-remote
#autorefresh = 10
maxage = 720
ignorelabels = \Inbox, \Starred, \Sent, \Draft, \Spam, \Trash, \Important

[Repository accountname-remote]
auth_mechanisms = LOGIN
type = Gmail
remoteuser = admin
remotepasseval = mailpasswd("accountname")
remoteport = 993
starttls = no
ssl = yes
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail']
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

oauth2_client_id = ID
oauth2_client_secret = SECRET
oauth2_access_token = TOKEN
oauth2_request_url = https://accounts.google.com/o/oauth2/token
oauth2_refresh_token = SECRET

remotepassfile = ~/accountname

transporttunnel = openssl s_client -host myimap -port 993 -quiet

cert_fingerprint=f3043dd689a2e7dddfbef82703a6c65ea9b634c1

[Repository accountname-local]
type = GmailMaildir
localfolders = ~/.mail/accountname

pythonfile (if any)

Logs, error

Establishing connection to tunnel:openssl s_client -host myimap -port 993
140692074840576:error:2008F002:BIO routines:BIO_lookup_ex:system lib:crypto
connect:errno=22
ERROR: While attempting to sync account 'accountname'
IMAP4 protocol error: socket error: <type 'exceptions.IOError'> - Hang up

Steps to reproduce the error

$ offlineimap -a accountname

OfflineIMAP 7.2.2
Licensed under the GNU GPL v2 or any later version (with an OpenSSL excep
imaplib2 v2.57 (bundled), Python v2.7.15, OpenSSL 1.1.1a  20 Nov 2018
Account sync accountname:
*** Processing account accountname
Establishing connection to tunnel:openssl s_client -host myimap -port 993
140692074840576:error:2008F002:BIO routines:BIO_lookup_ex:system lib:crypto
connect:errno=22
ERROR: While attempting to sync account 'accountname'
IMAP4 protocol error: socket error: <type 'exceptions.IOError'> - Hang up
*** Finished account 'accountname' in 0:10
ERROR: Exceptions occurred during the run!
ERROR: While attempting to sync account 'accountname'
IMAP4 protocol error: socket error: <type 'exceptions.IOError'> - Hang up

Traceback:
File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 283
self.__sync()
File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 359
remoterepos.getfolders()
File "/usr/lib/python2.7/site-packages/offlineimap/repository/IMAP.py", l
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python2.7/site-packages/offlineimap/imapserver.py", line 5
use_socket=self.proxied_socket,
File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line
IMAP4.__init__(self, tunnelcmd, **kwargs)
File "/usr/lib/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
self.welcome = self._request_push(name='welcome', tag='continuation').g
File "/usr/lib/python2.7/site-packages/offlineimap/bundled_imaplib2.py",
raise typ(exc_fmt % str(val))

isfttr avatar Jan 06 '19 14:01 isfttr

It looks like the tunnel hurts. Do you have to use a tunnel?

nicolas33 avatar Jan 06 '19 15:01 nicolas33

If I remove the tunnel line I get the following error:

 *** Processing account accountname
 Establishing connection to imap.gmail.com:993 (accountname-remote)
 ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for repository 'accountname-remote'. OpenSSL responded:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)
 *** Finished account 'accountname' in 0:04
ERROR: Exceptions occurred during the run!
ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for repository 'accountname-remote'. OpenSSL responded:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)

isfttr avatar Jan 06 '19 17:01 isfttr

Seems related to #573

nicolas33 avatar Jan 17 '19 11:01 nicolas33