1. 什么是Openssl?

在计算机网络上,OpenSSL是一个开放源代码的软件库包,应用程序可以使用这个包来进行安全通信,避免窃听,同时确认另一端连线者的身份。这个包广泛被应用在互联网的网页服务器上。

其主要库是以C语言所写成,实现了基本的加密功能,实现了SSL与TLS协议。OpenSSL可以运行在OpenVMS、 Microsoft Windows以及绝大多数类Unix操作系统上(包括Solaris,Linux,Mac OS X与各种版本的开放源代码BSD操作系统)。

虽然此软件是开放源代码的,但其许可书条款与GPL有冲突之处,故GPL软件使用OpenSSL时(如Wget)必须对OpenSSL给予例外。

https://www.openssl.org/

2. 什么是心脏滴血?

心脏出血漏洞(英语:Heartbleed bug),简称为心血漏洞,是一个出现在加密程序库OpenSSL的安全漏洞,该程序库广泛用于实现互联网的传输层安全(TLS)协议。它于2012年被引入了OpenSSL中,2014年4月首次向公众披露。只要使用的是存在缺陷的OpenSSL实例,无论是服务器还是客户端,都可能因此而受到攻击。此问题的原因是在实现TLS的心跳扩展时没有对输入进行适当验证(缺少边界检查,因此漏洞的名称来源于“心跳”(heartbeat。该程序错误属于缓冲区过读,即可以读取的数据比应该允许读取的还多。

心脏出血在通用漏洞披露(CVE)系统中的编号为CVE-2014-0160。加拿大网络事故响应中心发布安全公告,提醒系统管理员注意漏洞。2014年4月7日,即漏洞公开披露的同一天,OpenSSL发布了修复后的版本。

截至2014年5月20日,在80万最热门的启用TLS的网站中,仍有1.5%易受心脏出血漏洞的攻击。

因为缺陷在于OpenSSL的实现,而不是SSL/TLS协议本身,所以除了OpenSSL之外的其他TLS实现方式,如GnuTLS、Mozilla的网络安全服务(NSS)和Windows平台的TLS实现都不受影响。

3. Nginx升级openssl

3.1 查看现openssl版本

# nginx -V
nginx version: nginx/1.22.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled

3.2 官方下载新的openssl安装包并解压

也可在GitHub上下载: https://github.com/openssl/openssl/releases

# wget https://www.openssl.org/source/openssl-3.0.8.tar.gz -P /opt/ --no-check-certificate
]# tar -xf openssl-3.0.8.tar.gz

3.3 重新编译Nginx

# ./configure  --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --with-openssl=/opt/openssl-3.0.8

3.4 编译时报错

# make
make -f objs/Makefile
make[1]: 进入目录“/usr/local/src/nginx-1.22.1”
cd /opt/openssl-3.0.8 \
&& if [ -f Makefile ]; then make clean; fi \
&& ./config --prefix=/opt/openssl-3.0.8/.openssl no-shared no-threads \
&& make \
&& make install_sw LIBDIR=lib
Can't locate IPC/Cmd.pm in @INC (@INC contains: /opt/openssl-3.0.8/util/perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /opt/openssl-3.0.8/external/perl/Text-Template-1.56/lib) at /opt/openssl-3.0.8/util/perl/OpenSSL/config.pm line 19.
BEGIN failed--compilation aborted at /opt/openssl-3.0.8/util/perl/OpenSSL/config.pm line 19.
Compilation failed in require at /opt/openssl-3.0.8/Configure line 23.
BEGIN failed--compilation aborted at /opt/openssl-3.0.8/Configure line 23.
make[1]: *** [/opt/openssl-3.0.8/.openssl/include/openssl/ssl.h] 错误 2

3.5 解决方法

yum install -y perl-CPAN
[root@haitang-nginx-test openssl-3.0.8]# perl -MCPAN -e shell CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead. Would you like to configure as much as possible automatically? [yes] yes <install_help> Warning: You do not have write permission for Perl library directories. To install modules, you need to configure a local Perl library directory or
escalate your privileges. CPAN can help you by bootstrapping the local::lib
module or by configuring itself to use 'sudo' (if available). You may also
resolve this problem manually if you need to customize your setup. What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')

3.6 安装缺省的包

cpan[1]> install IPC/Cmd.pm
..............................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Running install for module 'IPC::Cmd'
Running make for B/BI/BINGOS/IPC-Cmd-1.04.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/B/BI/BINGOS/IPC-Cmd-1.04.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/B/BI/BINGOS/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/B/BI/BINGOS/IPC-Cmd-1.04.tar.gz ok
Scanning cache /root/.cpan/build for sizes
DONE CPAN.pm: Building B/BI/BINGOS/IPC-Cmd-1.04.tar.gz Checking if your kit is complete...
Looks good
Warning: prerequisite Locale::Maketext::Simple 0 not found.
Warning: prerequisite Module::Load::Conditional 0.66 not found.
Warning: prerequisite Params::Check 0.20 not found.
Warning: prerequisite Test::More 0 not found.
Writing Makefile for IPC::Cmd
Could not read metadata file. Falling back to other methods to determine prerequisites
---- Unsatisfied dependencies detected during ----
---- BINGOS/IPC-Cmd-1.04.tar.gz ----
Test::More [requires]
Locale::Maketext::Simple [requires]
Module::Load::Conditional [requires]
Params::Check [requires]

3.7 安装完成继续执行编译操作。

# ./configure  --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --with-openssl=/opt/openssl-3.0.8
checking for OS
+ Linux 3.10.0-1062.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found

3.8 执行make && make install

# make && make install
cp objs/nginx '/apps/nginx/sbin/nginx'
test -d '/apps/nginx/conf' \
|| mkdir -p '/apps/nginx/conf'
cp conf/koi-win '/apps/nginx/conf'
cp conf/koi-utf '/apps/nginx/conf'
cp conf/win-utf '/apps/nginx/conf'
test -f '/apps/nginx/conf/mime.types' \
|| cp conf/mime.types '/apps/nginx/conf'
cp conf/mime.types '/apps/nginx/conf/mime.types.default'
test -f '/apps/nginx/conf/fastcgi_params' \
|| cp conf/fastcgi_params '/apps/nginx/conf'
cp conf/fastcgi_params \
'/apps/nginx/conf/fastcgi_params.default'
test -f '/apps/nginx/conf/fastcgi.conf' \
|| cp conf/fastcgi.conf '/apps/nginx/conf'
cp conf/fastcgi.conf '/apps/nginx/conf/fastcgi.conf.default'
test -f '/apps/nginx/conf/uwsgi_params' \
|| cp conf/uwsgi_params '/apps/nginx/conf'
cp conf/uwsgi_params \
'/apps/nginx/conf/uwsgi_params.default'
test -f '/apps/nginx/conf/scgi_params' \
|| cp conf/scgi_params '/apps/nginx/conf'
cp conf/scgi_params \
'/apps/nginx/conf/scgi_params.default'
test -f '/apps/nginx/conf/nginx.conf' \
|| cp conf/nginx.conf '/apps/nginx/conf/nginx.conf'
cp conf/nginx.conf '/apps/nginx/conf/nginx.conf.default'
test -d '/apps/nginx/logs' \
|| mkdir -p '/apps/nginx/logs'
test -d '/apps/nginx/logs' \
|| mkdir -p '/apps/nginx/logs'
test -d '/apps/nginx/html' \
|| cp -R html '/apps/nginx'
test -d '/apps/nginx/logs' \
|| mkdir -p '/apps/nginx/logs'
make[1]: 离开目录“/usr/local/src/nginx-1.22.1”

3.9 查看是否升级成功

# nginx -V
nginx version: nginx/1.22.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 3.0.8 7 Feb 2023
TLS SNI support enabled

Nginx如何升级Openssl的更多相关文章

  1. nginx之升级openssl及自定义nginx版本

    favicon.ico浏览器图标配置 favicon.ico 文件是浏览器收藏网址时显示的图标,当客户端使用浏览器问页面时,浏览器会自己主动发起请求获取页面的favicon.ico文件,但是当浏览器请 ...

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

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

  3. 升级openssl并重新编译Nginx

    在漏洞扫描的时候出现"启用TLS1.0"的安全漏洞,描述为:不被视为 PCI 数据安全标准,推荐使用TLS1.2及以上版本: 我这边服务器使用的是CentOS7,默认自带的open ...

  4. 让你的网站免费支持 HTTPS 及 Nginx 平滑升级

    为什么要使用 HTTPS ? 首先来说一下 HTTP 与 HTTPS 协议的区别吧,他们的根本区别就是 HTTPS 在 HTTP 协议的基础上加入了 SSL 层,在传输层对网络连接进行加密.简单点说在 ...

  5. 升级openssl

    升级openssl 依赖openssl的软件,如果是静态编译openssl,那么需要重新编译软件,如果是利用openssl的so动态库,那么只需要替换一下so文件并重启软件即可 openssh也依赖o ...

  6. nginx安装升级及配置详解

    1.简介 2.安装配置 3.配置文件介绍 4.启动.停止.平滑重启.升级 一.Nginx简介 Nginx(engine x)是俄罗斯人Igor Sysoev编写的一款高性能的http和反向代理服务器. ...

  7. nginx平滑升级实战

    Nginx 平滑升级 1.查看旧版Nginx的编译参数 [root@master ~]# /usr/local/nginx/sbin/nginx -V [root@master ~]# ll ngin ...

  8. 升级openssl环境至openssl-1.1.0c

    升级openssl环境至openssl-1.1.0c1.查看源版本 [root@zj ~]# openssl version -aOpenSSL 1.0.1e-fips 11 Feb 2013 2.下 ...

  9. centos 5.x 升级openssl

    今日想在centos 5.2上面安装mysql 5.5.37,在make的时候提示: Linking C shared module adt_null.so [ 65%] Built target a ...

  10. MacOS中升级openssl

    MacOS中升级openssl   ➜  ~ brew instal openssl 使用情况中始终发现,openssl并没有真正升级   在/usr/local/Cellar/openssl/目录中 ...

随机推荐

  1. pgsql给表字段设置默认值及设置主键

    ALTER TABLE pavement_damage_dtl_temp add PRIMARY key(id); ALTER table pavement_damage_dtl_temp alter ...

  2. 某个灰产远程调用的script源码

    访问一个老域名,可能是释放了被所灰产的的注册了,跳转简单扒下他们的源码. 主要是三段script代码,第一段是百度自动推送代码,第二段是站长统计代码,第三段则是远程调用断码. <html xml ...

  3. react ref用法更新

    react中ref的3种绑定方式 方式1: string类型绑定 类似于vue中的ref绑定方式,可以通过this.refs.绑定的ref的名字获取到节点dom 注意的是 这种方式已经不被最新版的re ...

  4. [iOS] 对 UItableView 等界面(ClipsToBounds) 同时使用 圆角和阴影

    展示内容的界面会被 ClipsToBounds = YES(按边缘剪切),但同时需要圆角和阴影效果. 一个界面,ClipsToBounds = YES 之后,阴影会被剪切,不再展示. 感觉只能使用多个 ...

  5. kvm介绍(1)

  6. java8中CompletableFuture异步处理超时

    java8中CompletableFuture异步处理超时的方法 Java 8 的 CompletableFuture 并没有 timeout 机制,虽然可以在 get 的时候指定 timeout,但 ...

  7. React Native面试知识点

    1.React Native相对于原生的ios和Android有哪些优势? 1.性能媲美原生APP 2.使用JavaScript编码,只要学习这一种语言 3.绝大部分代码安卓和IOS都能共用 4.组件 ...

  8. python + selenium 常用公共方法封装

    selenium 环境配置及浏览器驱动的安装:https://www.cnblogs.com/gancuimian/p/16435300.html uiautomator2 常用公共方法封装见之前的帖 ...

  9. kubectl工具安装指南

    kubectl是一个用于连接Service Mesh控制平面的工具,可以安装在办公电脑的Windows系统上,也可以安装在虚拟机的Linux系统上,只要网络能与控制平面的公网地址互通即可.下面分别介绍 ...

  10. unity game Developemnt in 24 hours 第1章 untiy

    屏幕有3个主要窗口 , Hierarchy.Project.Insepector ,个人理解Project是类定义,Hierarchy是创建类.实例化类,而Insepector是对类的属性进行管理