我需要在emacs上安装offlineimap和mu4e.问题是配置.当我运行offlineimap时,我得到:
OfflineIMAP 6.5.5
Licensed under the GNU GPL v2+ (v2 or any later version)
Thread 'Account sync Gmail' terminated with exception:
Traceback (most recent call last):
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/threadutil.py", line 158, in run
Thread.run(self)
File "/anaconda/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/accounts.py", line 226, in syncrunner
self.remoterepos = Repository(self, 'remote')
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/repository/__init__.py", line 78, in __new__
return repo(name, account)
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/repository/Gmail.py", line 37, in __init__
IMAPRepository.__init__(self, reposname, account)
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/repository/IMAP.py", line 34, in __init__
self.imapserver = imapserver.IMAPServer(self)
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/imapserver.py", line 83, in __init__
self.sslcacertfile = repos.getsslcacertfile()
File "/usr/local/Cellar/offline-imap/6.5.6/libexec/offlineimap/repository/IMAP.py", line 211, in getsslcacertfile
% (self.name, cacertfile))
SyntaxWarning: CA certfile for repository 'Remote' could not be found. No such file: '/usr/share/curl/ca-bundle.crt.original'
Last 2 debug messages logged for Account sync Gmail prior to exception:
thread: Register new thread 'Account sync Gmail' (account 'Gmail')
imap: Using authentication mechanisms ['GSSAPI', 'CRAM-MD5', 'PLAIN', 'LOGIN']
Run Code Online (Sandbox Code Playgroud)
这是我的.offlineimaprc
[general]
accounts = Gmail
maxsyncaccounts = 1
pythonfile = ~/.offlineimap.py
[Account Gmail]
localrepository = Local
remoterepository = Remote
[Repository Local]
type = Maildir
localfolders = ~/Maildir
[Repository Remote]
type = Gmail
remoteuser = enrico.pirani0@gmail.com
remotepasseval = get_password_emacs("imap.gmail.com", "enrico.pirani0@gmail.com", "993")
realdelete = no
folderfilter = lambda foldername: foldername not in ['[Gmail]/Spam', '[Gmail]/All Mail', '[Gmail]/Starred', '[Gmail]/Important']
holdconnectionopen = true
keepalive = 60
sslcacertfile = /usr/share/curl/ca-bundle.crt.original #??
Run Code Online (Sandbox Code Playgroud)
python安装存在问题,而CA证书存在问题.点是没有任何curl-ca-bundle brew包.我还有其他方法来安装证书吗?
use*_*490 32
我有一个类似的问题(在MacOS 10.10.2上,openssl 1.0.2和offlineimap 6.5.5都来自自制软件)并且无法使虚拟证书解决方案起作用.但是,我发现了一个使offlineimap停止抱怨的证书文件/usr/local/etc/openssl/cert.pem(通过自制程序安装openssl时放在那里,brew info openssl告诉我).警告:我不知道这是否是一种好的或安全的方法.
lun*_*orn 13
OS X上通常没有CA证书包,因为SSL库通常在内部使用Apple的安全框架并从Keychain获取证书.
您可以从Keychain证书创建自己的捆绑包,但是:打开Keychain,导航到"System Roots"钥匙串中的"Certificates"类别,然后按Command + Shift + E("导出项目"),以保存所有证书.我认为Python可以处理PEM格式,所以一定要选择它.
或者,在OS X 10.6和更新版本上,系统Python是针对OpenSSL版本构建的,OpenSSL版本也始终查看Keychain.因此,您可以创建仅包含虚拟自签名证书的虚拟捆绑包,并在配置中使用该捆绑包使OfflineIMAP关闭.无论如何,它会查看Keychain证书.
有关详细信息,请参阅https://www.mercurial-scm.org/wiki/CACertificates#Mac_OS_X_10.6_and_higher.
小智 9
我运行了@wood-guardian 给出的上述命令,然后运行来解决问题。
ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE"
将上述语句的结果导出到 SSL_CERT_FILE 环境变量
导出 SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem
一种简单的方法是使用curl证书包.我使用MacPorts,因此获得了
sudo port install curl-ca-bundle
Run Code Online (Sandbox Code Playgroud)
然后,您可以运行port contents curl-ca-bundle以查看其安装的内容,然后~/.offlineimaprc在远程帐户的部分中添加以下内容
sslcacertfile =/opt/local/share/curl/curl-ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)
请注意,这也将链接到这些证书/opt/local/etc/openssl/cert.pem.
如果您安装了多个 openssl(比如 v1.0.2 和 1.1.1),就会发生这种情况。如果它们都是brew在某个时间点安装的,则必须同时卸载它们以消除冲突
brew uninstall --ignore-dependencies --force openssl@1.1
brew uninstall --ignore-dependencies --force openssl
Run Code Online (Sandbox Code Playgroud)
并重新安装其中之一,例如
brew install openssl@1.1
Run Code Online (Sandbox Code Playgroud)
希望这有效!
对于 macOS 10.15.6(目前是 macOS 11 未来版本之前的最新稳定操作系统版本),我发现这brew info openssl是如何查找所有 CA 证书所在位置以及如何添加自定义 CA.pem证书的最简单、便捷的方法。
命令输出的剧透
要添加其他证书,请将 .pem 文件放入
/usr/local/etc/openssl@1.1/certs并运行
/usr/local/opt/openssl@1.1/bin/c_rehash