关键词:
转自:http://www.cnblogs.com/lzcys8868/p/9235538.html
首先我觉得没事就用绿盟扫漏洞的公司,就是闲的蛋疼,傻逼!不少服务器使用nginx,如果openssl 是静态编译的,直接将openssl 编译到nginx里面去了,这就意味着,单纯升级openssl 是没有任何效果的,nginx不会加载外部的openssl动态链接库的,必须将nginx重新编译才可以根治。所以我说那些没事就扫漏洞的公司是傻逼。。。
一.判断nginx 是否是静态编译的
[[email protected] ~]# /usr/local/nginx/sbin/nginx –V
如果编译参数中含有 –with-openssl= path ,或者有 –with-http_ssl_module ,则表明nginx 是静态编译的,那么恭喜你在升级完openssl 之后还有重新编译nginx,指定openssl 的目录。
二. 升级openssl(后续需要重新编译nginx,建议采用此方法升级openssl)
> cd /opt/ > wget https://www.openssl.org/source/openssl-1.1.0j.tar.gz > cd /opt/openssl-1.1.0j/ > ./config --prefix=/usr/local/openssl > echo $? 0 > make && make install > echo $? 0
将新编译的openssl 替换老版本的
> mv /usr/bin/openssl /usr/bin/openssl.bak > mv /usr/include/openssl /usr/include/openssl.bak > ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl > ln -s /usr/local/openssl/include/openssl /usr/include/openssl
> cd /usr/local/openssl/lib/ > cp libssl.so.1.1 /usr/lib64/libssl.so.1.1 > cp libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
> ldconfig -v | grep ssl ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-696.13.2.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-696.16.1.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg ldconfig: /etc/ld.so.conf.d/kernel-ml-aufs-3.10.5-3.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg libssl.so.1.1 -> libssl.so.1.1 libssl.so.10 -> libssl.so.1.0.1e libssl3.so -> libssl3.so
> openssl version -a OpenSSL 1.1.0j 20 Nov 2018 built on: reproducible build, date unspecified platform: linux-x86_64 options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr) compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR=""/usr/local/openssl/ssl"" -DENGINESDIR=""/usr/local/openssl/lib/engines-1.1"" -Wa,--noexecstack OPENSSLDIR: "/usr/local/openssl/ssl" ENGINESDIR: "/usr/local/openssl/lib/engines-1.1"
三.重新编译nginx
查看nginx 中openssl 的版本
> ./nginx -V nginx version: nginx/1.12.2 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=modules/nginx-rtmp-module
重新编译nginx,并制定openssl 新版本的目录。重新编译nginx时,之前nginx 的配置参数要保证一样
> cd /opt > git clone https://github.com/nginx/nginx.git > cd /opt/nginx > cp ./auto/configure ./ > ./configure --prefix=/usr/local/nginx --with-debug --with-pcre-jit --with-openssl=/usr/local/openssl --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=modules/nginx-rtmp-module
make 报错
[[email protected] nginx]# make make -f objs/Makefile make[1]: Entering directory `/opt/nginx‘ cd /usr/local/openssl && if [ -f Makefile ]; then make clean; fi && ./config --prefix=/usr/local/openssl/.openssl no-shared && make && make install_sw LIBDIR=lib /bin/sh: line 2: ./config: No such file or directory make[1]: *** [/usr/local/openssl/.openssl/include/openssl/ssl.h] Error 127 make[1]: Leaving directory `/opt/nginx‘ make: *** [build] Error 2
解决方法如下:
修改nginx 源文件下的 /opt/nginx/auto/lib/openssl/conf
找到这么一段代码:
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_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"
然后重新编译安装nginx
> ./configure --prefix=/usr/local/nginx --with-debug --with-pcre-jit --with-openssl=/usr/local/openssl --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=modules/nginx-rtmp-module > make
注:此处千万不要 执行make install,否则会覆盖nginx 之前的配置文件
拷贝nginx的二进制目录到nginx的安装目录下
> ps -ef|grep nginx root 4261 1 0 09:16 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nobody 4267 4261 0 09:16 ? 00:00:00 nginx: worker process root 24701 5987 0 16:09 pts/3 00:00:00 grep nginx > kill -9 4261 > kill -9 4267 > cp /opt/nginx/objs/nginx /usr/local/nginx/sbin/
# 重启nginx 查看nginx中的openssl 版本
> cd /usr/local/nginx/sbin > ./nginx -c /usr/local/nginx/conf/nginx.conf
>./nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
built with OpenSSL 1.1.0j 20 Nov 2018
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-debug --with-pcre-jit --with-openssl=/usr/local/openssl --with-http_ssl_module --with-openssl=/usr/local/openssl --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=modules/nginx-rtmp-module
至此,openssl 升级结束。在此过程中,遇到很多坑,以此文档帮助需要没事就升级openssl的小伙伴
openssl升级过后,-bash:openssl:commandnotfound
...操作系统是。红帽5.4.SSL原来的版本是操作系统自带的是OpenSSL0.9.8branchisNOTvulnerable然后今天升级来着。我是用ROOT用户升级的。版本是OpenSSL1.0.1g这是我的升级步骤#tar-xzvfopenssl-1.0.1g.tar.gz#cdopenssl-1.0.1g#./configsharedzlib#make#makeinstallmv/usr/... 查看详情
redhat6.5升级openssh和openssl
本文基于RedHat6.5(RHEL6.5)64位版本升级OpenSSH和OpenSSL的操作过程一、查看当前版本信息uname -aLinuxlocalhost.localdomain2.6.32-431.el6.x86_64#1SMPSunNov1022:19:54EST2013x86_64x86_64x86_64GNU/Linuxopenssl versionOpenSS 查看详情
redhat7.2升级opensslopenssh
因公司服务器被绿盟扫描出openssl、openssh漏洞,所以需要升级openssl、openssh操作系统:RedHatEnterpriseLinuxServerrelease7.2(Maipo)软件升级版本:openssl-1.0.2k.tar.gz、openssh-7.4p1.tar.gz升级出现问题,编译安装openssh后,不会自动生成sshd.service等... 查看详情
redhat7编译升级opensslopenssh及ntp
上篇分享了RedHat6.5编译安装升级OpenSSL、OpenSSH及NTP的博文,这篇来测试一下RedHat7.2编译安装升级OpenSSL、OpenSSH及NTP,主要过程基本一致,不过openssh略有不同。上篇博文请见:RedHat6编译升级OpenSSL、OpenSSH及NTP一、系统环境操... 查看详情
redhat7.2升级opensslopenssh
1.因公司服务器被绿盟扫描出openssl、openssh漏洞,所以需要升级openssl、openssh2.操作系统:RedHatEnterpriseLinuxServerrelease7.2(Maipo)软件升级版本:openssl-1.0.2k.tar.gz、openssh-7.4p1.tar.gz3.升级出现问题,编译安装openssh后,不会自动生成sshd.serv... 查看详情
openssl升级脚本
openssl升级脚本:#!/bin/shcd /opt/downloadwget https://www.openssl.org/source/openssl-1.0.2k.tar.gztar -zxvf openssl-1.0.2k.tar.gzcd openssl-1.0.2k./config --prefix=/usr/local 查看详情
mac升级openssl
mac系统自带的openssl版本如下$opensslversionOpenSSL0.9.8zh14Jan2016github上检查最新版本使用homebrew安装opensslbrewinstallopenssl如果openssl版与新版差异较大需要升级homebrew之后重新安装。homebrew默认安装路径如下/usr/local/Cellar/openssl 由于系统... 查看详情
macos中升级openssl
MacOS中升级openssl ? ~brewinstalopenssl使用情况中始终发现,openssl并没有真正升级 在/usr/local/Cellar/openssl/目录中发现已经存在最新版? ~ll /usr/local/Cellar/openssl/total0drwxr-xr-x11xxxadmin374 41015:47 查看详情
如何升级openssl版本
参考技术A升级到最新版本OpenSSL1.0.1g。无法立即升级的用户可以以-DOPENSSL_NO_HEARTBEATS开关重新编译OpenSSL。而1.0.2-beta版本的漏洞将在beta2版本修复。当然,升级后别忘记提醒用户更改密码、提醒云服务使用者更新SSL密钥重复证书。 查看详情
openssl升级
#wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz #tar zxvf openssl-1.1.0e.tar.gz# cd openssl-1.1.0e# ./config shared zlib# make# make&n 查看详情
mac升级openssl安装tengine
【转载自https://blog.csdn.net/focusjava/article/details/51179297】 【升级Mac的openssl】终端下opensslversion查看版本,应该是0.9.8sudorm-rf/usr/bin/openssl删除自带的openssl下载最新的 openssl【https://www.openssl.org/source/o 查看详情
centos6.5的openssl升级
CentOS6.5的openssl升级:(修复心脏漏血漏洞)[[email protected]~]#rpm-qiopenssl|grepVersionVersion:1.0.1eVendor:CentOSopenssl升级:OpenSSL需要更新至1.0.2g或1.0.1syumupdate"openssl*"#没有更新版本使用源码安装openssl:wgethttps://www.o 查看详情
openssl升级(代码片段)
mkdir-p/usr/local/openssl#wgethttps://www.openssl.org/source/openssl-1.1.1d.tar.gztar-xfopenssl-1.1.1d.tar.gz-C/usr/localcd/usr/local/openssl-1.1.1d./config--prefix=/usr/local/openssl./config-tmake&am 查看详情
如何升级openssl1.0.1
参考技术A 4月8日爆出的heartbleed漏洞要求把OpenSSL升级到1.0.1g版本。 关于这个漏洞的技术说明,可以看这里:关于OpenSSL“心脏出血”漏洞的分析。 在Heartbleedtest网站,可以测试自己的网站有没有这个漏洞。 我最担... 查看详情
升级openssl
openssl漏洞:OpenSSL的Heartbleed漏洞(又称openssl心脏出血) openssl漏洞是2014年4月8日曝出严重的安全漏洞。这个漏洞使攻击者能够从内存中读取多达64KB的数据。 目前官方说受威胁的版本是1.0.1f,1.0.1e,1.0.... 查看详情
openssl升级到1.0.1g
先进行支撑包的安装:yuminstall-yzlibopenssl升级步骤:一、首先通过#opensslversion–a查看系统中存在的OpenSSL版本号1.下载最新版本的openssl源码包#wgetftp://ftp.openssl.org/source/openssl-1.0.1g.tar.gz二、安装openssl1.tar–xzvfopenssl-1.0.1g.tar.gz  查看详情
openssh升级
#以下是根据我的实际环境所写,请根据自己实际环境操作。#OpenSSH_5.3p1,OpenSSL1.0.1e-fips11Feb2013#GNUbash,version4.1.2(2)-release(x86_64-redhat-linux-gnu)#!/bin/bashcd/tmp/openssl/cp/usr/lib64/libssl.so.10/tmpcp/usr/lib64/libcry 查看详情
centos6.5openssl版本升级
CentOS6.5 Openssl升级:第一步:在openssl官网(https://www.openssl.org/)下载最新版Ps:个人使用的是openssl-1.0.1u.tar.gz版本 第二步:解压openssl-1.0.1u.tar.gztarzxvfopenssl-1.0.1u.tar.gz 第三步:安装A、./configB、makeC、makeins 查看详情