offlineimap3
offlineimap3 copied to clipboard
unknown error (_ssl.c:3063)
General information
I have tried syncing accounts using xauth2 on both Ubuntu and Fedora. Fedora doesn't work, Ubuntu does:
| Platform | Python | OpenSSl | imaplib2 | Offlineimap | Works? |
|---|---|---|---|---|---|
| Ubuntu 22.04 | 3.10.4 | 3.0.2 | 3.05 | 8.0.0 | Yes |
| Fedora 36 | 3.10.5 | 3.0.5 | 3.06 | 8.0.0 | No |
Note: Initially I had the error:
ERROR: While attempting to sync account 'xyz'
'int' object is not subscriptable
which wasn't terribly informative. So I commented out the lines
elif e.args and \
e.args[0][:35] == 'IMAP4 protocol error: socket error:':
raise OfflineImapError(
"Could not connect to remote server '{}' "
"for repository '{}'. Connection Refused.".format(
self.hostname, self.repos),
OfflineImapError.ERROR.CRITICAL)
in imapserver.py, and when running I get this error (only on Fedora)
ERROR: While attempting to sync account 'xyz'
unknown error (_ssl.c:3063)
Traceback:
File "/usr/lib/python3.10/site-packages/offlineimap/accounts.py", line 298, in syncrunner
self.__sync()
File "/usr/lib/python3.10/site-packages/offlineimap/accounts.py", line 374, in __sync
remoterepos.getfolders()
File "/usr/lib/python3.10/site-packages/offlineimap/repository/IMAP.py", line 681, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python3.10/site-packages/offlineimap/imapserver.py", line 560, in acquireconnection
imapobj = imaplibutil.WrappedIMAP4_SSL(
File "/usr/lib/python3.10/site-packages/offlineimap/imaplibutil.py", line 199, in __init__
super(WrappedIMAP4_SSL, self).__init__(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/offlineimap/imaplib2.py", line 2124, in __init__
IMAP4.__init__(self, host, port, debug, debug_file, identifier, timeout, debug_buf_lvl)
File "/usr/lib/python3.10/site-packages/offlineimap/imaplib2.py", line 357, in __init__
self.open(host, port)
File "/usr/lib/python3.10/site-packages/offlineimap/imaplibutil.py", line 207, in open
super(WrappedIMAP4_SSL, self).open(host, port)
File "/usr/lib/python3.10/site-packages/offlineimap/imaplib2.py", line 2137, in open
self.ssl_wrap_socket()
File "/usr/lib/python3.10/site-packages/offlineimap/imaplib2.py", line 517, in ssl_wrap_socket
ctx = ssl.SSLContext(ssl_version)
File "/usr/lib64/python3.10/ssl.py", line 496, in __new__
self = _SSLContext.__new__(cls, protocol)
Offlineimap on Ubuntu runs and syncs fine with no problems.
Configuration file offlineimaprc
This same config was used on both platforms:
[general]
# List of accounts to be synced, separated by a comma.
accounts = xyz
[Account xyz]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = xyz-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = xyz-remote
[Repository xyz-local]
# OfflineIMAP supports Maildir, GmailMaildir, and IMAP for local repositories.
type = Maildir
# Where should the mail be placed?
localfolders = ~/Mail
[Repository xyz-remote]
type = IMAP
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
sslversion= tls1_2 # or tls1_3
remotehost = outlook.office365.com
remoteport = 993
remoteuser = uname
auth_mechanisms = XOAUTH2
oauth2_request_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_client_id = 08162f7c-0fd2-4200-a84a-f25a4db0b584
oauth2_client_secret = TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82
oauth2_refresh_token = the value of the refresh token that works
Other things to note
I tried using Fedora's "legacy" crpyto policy and still had the same error. I found this but made no headway.
Should also mention that gmail on Fedora has the same error message, so this doesn't appear to be isolated to office365.