次のコードは、原則としてhttps://badssl.comのコンテンツを返します。
(with-current-buffer
(url-retrieve-synchronously "https://badssl.com")
(buffer-string))
しかし、私のGNU Emacs 25.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1112)) of 2015-08-24OS X 10.10.5では、で実行すると-Q、代わりに次のメッセージが表示されます。
Certificate information
Issued by: COMODO RSA Domain Validation Secure Server CA
Issued to: Domain Control Validated
Hostname: *.badssl.com
Public key: RSA, signature: RSA-SHA256
Protocol: TLS1.2, key: ECDHE-RSA, cipher: AES-128-GCM, mac: AEAD
Security level: Medium
Valid: From 2015-04-09 to 2016-07-07
The TLS connection to badssl.com:443 is insecure for the following
reasons:
the certificate was signed by an unknown and therefore untrusted authority
certificate could not be verified
証明書を受け入れるかどうかを尋ねます-いいえ/セッション/常に。その後、証明書を受け入れれば機能します。
たとえば、wgetで同じ問題が発生しません。Wgetはhttps://badssl.comを正しくダウンロードし(質問せずに)、https://self-signed.badssl.comを拒否します。
さらに、gnutlsとtls という2つの個別のカスタマイズグループがあるようです。私は、以前のgnutls(のためのサポートとのemacsをコンパイルしたgnutls-available-pリターンt)。Gnutlsは自作でインストールされました。
に設定gnutls-verify-errorするとt、代わりにエラーが発生します
gnutls-negotiate: Certificate validation failed badssl.com, verification code 42
したがって、おそらく最初の例ではgnutlsは使用されていません。OS Xでは、gnutls-trustfiles(/usr/sslおよび/etc/ssl)に記載されているファイルは存在しません。
では、OS Xでデフォルトの信頼されたルート証明書を使用するようにemacsを構成するにはどうすればよいですか?
編集:libressl自作からインストールしてに追加/opt/brew/etc/libressl/cert.pemしgnutls-trustfilesた場合、gnutls-verify-errorset to t を使用すると問題が解決します。
編集2:私のテストでは、の値tls-certtool-programは実際に使用されたようには見えませんが、とにかくOS Xには正しくない可能性があります。OSXのデフォルトのcerttoolは、tls.elが必要とするGnuTLS certtoolではなく、自作のgnutls代わりにgnutls-certtoolにすべきだと思います。
../emacs/configure --with-ns CPPFLAGS=-I/opt/brew/include LDFLAGS=-L/opt/brew/lib(../emacsのクローンであるgit://git.savannah.gnu.org/emacs.git当時)makeとmake install。configureの出力には、が使用されていると表示されています-lgnutls。