linux环境中,openssl升级及openresty中nginx基于新版本openssl重新编译
需求说明:
最近在对系统进行安全扫描的时候,出现了openssl版本的问题,建议对openssl版本进行升级,在此记录下升级过程。
环境说明:
操作系统:RHEL 6.6
升级操作过程:
1.下载最新版本openssl
下载地址:https://www.openssl.org/source/
下载1.0.2的分支版本
2.将压缩包上传到服务器上
3.查看当前openssl版本信息
[root@openssl ~]# openssl version -a
OpenSSL 1.0.1e-fips Feb
built on: Fri Aug :: EDT
platform: linux-x86_64
options: bn(,) md2(int) rc4(16x,int) des(idx,cisc,,int) idea(int) blowfish(idx)
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE= -fexceptions -fstack-protector --param=ssp-buffer-size= -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/etc/pki/tls"
engines: rdrand dynamic
4.解压,检查配置,安装
[root@openssl ~]# ls -l openssl-1.0.2s.tar.gz
-rw-r--r--. root root May : openssl-1.0.2s.tar.gz
[root@openssl ~]# tar -zxf openssl-1.0.2s.tar.gz
[root@openssl ~]# cd openssl-1.0.2s
[root@openssl openssl-1.0.2s]# ./config shared zlib-dynamic
[root@openssl openssl-1.0.2s]# make && make install
备注:新的openssl默认安装在/usr/local/ssl目录下
5.将原来openssl命令备份,重命名原来的openssl目录
[root@openssl openssl-1.0.2s]# mv /usr/bin/openssl /usr/bin/openssl.old
[root@openssl openssl-1.0.2s]# mv /usr/include/openssl /usr/include/openssl.old
6.基于新安装openssl建立命令,目录的软链接
[root@openssl openssl-1.0.2s]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
[root@openssl openssl-1.0.2s]# ln -s /usr/local/ssl/include/openssl /usr/include/openssl
7.修改系统自带的openssl库文件,软链接升级后的openssl库
[root@openssl openssl-1.0.2s]# mv /usr/lib64/libssl.so /usr/lib64/libssl.so.bak
[root@openssl openssl-1.0.2s]# ln -s /usr/local/ssl/lib/libssl.so /usr/lib64/libssl.so
8.查看openssl依赖的库的版本
[root@openssl openssl-1.0.2s]# strings /usr/lib64/libssl.so |grep OpenSSL
OpenSSLDie
SSLv3 part of OpenSSL 1.0.2s May
TLSv1 part of OpenSSL 1.0.2s May
DTLSv1 part of OpenSSL 1.0.2s May
OpenSSL 1.0.2s May
9.在/etc/ld.so.conf文件中写入openssl库文件的搜索路径,并使得修改生效
[root@openssl openssl-1.0.2s]# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
[root@openssl openssl-1.0.2s]# ldconfig -v
10.查看openssl版本
[root@openssl openssl-1.0.2s]# openssl version -a
OpenSSL 1.0.2s May
built on: reproducible build, date unspecified
platform: linux-x86_64
options: bn(,) rc4(16x,int) des(idx,cisc,,int) idea(int) blowfish(idx)
compiler: gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/local/ssl"
openssl版本升级成功。
升级openresty中openssl
1.查看当前openresty中nginx的编译信息
[root@openssl nginx]# sbin/nginx -V
nginx version: openresty/1.11.2.3
built by gcc 4.4. (Red Hat 4.4.-) (GCC)
built with OpenSSL 1.0.1e-fips Feb 2013 #openssl版本是之前的版本
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3. --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10. --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3. --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_ssl_module
2.重新对openresty进行编译
[root@openssl openresty-1.11.2.3]# ./configure --with-openssl=/usr/local/ssl/
编译时报错:
cd /root/openresty-1.11.2.3/build/nginx-1.11. && make
make[]: Entering directory `/root/openresty-1.11.2.3/build/nginx-1.11.'
make -f objs/Makefile
make[]: Entering directory `/root/openresty-1.11.2.3/build/nginx-1.11.'
cd /usr/local/ssl \
&& if [ -f Makefile ]; then make clean; fi \
&& ./config --prefix=/usr/local/ssl/.openssl no-shared \
&& make \
&& make install_sw LIBDIR=lib
/bin/sh: line : ./config: No such file or directory
make[]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error
make[]: Leaving directory `/root/openresty-1.11.2.3/build/nginx-1.11.'
make[]: *** [build] Error
make[]: Leaving directory `/root/openresty-1.11.2.3/build/nginx-1.11.'
make: *** [all] Error
解决该问题,修改配置文件/bundle/nginx-1.11.2/auto/lib/openssl/conf
[root@openssl openssl]# pwd
/root/openresty-1.11.2.3/bundle/nginx-1.11./auto/lib/openssl
[root@openssl openssl]# ls -l
total
-rw-rw-r--. Jul conf
-rw-rw-r--. Jul make
-rw-rw-r--. Jul makefile.bcc
-rw-rw-r--. Jul makefile.msvc
修改之后,如下(将/.openssl删除掉,也就是避免了找路径的时候找.openssl这个路径):
3.重新编译、安装
[root@openssl openresty-1.11.2.3]# make clean
rm -rf build
[root@openssl openresty-1.11.2.3]# ./configure --with-openssl=/usr/local/ssl/
[root@openssl openresty-1.11.2.3]# make && make install
4.查看编译后的nginx信息
[root@openssl nginx]# sbin/nginx -V
nginx version: openresty/1.11.2.3
built by gcc 4.4. (Red Hat 4.4.-) (GCC)
built with OpenSSL 1.0.2s May
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3. --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10. --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3. --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-openssl=/usr/local/ssl --with-http_ssl_module
openssl升级成功。
备注:如果在生产环境操作,必须在升级之前进行备份。
文档创建时间:2019年5月30日18:46:58
linux环境中,openssl升级及openresty中nginx基于新版本openssl重新编译的更多相关文章
- Linux环境PHP5.6升级7.1.8
PHP7和HHVM比较PHP7的在真实场景的性能确实已经和HHVM相当, 在一些场景甚至超过了HHVM.HHVM的运维复杂, 是多线程模型, 这就代表着如果一个线程导致crash了, 那么整个服务就挂 ...
- Django Linux环境下部署CentOS7+Python3+Django+uWSGI+Nginx(含Nginx返回400问题处理、防火墙管理)
本文将介绍如何在Linux系统上部署Django web项目,本次部署基于下面的架构: CentOS7+ Python3.5 + Django1.11 + uWSGI + Nginx 亲测可行!!按照 ...
- Linux环境下对大小写敏感,linux环境升级node
linux对大小写敏感 在window下可以正常运行的代码,在linux环境下报错,找不到文件,因为window下对大小写不敏感,linux对大小写敏感 linux环境下node升级 1.安装nvm ...
- OpenJDK 编译-Linux环境
说明:笔者是在Ubuntu 16.04虚拟机中编译 OpenJDK 8 源码下载 http://download.java.net/openjdk/jdk8/ 推荐直接下载openjdk-8-src- ...
- Linux04 /创建虚拟环境、在linux环境运行Python项目
Linux04 /创建虚拟环境.在linux环境运行Python项目 目录 Linux04 /创建虚拟环境.在linux环境运行Python项目 1. 大体流程 2. linux环境安装python3 ...
- 【转】linux /centos 中OpenSSL升级方法详解
相关软件下载地址 Apache:http://httpd.apache.org/ Nginx:http://nginx.org/en/download.html OpenSSL:http://www. ...
- 全世界最详细的图形化VMware中linux环境下oracle安装(二)【weber出品必属精品】
<ORACLE 10.2.05版本的升级补丁安装> 首先我们解压 $ unzip p8202632_10205_LINUX.zip 解压后我们会发现多出了个文件夹,他是:Disk1,进入D ...
- 全世界最详细的图形化VMware中linux环境下oracle安装(一)【weber出品必属精品】
安装流程:前期准备工作--->安装ORACLE软件--->安装升级补丁--->安装odbc创建数据库--->安装监听器--->安装EM <前期准备工作> 安装 ...
- Linux环境搭建-在虚拟机中安装Centos7.0
最近在空闲时间学习Linux环境中各种服务的安装与配置,都属于入门级别的,这里把所有的学习过程记录下来,和大家一起分享. 我的电脑系统是win7,所以我需要在win7上安装一个虚拟机-VMware,然 ...
随机推荐
- SHELL脚本编程-普通数组(列表)和关联数组(字典)
SHELL脚本编程-普通数组(列表)和关联数组(字典) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.数组相关概述 变量: 存储单个元素的内存空间 数组: 存储多个元素的连续的 ...
- 【后缀表达式求解】No.3.栈-evaluate-reverse-polish-notation题解(Java版)
牛客网的题目链接 题目描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid opera ...
- c++的boost库
c++ 的boost库的理解? 参考:http://zh.highscore.de/cpp/boost/introduction.html https://www.cnblogs.com/lidabo ...
- 项目Alpha冲刺 9
作业描述 课程: 软件工程1916|W(福州大学) 作业要求: 项目Alpha冲刺(团队) 团队名称: 火鸡堂 作业目标: 介绍第9天冲刺的项目进展.问题困难和心得体会 1.团队信息 队名:火鸡堂 队 ...
- B-树,B+树,B*树总结
链接地址:https://blog.csdn.net/v_JULY_v/article/details/6530142 B+树 B+ 树是一种树数据结构,是一个n叉树,每个节点通常有多个孩子,一棵B+ ...
- [Luogu 2386]放苹果
Description 题库链接 把 \(n\) 个同样的苹果放在 \(m\) 个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分发.多测,数据组数 \(t\). \(1\leq m,n\le ...
- 经肝药酶CYP3A4代谢的药物对比记录
罗非昔布 罗非昔布,解热镇痛抗炎药,选择性环氧化酶-2(COX-2)抑制药,有研究表明,该类药可增加心脏病发作.卒中或其他严重后果概率,不良反应为,增加心肌梗死和心脏猝死的风险,现已撤市.经肝和肠壁细 ...
- 洛谷 P2571 [SCOI2010]传送带 题解
每日一题 day51 打卡 Analysis 这道题是用非常恶心的三分套三分做的,有一个技巧是不要枚举坐标,枚举两条线段构成三角形的相似比就好了. 了解思路就还挺好写的(尽管我还调了三天) #incl ...
- WinDbg常用命令系列---显示当前异常处理程序链!exchain
!exchain 这个!exchain扩展命令显示当前异常处理程序链. !exchain [Options] 参数: Options下列值之一: /c 如果检测到异常,则显示与调试C++ try/c ...
- 虚拟机Linux系统ip查询失败问题
当用SSH连接Linux需要ip地址,但是不论是通过ipconfig命令,还是通过ip addr命令都无法获取Linux的ip,通过以下方法成功解决了该问题: 1.点击编辑里面的虚拟网络编辑器出现如下 ...