Offlineimap을 사용하여 Gmail에 연결할 때 CERTIFICATE_VERIFY_FAILED

Offlineimap을 사용하여 Gmail에 연결할 때 CERTIFICATE_VERIFY_FAILED

offlineimapArch Linux에서는 이런 방식으로 Gmail과 동기화 하고 싶습니다 .

[general]
accounts = Gmail
maxsyncaccounts = 3

[Account Gmail]
localrepository = LocalGmail
remoterepository = RepositoryGmail
autorefresh = 30
quick = 10
postsynchook = mu index --maildir ~/.offlineimap/Gmail

[Repository LocalGmail]
type = GmailMaildir
localfolders = ~/.offlineimap/Gmail

[Repository RepositoryGmail]
type = Gmail
maxconnections = 2
remoteuser = my.gmail.accountname
remotepass = gmailapppassword
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail', '[Gmail]/Important']
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

SSL 관련 문제로 인해 실패했습니다.

$ offlineimap -o -a Gmail
OfflineIMAP 7.2.1
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (bundled), Python v2.7.15, OpenSSL 1.1.1a  20 Nov 2018
Account sync Gmail:
 *** Processing account Gmail
 Establishing connection to imap.gmail.com:993 (RepositoryGmail)
 ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for repository 'RepositoryGmail'. OpenSSL responded:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)

다음을 실행하여 SSL 연결을 확인할 수 있다는 다른 곳을 읽었습니다.

$ openssl s_client -showcerts -connect imap.gmail.com:993
[...]
* OK Gimap ready for requests from 217.63.244.188 s26mb317463625edc

나에게 이는 오류가 실제로 SSL 연결에 있는 것이 아니라 offlineimap처리 방법에 있음을 나타냅니다. 인증서 파일이 존재하며 GlobalSign 루트 CA - R2 인증서를 포함합니다.

각각의 virtualenv를 사용하여 six깨끗한 python2.7과 깨끗한 python3.7을 설치했고 여전히 거기에 있는지 확인하기 위해.offlineimappipCERTIFICATE_VERIFY_FAILED

Offlineimap이 Gmail과 대화하도록 하는 방법은 무엇입니까?

답변1

아치에서 OpenSSL은 이제 1.1.1이며 imaplib2를 사용하는 데 문제가 있습니다.

https://github.com/imaplib2/imaplib2/issues/5

아래에 설명된 대로:

https://github.com/OfflineIMAP/offlineimap/issues/573

.offlineimaprc에 ssl_version=tls1_2를 추가하면 문제가 해결됩니다.

관련 정보