Nginx遇到TLS Client-initiated 重协商攻击(CVE-2011-1473)

本文介绍了CentOSLinux7中SSLrenegotiation漏洞的影响、原因,以及如何通过升级OpenSSL版本和重新配置nginx来解决此问题,包括可能遇到的问题及解决方法,最后详细步骤说明了如何配置SSL证书和启动nginx服务。
摘要由CSDN通过智能技术生成

现场环境

        系统:CentOS Linux 7

        代理服务器:nginx   

漏洞描述

        该漏洞存在于SSL renegotiation的过程中。对于使用SSL重协商功能的服务都会受其影响。特别的,renegotiation被用于浏览器到服务器之间的验证。虽然目前可以在不启用renegotiation进程的情况下使用HTTPS,但很多服务器的默认设置均启用了renegotiation功能。该漏洞只需要一台普通电脑和DSL连接即可轻易攻破SSL服务器。而对于大型服务器集群来说,则需要20台电脑和120Kbps的网络连接即可实现。SSL是银行、网上电子邮件服务和其他用于服务器和用户之间保护私人数据并安全通信必不可少的功能。所以本次拒绝服务漏洞影响范围非常广危害非常大。

具体原因

        根据国家安全漏洞库描述,OpenSL 0.9.8之前版本和0.9.8m版本至1x版本中存在权限许可和访问控制问题漏洞。

解决办法

        升级openssl并重新安装nginx

卸载原有openssl

rpm -qa | grep openssl

显示
openssl-0.9.8e-12.el5
openssl-devel-0.9.8e-12.el5

rpm -e 以上包名称

安装openssl3.x

参考 http://t.csdnimg.cn/P7baW

安装nginx指定openssl3.x并配置https

(1)下载nginx安装包


wget http://nginx.org/download/nginx-1.22.1.tar.gz 


(2)解压

tar -xzvf nginx-1.22.1.tar.gz


(3)编译、安装


cd nginx-1.22.1
./configure  --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/usr/local

可能遇到的问题1:
the HTTP rewrite module requires the PCRE libraryh
执行yum -y install pcre-devel命令,并重新解压执行

可能遇到的问题2:
the HTTP gzip module requires the zlib library
执行yum install -y zlib-devel命令,并重新解压执行

make && make install

可能遇到的问题:(基本上一定会出现!!!)
make -f objs/Makefile
make[1]: 进入目录“/opt/soft/nginx-1.22.1”
cd /usr/local/openssl
&& if [ -f Makefile ]; then make clean; fi
&& ./config --prefix=/usr/local/openssl/.openssl no-shared no-threads
&& make
&& make install_sw LIBDIR=lib
/bin/sh:行2: ./config: 没有那个文件或目录
make[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] 错误 127
make[1]: 离开目录“//opt/soft/nginx-1.22.1”
make: *** [build] 错误 2

原因就是nginx源码中openssl的路径错了
解决办法:进入nginx解压目录下中,修改conf文件。

cd /opt/soft/nginx-1.22.1/auto/lib/openssl
vim conf

把文件中所有的.openssl替换为openssl,把所有的lib/替换为lib64/

make clean
并重新执行
./configure  --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=/usr/local
make && make install

(4)配置证书并开启ssl

vim /usr/local/nginx/conf/nginx.conf

在server下配置:

#国际 RSA 证书
ssl_certificate                 certs/rsa.crt;
ssl_certificate_key             certs/rsa.key;

ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
 #表示使用的加密套件的类型。
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #表示使用的TLS协议的类型。
ssl_prefer_server_ciphers on;

(证书自行下载)

(5)启动


cd /usr/local/nginx/sbin
./nginx 

这样就大功告成啦!

  • 14
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值