您的位置:首页 > 运维架构

openssl版本升级

2016-04-05 16:17 357 查看
DROWN 中间人劫持漏洞漏洞描述:国外安全专家发现了一种名为“DROWN”的中间人攻击方式,漏洞编号为CVE-2016-0800。若服务器支持以“SSLv2”协议和“EXPORT”加密算法进行安全连接时,攻击者通过截获客户端和服务端的通信数据,利用穷举的方式破解出被加密的原文,实现中间人劫持。解决方法:openssl升级当前系统openssl版本为1.0.1e选择升级版本为1.0.2g
1,下载openssl升级包[root@as01 ~]# wget http://www.openssl.org/source/openssl-1.0.2g.tar.gz[root@as01 ~]# tar zxf openssl-1.0.2g.tar.gz[root@as01 ~]# cd openssl-1.0.2g执行文件夹中的config文件,这里openssl的安装目录默认是/usr/local/ssl(由于系统环境差异路径可能不一致,下同),注意添加zlib参数,使其编译成动态库
查看zlib是否安装[root@as01 ~/openssl-1.0.2g]# rpm -q zlibzlib-1.2.3-29.el6.x86_64[root@as01 ~/openssl-1.0.2g]# ./config shared zlib[root@as01 ~/openssl-1.0.2g]# make && make install && echo ok!!!编译完成
替换模块[root@as01 ~/openssl-1.0.2g]# mv /usr/bin/openssl /usr/bin/openssl.old[root@as01 ~/openssl-1.0.2g]# mv /usr/include/openssl /usr/include/openssl.old[root@as01 ~/openssl-1.0.2g]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl[root@as01 ~/openssl-1.0.2g]# ln -s /usr/local/ssl/include/openssl /usr/include/openssl
修改系统自带的openssl库文件[root@as01 ~/openssl-1.0.2g]# ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so
查看openssl以来库是不是1.0.2g[root@as01 ~/openssl-1.0.2g]# strings /usr/local/lib64/libssl.so |grep OpenSSLOpenSSLDieSSLv3 part of OpenSSL 1.0.2g 1 Mar 2016TLSv1 part of OpenSSL 1.0.2g 1 Mar 2016DTLSv1 part of OpenSSL 1.0.2g 1 Mar 2016OpenSSL 1.0.2g 1 Mar 2016
在/etc/ld.so.conf文件中写入openssl库文件的搜索路径echo "/usr/local/ssl/lib" >> /etc/ld.so.conf[root@as01 ~/openssl-1.0.2g]# cat /etc/ld.so.confinclude ld.so.conf.d/*.conf/lib/lib64/usr/lib/usr/lib64/usr/local/lib/usr/local/lib64/usr/local/ssl/lib使修改后的/etc/ld.so.conf生效[root@as01 ~/openssl-1.0.2g]# ldconfig[root@as01 ~/openssl-1.0.2g]# ldconfig -v/usr/local/ssl/lib:libssl.so.1.0.0 -> libssl.so.1.0.0libcrypto.so.1.0.0 -> libcrypto.so.1.0.0
Centos6.5 的是在/usr/lib64/libssl.so 和/usr/lib64/libssl.so.1.0.1e其中/usr/lib/libssl.so是/usr/lib/libssl.so.1.0.1e的软连接[root@as01 /usr/lib64]# ll libssl.solrwxrwxrwx 1 root root 16 12月 12 23:54 libssl.so -> libssl.so.1.0.1e只需要把/usr/local/ssl/lib/libssl.so.1.0.0替换为/usr/lib/libssl.so.1.0.2g即可[root@as01 /usr/lib64]# mv libssl.so.1.0.1e libssl.so.1.0.1eold[root@as01 /usr/lib64]# cp /usr/local/ssl/lib/libssl.so.1.0.0 /usr/lib64/libssl.so.1.0.1e[root@as01 /usr/lib64]# ldconfig查看openssl版本[root@as01 /usr/lib64]# openssl versionOpenSSL 1.0.2g 1 Mar 2016查看openssl对nginx时动态库还是静态[root@as01 /usr/lib64]# ldd /usr/sbin/nginxlinux-vdso.so.1 => (0x00007fff165f0000)libpthread.so.0 => /lib64/libpthread.so.0 (0x00000036cbe00000)libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000036cde00000)libpcre.so.0 => /lib64/libpcre.so.0 (0x00000036cfe00000)libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000306e600000)libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000306e200000)有libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000306e600000)就是动态库依赖,反之静态也可以查看nginx编译模块[root@as01 /usr/lib64]# nginx -Vnginx version: nginx/1.0.15built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)TLS SNI support enabledconfigure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E如果不存在--with-openssl就是动态编译ssl,反之为静态动态更新openssl,直接重启nginx apache等webserver
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息