如何为 NGINX 配置选择正确的密码
How to choose the right ciphers for NGINX config
我是 nginx
的新手,我最近才决定更改配置文件,使用 [=38= 将我的应用程序从 http
重定向到 https
] 声明 return 301 https://$host$request_uri;
。这一切都很好,直到我注意到我们没有通过 Twilio API
接收短信。我决定调试这个问题,发现我收到了 SSL/TLS Handshake Error
.
查看调试器,我发现他们认为这是问题的可能原因:
Incompatible cipher suites in use by the client and the server. This would require the client to use (or enable) a cipher suite that is supported by the server.
查看 nginx
配置文件,我注意到没有使用密码,这可能是问题的根源,而不是因为未启用 TLS 查看下面的配置:
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name localhost;
ssl_certificate "/etc/nginx/ssl/domain-crt.txt";
ssl_certificate_key "/etc/nginx/ssl/domain-key.txt";
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
## More configuration below this...
}
Twilio
有一个支持的密码列表,可以在 here 中找到,但我不确定如何在我的配置文件中执行此操作。因为我的协议包括 TLSv1, TLSv1.1, and TLS1.2
,所以我应该使用所有这些吗?或者我只使用列表中的其中一个。我真的很困惑我需要在 ssl_ciphers
变量中设置什么。
我还读到在 ssl_protocols
中启用 SSLv3
是个坏主意。我可以将其从 ssl_protocols
中删除并保存配置而不导致重大问题吗?
如果有人能帮我回答这些问题,那将非常有帮助。谢谢!
密码默认使用,Nginx根据版本配置。
In version 1.0.5 and later, the default SSL ciphers are
HIGH:!aNULL:!MD5. In versions 0.7.65 and 0.8.20 and later, the default
SSL ciphers are HIGH:!ADH:!MD5. From version 0.8.19 the default SSL
ciphers are ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM. From version 0.7.64,
0.8.18 and earlier the default SSL ciphers are ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP.
See Nginx Docs for more information.
但您也可以明确选择您要允许使用的密码:
ssl_ciphers "密码1密码2 ...密码N";
例如 - ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256";只支持这个特定的密码套件。
关于:
Also I read that having SSLv3 enabled in ssl_protocols is a bad idea.
Can I just remove that from the ssl_protocols and save the config
without it causing major issues?
它可能导致的唯一主要问题是使用 SSLv3 的客户端尝试连接您的服务器将被拒绝,因为它不被您的服务器接受(配置文件不支持)。无论如何,在某些版本中它是 Nginx 的默认值,不应该是问题。
来自 Nginx 文档:
From versions 0.7.65 and 0.8.19 and later, the default SSL protocols
are SSLv3, TLSv1, TLSv1.1, and TLSv1.2 (if supported by the OpenSSL
library).
我是 nginx
的新手,我最近才决定更改配置文件,使用 [=38= 将我的应用程序从 http
重定向到 https
] 声明 return 301 https://$host$request_uri;
。这一切都很好,直到我注意到我们没有通过 Twilio API
接收短信。我决定调试这个问题,发现我收到了 SSL/TLS Handshake Error
.
查看调试器,我发现他们认为这是问题的可能原因:
Incompatible cipher suites in use by the client and the server. This would require the client to use (or enable) a cipher suite that is supported by the server.
查看 nginx
配置文件,我注意到没有使用密码,这可能是问题的根源,而不是因为未启用 TLS 查看下面的配置:
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name localhost;
ssl_certificate "/etc/nginx/ssl/domain-crt.txt";
ssl_certificate_key "/etc/nginx/ssl/domain-key.txt";
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
## More configuration below this...
}
Twilio
有一个支持的密码列表,可以在 here 中找到,但我不确定如何在我的配置文件中执行此操作。因为我的协议包括 TLSv1, TLSv1.1, and TLS1.2
,所以我应该使用所有这些吗?或者我只使用列表中的其中一个。我真的很困惑我需要在 ssl_ciphers
变量中设置什么。
我还读到在 ssl_protocols
中启用 SSLv3
是个坏主意。我可以将其从 ssl_protocols
中删除并保存配置而不导致重大问题吗?
如果有人能帮我回答这些问题,那将非常有帮助。谢谢!
密码默认使用,Nginx根据版本配置。
In version 1.0.5 and later, the default SSL ciphers are HIGH:!aNULL:!MD5. In versions 0.7.65 and 0.8.20 and later, the default SSL ciphers are HIGH:!ADH:!MD5. From version 0.8.19 the default SSL ciphers are ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM. From version 0.7.64, 0.8.18 and earlier the default SSL ciphers are ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP. See Nginx Docs for more information.
但您也可以明确选择您要允许使用的密码: ssl_ciphers "密码1密码2 ...密码N"; 例如 - ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256";只支持这个特定的密码套件。 关于:
Also I read that having SSLv3 enabled in ssl_protocols is a bad idea. Can I just remove that from the ssl_protocols and save the config without it causing major issues?
它可能导致的唯一主要问题是使用 SSLv3 的客户端尝试连接您的服务器将被拒绝,因为它不被您的服务器接受(配置文件不支持)。无论如何,在某些版本中它是 Nginx 的默认值,不应该是问题。
来自 Nginx 文档:
From versions 0.7.65 and 0.8.19 and later, the default SSL protocols are SSLv3, TLSv1, TLSv1.1, and TLSv1.2 (if supported by the OpenSSL library).