首页 > 编程知识 正文

升级openssh到最新版本,windows升级openssl版本

时间:2023-05-06 06:56:35 阅读:128828 作者:4808

相关软件下载地址Apache: http://httpd.apache.org/

nginx:http://nginx.org/en/download.html

OpenSSL: http://www.openssl.org/

openssl-poc

附件说明PoC.py :漏洞利用测试PoC脚本

showssl.pl:OpenSSL动态库版本检测脚本

OpenSSL安装说明

由于操作环境不同,以下流程仅供参考。 openssl是一个系统APP应用程序,依赖于许多APP应用程序,由于环境差异等因素,请先在测试环境中进行充分的测试。

从官方下载最新版本的opensssl库

wget 3359 www.OpenSSL.org/source/OpenSSL-1.0.1 g.tar.gz

解压缩下载的openssl压缩包

tar -zxvf openssl-1.0.1g.tar.gz

进入解压缩后的openssl文件夹

cd openssl-1.0.1g

可执行文件夹中的config文件。 其中,openssl的安装目录默认为/usr/local/ssl。 (因为路径可能因系统环境而异,下同) )请注意添加zlib-dynamic参数并将其编译到动态库中

代码如下

复制代码

./config shared zlib -动态

config完成后运行make命令

化妆

运行make命令后,运行make install命令以安装openssl

制造安装

重命名原始openssl命令

mv/usr/gld yg/OpenSSL/usr/gld yg/OpenSSL.old

重命名原始openssl目录

mv/usr/include/OpenSSL/usr/include/OpenSSL.old

将已安装的OpenSSL OpenSSL命令软连接到/usr/gldyg/openssl

ln-s/usr/local/SSL/gld yg/OpenSSL/usr/gld yg/OpenSSL

将安装的openssl的openssl目录软连接到/usr/include/openssl

ln-s/usr/local/SSL/include/OpenSSL/usr/include/OpenSSL

修改系统附带的openssl库文件,例如/usr/local/lib64/libssl.so (根据计算机环境而定)软链升级后的libssl.so

ln-s/usr/local/SSL/lib/libssl.so/usr/local/lib 64/libssl.so

运行命令以确定openssl从属库的版本是否为1.0.1g。

strings/usr/local/lib 64/libssl.so|grep OpenSSL

将openssl库文件的搜索路径写入/etc/ld.so.conf文件

echo '/usr/local/SSL/lib '/etc/LD.so.conf

启用修改后的/etc/ld.so.conf

ldconfig -v

确定当前openssl的版本是否是升级的版本

OpenSSL版本

更新web服务器上的OpenSSL依赖关系库

如果webserver在安装编译时加载了openssl,则还需要重新启动或重新编译webserver。 web服务器的安装有动态编译和静态编译openssl两种方式,因此具体的操作方法也不同。

确定webserver是否动态编译ssl的两种方法

使用ldd命令显示从属库

ldd查看器依赖于库,如果有libssl.so,则动态编译ssl,反之则为静态。 下图:

查看编译参数

如果在命令/usr/sgldyg/nginx -V中输入验证nginx编译参数,则该参数将动态编译ssl (如果不存在),反之亦然。

更新Openssl库a (如果webserver是通过动态编译安装SSL的,则直接重新启动相应的webserver服务,如apache和nginx )即可。

b )如果webserver是静态编译和安装ssl的,则可以使用以下方法更新:

如果apache静态编译ssl :

在apache中重新安装源代码,并使用ssl静态编译:

运行apache配置文件时,除了业务所需的参数外,还必须将ssl指定为静态编译

代码如下

复制代码

./configure---enable-SSL=static-- with-SSL=/usr/local/SSL

(openssl安装路径)

安装apache

代码如下

复制代码

制造制造安装

恢复原始apache配置,然后重新启动服务即可

如果nginx静态编译ssl :

在nginx上重新安装源代码,并使用ssl静态编译:

运行nginx配置文件时,除了业务所需的参数外,还必须将ssl指定为静态编译。 如果将编译参数标记为--with-openssl,则显示为静态编译ssl

代码如下

复制代码

./configure-- with-http _ SSL _ module-- with-OpenSSL=/usr/local/SSL

(openssl安装路径)

安装nginx

代码如下

复制代码

制造制造安装

恢复原始nginx配置并重新启动服务即可

如果要使用其他openssl,请参阅apache和nginx解决方案。

测试是否存在漏洞

使用附件PoC.py根据脚本提示检测漏洞。

例如:

https://192.168.0.1测试漏洞中是否存在执行命令

代码如下

复制代码

python POC.py-p443,8443192.168.0.1

检测动态库libssl.so的版本

检测当前进程使用的libssl.so版本

运行附件showssl.pl检查脚本,无信息输出或无漏洞版本的openssl输出表示升级成功; 如果输出中有unknown,请检查业务中libssl.so.1.0.0的版本是否受影响。

(详情见附件)

代码如下

复制代码

#! /usr/gldyg/perl -w

my @ listinfo=` lsof ' grep libssl ' awk ' { print $1' ' $2' $ nf } ' '|sort-u `;

foreachmy$info(@listinfo ) ) ) ) ) ) ) ) ) ) )。

{

my($procname,$procPid,$libPath )=split )/s/,$info );

next if (! efined($procname ) |! efined($procpid ) |! efined($libpath );

my $ version=` strings $ libpath|grep-e ' ^ OpenSSL [0-9].[0-9] ' `;

chomp $version;

(if ($ version=~~/s * openssls *1.0.1[ a-f ] { 0,2 }/() ) ) ) ) ) ) ) ) )

{

print'$procname($procPID ) :$libpath ) $version ).n );

}

}

检测系统中使用的libssl.so版本

执行命令:

代码如下

复制代码

strings/usr/local/lib 64/libssl.so|grep OpenSSL

确定openssl从属库的版本是否为1.0.1g

注意:/usr/local/lib64/libssl.so的路径仅供参考,由具体的计算机环境决定,并参考升级说明

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。