【问题标题】:Trouble opening gmail nnimap server in Emacs gnus on Windows在 Windows 上的 Emacs gnus 中打开 gmail nnimap 服务器时出现问题
【发布时间】:2014-01-02 16:37:04
【问题描述】:

我正在尝试使用 Emacs gnus 连接到我的 gmail 帐户。这是相关的配置代码,主要拍摄from here

(setq tls-program '("openssl s_client -CAfile C:/Users/GGustafson/gmail.crt -connect %h:%p -no_ssl2 -ign_eof"))

(setq gnus-select-method '(nnimap "gmail"
  (nnimap-address "imap.gmail.com")  
  (nnimap-server-port 993)
  (nnimap-stream ssl)
  (nnimap-authinfo-file "~/.authinfo")))

(setq message-send-mail-function 'smtpmail-send-it
 smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
  smtpmail-auth-credentials '(("smtp.gmail.com" 587 "gordon3.14@gmail.com" nil))
  smtpmail-default-smtp-server "smtp.gmail.com"
  smtpmail-smtp-server "smtp.gmail.com"
  smtpmail-smtp-service 587)

当我重新启动、启动 emacs 并执行 M-x gnus 时,我得到了这些 *Messages*

Opening connection to imap.gmail.com via tls...
gnutls.c: [1] (Emacs) GnuTLS library not found
Opening TLS connection to `imap.gmail.com'...
Opening TLS connection with `openssl s_client -CAfile C:/Users/GGustafson/gmail.crt -connect imap.gmail.com:993 -no_ssl2 -ign_eof'...done
Opening TLS connection to `imap.gmail.com'...done
nnimap (gmail) open error: 'depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority^M
'.  Continue? (y or n)  y

这里到底发生了什么?以前我遇到了一些 verify error:num=20:unable to get local issuer certificate 错误,但我通过 following these instructions 修复了这些错误,这让我添加了带有相应证书副本的 -CAfile 参数。

为了确认,我可以这样做:

C:\Users\GGustafson>openssl s_client -CAfile C:/Users/GGustafson/gmail.crt -connect imap.gmail.com:993 -no_ssl2 -ign_eof
CONNECTED(00000003)
depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority verify return:1
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA verify return:1
depth=1 C = US, O = Google Inc, CN = Google Internet Authority G2 verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google Inc, CN = imap.gmail.com verify return:1
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=imap.gmail.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
****SNIP****
    Start Time: 1387083719
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
* OK Gimap ready for requests from 128.84.124.191 el7if9939594qeb.109

使用 gnus 阅读我的 Gmail 缺少什么?我在使用 Cygwin openssl 的 Windows 7 上。

【问题讨论】:

  • 尝试将-quiet 添加到s_client 选项中。

标签: ssl emacs openssl gmail-imap gnus


【解决方案1】:

我需要在 Windows 7 上从 gnus 连接到 gmail 的一件事是:

;; So gnutls can find trustfiles on windows
(eval-after-load "gnutls"
'(progn
  (setq gnutls-trustfiles '("c:/cygwin/usr/ssl/certs/ca-bundle.trust.crt" "c:/cygwin/usr/ssl/certs/ca-bundle.crt"))))

除此之外,其余设置类似:

(setq gnus-secondary-select-methods
      '(
    (nnimap "gmail"
           (nnimap-address "imap.gmail.com")
           (nnimap-server-port 993)
           (nnimap-stream ssl)
           (nnir-search-engine imap)
           (nnimap-authinfo-file "~/.authinfo")
           )
    (nntp "news.gmane.org")
    (nnfolder "archive"
      (nnfolder-directory   "~/Documents/Text/Gnus/Mail/archive")
      (nnfolder-active-file "~/Documents/Text/Gnus/Mail/archive/active")
      (nnfolder-get-new-mail nil)
      (nnfolder-inhibit-expiry t))))

能够很好地阅读来自 gmail 的邮件。

【讨论】:

  • 我最初甚至没有使用 gnutls;一旦我尝试过,而不是 openssl 事情就可以正常工作,而无需进一步定制。但是,关于gnutls-trustfiles 的建议似乎很有价值且相关,所以+1。 :)
  • 除了安装cygwin还有什么方法可以获取信任文件吗?
【解决方案2】:

对我有用的是使用a gnutls port for windows 而不是openssl,并删除tls-program 的任何自定义。如果它们在您的路径上,Emacs 将自动使用来自 gnutls 的二进制文件,因为 gnutls-cli 是第一个尝试使用默认值 tls-program 的程序。

我建议在尝试使用 openssl 之前使用 gnutls,它可能出于某种原因在默认设置中排在第一位。

【讨论】:

  • 您能否详细说明如何删除tls-program 的任何自定义?我从来没有让 Gnus 在 Windows 7 上运行。
  • @ReneFroger 不要在您的 emacs 配置中的任何位置设置 tls-program。换句话说,将其设置为默认值。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多