Security

為什麼 GCM HTTPS 不能與 nginx 一起使用?

  • July 3, 2014

由於這兩個使用 GCM(伽羅瓦/計數器模式)

www.ssllabs.com: ECDHE-RSA-AES256-GCM-SHA384
www.google.com: ECDHE-RSA-AES128-GCM-SHA256

我們想讓我們的網路伺服器的 HTTPS 連接更安全(不要看自簽名證書,現在還不算……)。

我們使用的是 OpenBSD 5.4 64 位作業系統,openssl ciphers命令說它支持ECDHE-RSA-AES256-GCM-SHA384密碼。在客戶端至少有 Firefox 30。

下面是我們設置 HTTPS 伺服器的方法:

# generate self signed certificate
   openssl genrsa -aes256 -out /etc/ssl/private/server.key 4096
   openssl req -new -key /etc/ssl/private/server.key -out /etc/ssl/private/server.csr
   openssl x509 -sha512 -req -days 365 -in /etc/ssl/private/server.csr -signkey /etc/ssl/private/server.key -out /etc/ssl/server.crt

配置:

vi /etc/nginx/nginx.conf
   ssl_protocols TLSv1.2;
   ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384;
   ssl_prefer_server_ciphers   on;

但是 Firefox 說(我用我的語言翻譯了它..):

www.foo.hu 的連接中斷

ssllabs說:

評估失敗:無法與安全伺服器通信

  • 我們如何在 nginx 中設置 GCM?
  • 為什麼新的 Firefox 不能通過 HTTPS 連接到www.foo.hu( ECDHE-RSA-AES256-GCM-SHA384, TLSv1.2)?

它可以www.ssllabs.com通過 HTTPS(ECDHE-RSA-AES256-GCM-SHA384,TLSv1.2)連接,所以也許這不是客戶端問題?

[user@localhost ~] openssl s_client -connect www.foo.hu:443
CONNECTED(00000003)
depth=0 C = HU, CN = www.foo.hu
verify error:num=18:self signed certificate
verify return:1
depth=0 C = HU, CN = www.foo.hu
verify return:1
---
Certificate chain
0 s:/C=HU/CN=www.foo.hu
  i:/C=HU/CN=www.foo.hu
---
Server certificate
-----BEGIN CERTIFICATE-----
.... here goes the cert..
-----END CERTIFICATE-----
subject=/C=HU/CN=www.foo.hu
issuer=/C=HU/CN=www.foo.hu
---
No client certificate CA names sent
---
SSL handshake has read 2137 bytes and written 389 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
   Protocol  : TLSv1.2
   Cipher    : ECDHE-RSA-AES256-GCM-SHA384
   Session-ID: ...bla-bla
   Session-ID-ctx: 
   Master-Key: ...bla-bla
   Key-Arg   : None
   Krb5 Principal: None
   PSK identity: None
   PSK identity hint: None
   TLS session ticket lifetime hint: 300 (seconds)
   TLS session ticket:
...bla-bla

   Start Time: 1404296744
   Timeout   : 300 (sec)
   Verify return code: 18 (self signed certificate)
---
read:errno=0
[user@localhost ~] 

更改密碼套件是最終的解決方案。

ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256;

問題是 Firefox 30 還不支持上述密碼。

引用自:https://unix.stackexchange.com/questions/140337