为 Gmail 配置 Offlineimap:SSL 错误

为 Gmail 配置 Offlineimap:SSL 错误

我正在尝试配置offlineimap下载我的 Gmail,但收到错误:

OfflineIMAP 6.5.7
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Account sync Gmail:
 *** Processing account Gmail
 Establishing connection to imap.gmail.com:993
 ERROR: No CA certificates and no server fingerprints configured.  You must configure at least something, otherwise having SSL helps nothing.
 *** Finished account 'Gmail' in 0:00
ERROR: Exceptions occurred during the run!
ERROR: No CA certificates and no server fingerprints configured.  You must configure at least something, otherwise having SSL helps nothing.

Traceback:
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 263, in syncrunner
    self.__sync()
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 326, in __sync
    remoterepos.getfolders()
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/IMAP.py", line 351, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/usr/lib/python2.7/site-packages/offlineimap/imapserver.py", line 439, in acquireconnection
    use_socket=self.proxied_socket,
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line 186, in __init__
    super(WrappedIMAP4_SSL, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplib2.py", line 2063, in __init__
    IMAP4.__init__(self, host, port, debug, debug_file, identifier, timeout, debug_buf_lvl)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplib2.py", line 344, in __init__
    self.open(host, port)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line 193, in open
    "having SSL helps nothing.", OfflineImapError.ERROR.REPO)

我的.offlineimaprc是:

[general]
accounts = Gmail
maxsyncaccounts = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = ~/mail

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = [email protected]
remotepass = Secret
ssl = yes
maxconnections = 3
realdelete = no

我正在指定我的证书在哪里。为什么仍然出错?

答案1

放入条目:

sslcacertfile = /etc/ssl/certs/ca-certificates.crt

部分内容:

[远程存储库]

答案2

为了让 OfflineIMAP 使用系统默认的 CA 根文件,请将以下行

sslcacertfile = OS-DEFAULT

[Repository $remoterepository]您的 OfflineIMAP 配置文件部分中。

相关文献offlineimap.conf如下:

特殊值 OS-DEFAULT 使 Offlineimap 自动确定已知 OS 分布的标准受信任 CA 根文件的系统范围位置,并使用遇到的第一个捆绑包(如果有)。

答案3

对于 FreeBSD,请安装端口 安全/ca_root_nss

然后添加

sslcacertfile = /usr/local/share/certs/ca-root-nss.crt

相关内容