首先我觉得没事就用绿盟扫漏洞的公司,就是闲的蛋疼,傻逼!不少服务器使用nginx,如果openssl 是静态编译的,直接将openssl 编译到nginx里面去了,这就意味着,单纯升级openssl 是没有任何效果的,nginx不会加载外部的openssl动态链接库的,必须将nginx重新编译才可以根治。所以我说那些没事就扫漏洞的公司是傻逼。。。

一.判断nginx 是否是静态编译的

[root@bogon ~]# /usr/local/nginx/sbin/nginx –V

如果编译参数中含有 –with-openssl= path ,或者有 –with-http_ssl_module ,则表明nginx 是静态编译的,那么恭喜你在升级完openssl 之后还有重新编译nginx,指定openssl 的目录。

二. 升级openssl(后续需要重新编译nginx,建议采用此方法升级openssl)

[root@bogon soft]# cd /usr/src/openssl-1.1.0h/

[root@bogon openssl-1.1.0h]# ./config --prefix=/usr/local/openssl-1.1.0h/ssl

[root@bogon openssl-1.1.0h]# echo $?

0

[root@bogon openssl-1.1.0h]# make && make install

[root@bogon openssl-1.1.0h]# echo $?

0

将新编译的openssl 替换老版本的

[root@bogon openssl-1.1.0h]# mv /usr/bin/openssl /usr/bin/openssl.bak

[root@bogon openssl-1.1.0h]# mv /usr/include/openssl /usr/include/openssl.bak

[root@bogon openssl-1.1.0h]# ln -s /usr/local/openssl-1.1.0h/ssl/bin/openssl /usr/bin/openssl

[root@bogon openssl-1.1.0h]# ln -s /usr/local/openssl-1.1.0h/ssl/include/openssl  /usr/include/openssl

[root@bogon lib]# pwd

/usr/local/openssl-1.1.0h/ssl/lib

[root@bogon lib]# cp libssl.so.1.1 /usr/lib64/libssl.so.1.1

[root@bogon lib]# cp libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

[root@bogon lib]# ldconfig -v | grep ssl

ldconfig: 无法对 /usr/lib64/nx/X11 进行 stat 操作: 没有那个文件或目录

/usr/local/openssl-1.1.0h/ssl:

libssl.so.1.1 -> libssl.so.1.1

libssl3.so -> libssl3.so

libssl.so.10 -> libssl.so.1.0.1e

[root@bogon lib]# echo $?

0

[root@bogon lib]# openssl version -a

OpenSSL 1.1.0h  27 Mar 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-1.1.0h/ssl/ssl\"" -DENGINESDIR="\"/usr/local/openssl-1.1.0h/ssl/lib/engines-1.1\""  -Wa,--noexecstackOPENSSLDIR: "/usr/local/openssl-1.1.0h/ssl/ssl"

ENGINESDIR: "/usr/local/openssl-1.1.0h/ssl/lib/engines-1.1"

三.重新编译nginx

查看nginx 中openssl 的版本

[root@bogon wwwroot]# /usr/local/nginx/sbin/nginx -V

nginx version: nginx/1.14.0

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

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf

/nginx.conf --modules-path=/usr/local/nginx/modules --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --user=www --group=www --http-client-body-temp-path=/usr/local/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_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_stub_status_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-mail=dynamic --with-stream=dynamic

重新编译nginx,并制定openssl 新版本的目录。重新编译nginx时,之前nginx 的配置参数要保证一样

[root@bogon nginx-1.14.0]# pwd

/usr/src/nginx-1.14.0

[root@bogon nginx-1.14.0]# ./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --modules-path=/usr/local/nginx/modules --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --user=www --group=www --http-client-body-temp-path=/usr/local/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi --with-http_ssl_module --with-openssl=/usr/local/openssl-1.1.0h/ssl --with-http_v2_module --with-http_realip_module --with-http_addition_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_stub_status_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-mail=dynamic --with-stream=dynamic

[root@bogon nginx-1.14.0]# echo $?

0

[root@bogon nginx-1.14.0]# make

make -f objs/Makefile

make[1]: Entering directory `/usr/src/nginx-1.14.0'

cd /usr/local/openssl-1.1.0h/ssl \

&& if [ -f Makefile ]; then make clean; fi \

&& ./config --prefix=/usr/local/openssl-1.1.0h/ssl/.openssl no-shared no

-threads  \   && make \

&& make install_sw LIBDIR=lib

/bin/sh: line 2: ./config: 没有那个文件或目录

make[1]: *** [/usr/local/openssl-1.1.0h/ssl/.openssl/include/openssl/ssl.h] 错误

 127make[1]: Leaving directory `/usr/src/nginx-1.14.0'

make: *** [build] 错误 2

[root@bogon nginx-1.14.0]# echo $?

2

 make 之后报错,解决方法如下:

修改nginx 源文件下的 /usr/src/nginx-1.14.0/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_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

[root@bogon
nginx-1.14.0]# ./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --modules-path=/usr/local/nginx/modules --error-log-path=/data/logs/nginx/error.log --http-log-path=/data/logs/nginx/access.log --user=www --group=www --http-client-body-temp-path=/usr/local/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi --with-http_ssl_module --with-openssl=/usr/local/openssl-1.1.0h/ssl --with-http_v2_module --with-http_realip_module --with-http_addition_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_stub_status_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-mail=dynamic --with-stream=dynamic

[root@bogon nginx-1.14.0]# echo $?

0

[root@bogon nginx-1.14.0]# make

[root@bogon nginx-1.14.0]# echo $?

0

注:此处千万不要 执行make install,否则会覆盖nginx 之前的配置文件

拷贝nginx的二进制目录到nginx的安装目录下

@ 可以先备份原来的二进制文件(/usr/local/sbin/nginx),然后在拷贝

[root@bogon vhost]# pkill nginx

[root@bogon vhost]# cp /usr/src/nginx-1.14.0/objs/nginx /usr/local/nginx/sbin/nginx

cp:是否覆盖"/usr/local/nginx/sbin/nginx"? y

# 重启nginx 查看nginx中的openssl 版本

[root@bogon nginx-1.14.0]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

[root@bogon vhost]# /usr/local/nginx/sbin/nginx -V

nginx version: nginx/1.14.0

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

built with OpenSSL 1.1.0h  27 Mar 2018

TLS SNI support enabled

 

至此,openssl 升级结束。在此过程中,遇到很多坑,以此文档帮助需要没事就升级openssl的小伙伴。

openssl 升级操作 -2的更多相关文章

  1. Openssl 升级操作

    转自:http://www.cnblogs.com/lzcys8868/p/9235538.html 首先我觉得没事就用绿盟扫漏洞的公司,就是闲的蛋疼,傻逼!不少服务器使用nginx,如果openss ...

  2. openssl 升级 操作 -1

    好多公司都会用绿盟扫描系统漏洞,里边就会涉及到ssl 漏洞,原因是openssl 版本低导致,会让你升级到指定版本.下面就介绍一下openssl 版本升级的操作方案. 一. 查看系统版本 [root@ ...

  3. openssl版本升级操作记录

    需要部署nginx的https环境,之前是yum安装的openssl,版本比较低,如下: [root@nginx ~]# yum install -y pcre pcre-devel openssl ...

  4. openssl版本升级操作记录【转】

    需要部署nginx的https环境,之前是yum安装的openssl,版本比较低,如下:   [root@nginx ~]# yum install -y pcre pcre-devel openss ...

  5. linux环境中,openssl升级及openresty中nginx基于新版本openssl重新编译

    需求说明: 最近在对系统进行安全扫描的时候,出现了openssl版本的问题,建议对openssl版本进行升级,在此记录下升级过程. 环境说明: 操作系统:RHEL 6.6 升级操作过程: 1.下载最新 ...

  6. CentOS6.5的openssl升级

    CentOS6.5的openssl升级:(修复心脏漏血漏洞) [root@linux1 ~]# rpm -qi openssl|grep VersionVersion : 1.0.1e Vendor: ...

  7. DS4700磁盘阵列的控制器微码升级操作记录(收录百度文库)

    DS4700磁盘阵列的控制器微码升级操作记录   项目介绍: 于10年3月,XX地市区/州XX分公司相继反映生产读取数据速度较之前变得非常慢,表现在:日常报表抽取数据速度明显变慢,客户打开前台页面速度 ...

  8. tomcat 8.0安装ssl证书,及centos7.2 的openssl升级到最新版本,及ERR_SSL_OBSOLETE_CIPHER错误解决

    openssl官网https://www.openssl.org/source/下载最新的文件 2017-Feb-16 12:03:39 openssl-1.1.0e.tar.gz 安装的时候,可能由 ...

  9. openssl升级并发症

    简单介绍一下系统环境: 操作系统:redhat6.3 ,安装的主要涉及到的包有: root@192.168.100.252:/root# rpm -qa | grep ssh openssh-.3p1 ...

随机推荐

  1. S3C6410+FPGA+2*RTL8211 驱动 iperf測试

    驱动也写的差点儿相同了,所以有必要測试下性能怎样?本次採用了iperf进行測试.而且对照了下s3c6410+ks8851的測试结果 1.iperf怎样交叉编译? https://iperf.fr/ 官 ...

  2. Django——20141014深入理解Django HttpRequest HttpResponse的类和实例

    深入理解Django HttpRequest HttpResponse的类和实例 了解META选项 了解中间件 理清所有模板传输模板变量的方式,并作出选择 Django模板系统:如何利用Django模 ...

  3. CSS/JavaScript hacks,browserhacks使用

    1.网址 http://browserhacks.com/ 2.使用 (1)JavaScript Hacks 浏览器js判断 (2)条件注释hack (3)Media Query Hacks 媒体查询 ...

  4. activiti入门3排他网关,并行网管,包括网关,事件网关

    网关用来控制流程的流向 网关能够消费也能够生成token. 网关显示成菱形图形,内部有有一个小图标. 图标表示网关的类型. 基本分支 首先 利用 流程变量  写个带有分支的一个基本流程 流程图: wa ...

  5. ios图片轮播效果

    代码地址如下:http://www.demodashi.com/demo/11959.html ImageCarousel 简单封装的图片轮播器 内存过大由于我加载的图片分辨率较高(4k) 文件目录 ...

  6. php如何通过get方法发送http请求,并且得到返回的参数

    向指定的url发送参数,这是一个跨域访问问题,具体事例如下:/test.php<?php$ch = curl_init(); $str ='http://127.0.0.1/form.php?i ...

  7. 【MyBatis学习09】高级映射之一对多查询

    上一篇博文总结了一下一对一的映射,本文主要总结一下一对多的映射,从上一篇文章中的映射关系图中可知,订单项和订单明细是一对多的关系,所以本文主要来查询订单表,然后关联订单明细表,这样就有一对多的问题出来 ...

  8. 8.1.2 绑定Activity和Service

    8.1.2 绑定Activity和Service 2010-06-21 16:57 李宁 中国水利水电出版社 字号:T | T <Android/OPhone开发完全讲义>第8章Andro ...

  9. rsync for windows 详细使用教程

    rsync for windows 详细使用教程内容简介:rsync在windows与windows服务器之间的同步设置 1.准备两台机器: server-----192.168.0.201 clie ...

  10. Ireport常用操作汇总

    1.四则运算 new java.lang.Double(($F{fincome}.doubleValue())/($F{fhomePopulation}.intValue()))