一个专业运
维技术分享!

OpenSSL "SSL-Death-Alert" 拒绝服务漏洞(CVE-2016-8610)【原理扫描】

本文用于解决问题:  OpenSSL "SSL-Death-Alert" 拒绝服务漏洞(CVE-2016-8610)【原理扫描】。

需升级 OpenSSL、nginx 静态源码包 解决。

1、相关下载地址:

//openssl官方下载地址
https://www.openssl.org/source/

//nginx下载地址
http://nginx.org/en/download.html

2、附参考文本档:

//修订方案
https://blog.51cto.com/zhanjun/2097178

//重新编译Nginx指导手册【修复静态编译Openssl的Nginx漏洞 】[Openssl Heartbleed]
https://blog.csdn.net/hujkay/article/details/23476557

3、 本文分为3部分,OpenSSL安装、nginx安装、可能遇到问题。


一、OpenSSL安装

通常出现的OpenSSL的漏洞需要升级版本解决。

1、查看openssl版本
openssl version

2、下载openssl源码包,以 openssl-1.1.1d.tar.gz为例
https://www.openssl.org/source/

1)解压

tar  zxf   openssl-1.1.1d.tar.gz

2)编译

./config --prefix=/usr/local/openssl-1.1.1d/ssl

make && make install

3)将新编译的openssl替换系统老版本

mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/openssl-1.1.1d/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl-1.1.1d/ssl/include/openssl /usr/include/openssl

4)配置文件搜索路径

echo "/usr/local/ssl/lib/" >> /etc/ld.so.conf
ldconfig -v |grep openssl

5)查看安装完成后的最新版本

openssl version
openssl version -a


二、nginx安装

先将原nginx 备份,目录为 /usr/local/nginx。

1、查看系统 nginx是否为静态编译;

nginx -V

如果编译参数中含有--with-openssl=...,则表明Nginx是静态编译Openssl,如下所示:
nginx version: EWS/CIS

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)

built with OpenSSL 1.0.1t 3 May 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --http-log-path=/usr/local/nginx/log/access.log --error-log-path=/usr/local/nginx/log/error.log --pid-path=/usr/local/nginx/pid/nginx.pid --lock-path=/usr/local/nginx/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-pcre=/home/tools/php-tools/pcre-8.37 --without-http-cache --with-http_gzip_static_module --with-threads --with-openssl=/home/tools/openssh-tools/openssl-1.0.1t

注:注意保存configure arguments,重新编译时使用;

2、下载nginx源码包,以 nginx-1.17.8 为例;
http://nginx.org/en/download.html

1)解压安装nginx新版安装包

tar -zxvf nginx-1.17.8.tar.gz
mv nginx-1.17.8 /usr/local/nginx-1.17.8
cd /usr/local/nginx-1.17.8

2)执行配置
./configure --prefix=/usr/local/nginx --http-log-path=/usr/local/nginx/log/access.log --error-log-path=/usr/local/nginx/log/error.log --pid-path=/usr/local/nginx/pid/nginx.pid --lock-path=/usr/local/nginx/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-pcre --without-http-cache --with-http_gzip_static_module --with-threads --with-openssl=/usr/local/openssl-1.1.1d/ssl

需注意:
①    --with-pcre=/home/tools/php-tools/pcre-8.37 改为  --with-pcre
②   --with-openssl=/usr/local/openssl-1.1.1d/ssl
--with-openssl配置最新的 openssl地址;
③   --prefix=/usr/local/nginx 安装到/usr/local/nginx的nginx目录下

3)编译

make
make install

三、可能遇到问题

 1、下载openssl源码编译安装后运行

openssl version 提示:

/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

这是由于openssl库的位置不正确造成的。

可以做一个软连接。假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做  

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

这时openssl version

[root@macco-file lib64]# openssl version
OpenSSL 1.1.1d 10 Sep 2019

#如果要删除软连接,直接删掉就好

rm /usr/lib64/libcrypto.so.1.1

2、make nginx 出错

如下所示

/bin/sh: line 2: ./config: No such file or directory
make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/usr/local/src/nginx-1.9.9'
make: *** [build] Error 2

解决方法:

打开nginx源文件下的/usr/local/nginx-1.17.8/auto/lib/openssl/conf文件【去掉 .openssl】:
找到这么一段代码:

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

修改成以下代码:

CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

然后再进行Nginx的编译安装即可


3、nginx 重启失败

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /usr/local/nginx/conf/nginx.conf:138

解决方法:编辑nginx.conf文件(先备份),
ssl on 去掉;
listen 443 改为 listen 443 ssl ;



微信扫描下方的二维码阅读本文

赞(2) 打赏
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。小柳实验室 » OpenSSL "SSL-Death-Alert" 拒绝服务漏洞(CVE-2016-8610)【原理扫描】

相关推荐

  • 暂无文章

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏