加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

强制nginx代理服务器的特定SSL协议

发布时间:2020-12-13 21:40:39 所属栏目:Nginx 来源:网络整理
导读:我正在开发针对远程https Web服务的应用程序.在开发过程中,我需要将来自本地开发服务器(在ubuntu上运行nginx)的请求代理到远程https Web服务器.这是相关的nginx配置: server { server_name project.dev; listen 443; ssl on; ssl_certificate /etc/nginx/ss

我正在开发针对远程https Web服务的应用程序.在开发过程中,我需要将来自本地开发服务器(在ubuntu上运行nginx)的请求代理到远程https Web服务器.这是相关的nginx配置:

server {
    server_name project.dev;
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;

    location / {

        proxy_pass      https://remote.server.com;
        proxy_set_header Host remote.server.com;
        proxy_redirect off;
    }
}

问题是远程HTTPS服务器只能通过SSLv3接受连接,如以下openssl调用所示.

不工作:

$openssl s_client -connect remote.server.com:443                 
CONNECTED(00000003)
139849073899168:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 226 bytes
---
New,(NONE),Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

工作:

$openssl s_client -connect remote.server.com:443 -ssl3
CONNECTED(00000003)

使用当前设置,当我在浏览器中连接到它时,我的nginx代理会提供502 Bad Gateway.在错误日志中启用调试我可以看到消息:[info] 1451#0:* SSL握手时的对等关闭连接,而SSL握手到上游.

我尝试添加ssl_protocols SSLv3;到nginx配置,但没有帮助.

有谁知道如何设置它才能正常工作?

编辑 – 添加了额外的请求信息:

使用OpenSSL版本在Ubuntu 12.04上运行:

$openssl version
OpenSSL 1.0.1 14 Mar 2012

解决方案

由@Christopher Perrin提供的解决方案是将openssl降级到1.0.0.以下是为我成功完成此操作的命令(在AMD64上运行的ubuntu 12.04上):

wget http://launchpadlibrarian.net/81976289/openssl_1.0.0e-2ubuntu4_amd64.deb
sudo dpkg -i openssl_1.0.0e-2ubuntu4_amd64.deb
wget http://launchpadlibrarian.net/81976290/libssl1.0.0_1.0.0e-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.0e-2ubuntu4_amd64.deb
最佳答案
您的问题的可能解决方案被描述为here

由于存在错误,您必须在Nginx系统中降级到OpenSSL 1.0.0.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读