0


CVE-2023-38408漏洞修复--openssh&openssl升级

一、CVE-2023-38408漏洞简单描述
    OpenSSH(OpenBSD Secure Shell)是加拿大OpenBSD计划组的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现,支持对所有的传输进行加密,可有效阻止窃听、连接劫持以及其他网络级的攻击。 OpenSSH 9.3p2之前版本存在安全漏洞,该漏洞源于ssh-agent的PKCS11功能存在安全问题。攻击者可利用该漏洞执行远程代码。
二、升级前准备
    a、****操作前多开一个窗口,并使用top命令挂起,最好是先安装一个telnet server,防止升级失败后无法连接服务器,就只能去机房了**
     b、openssh-9.3p2必须要openssl 1.0.1及以上
     c、升级ssh备份时同时备份   /etc/ssh  和  /usr/local/openssh 两个文件夹
     d、升级ssl备份时同时备份    /etc/ssl  和  /usr/local/openssl 两个文件夹
三、升级openssl
    1、备份:

            mv /etc/ssl /etc/ssl@20231124
             cp -r /usr/local/openssl /usr/local/openssl@20023124

    2、下载上传解压:

            下载地址:https://www.openssl.org/source/openssl-1.1.1u.tar.gz

            上传下载好的安装包至服务器并解压:tar -xzvf openssl-1.1.1u.tar.gz

    3、编译、安装:

            进入解压路径:cd openssl-1.1.1u

            编译安装:        ./config shared && make && make install

    4、查看版本:openssl version

    5、报错解决,执行openssl version报错处理:

            报错:openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

            执行下面命令解决:

            ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/
             ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/

    查看版本:openssl version
四、升级openssh
    1、备份:
             mv /etc/ssh /etc/ssh@20231124
             cp -r /usr/local/openssh /usr/local/openssh@20023124

    2、下载及上传安装包解压

            a、下载地址:

https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.3p2.tar.gz

            b、上传并解压:tar -xzvf openssh-9.3p2.tar.gz

    3、编译:

            a、进入解压目录:cd openssh-9.3p2

            b、编译:

./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/lib64/ --with-zlib --with-ssl-engine --with-selinux

    若编译报错:configure: error: SELinux support requires selinux.h header

    则使用如下命令编译:

./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/lib64/ --with-zlib --with-ssl-engine

    4、安装:make && make install

    查询版本:ssh -V

    5、常见报错及问题处理

            a、若编译报错提示:configure: error: Your OpenSSL headers do not match your  library. Check config.log for details.

            则在后面加上:--without-openssl-header-check

            b、若报错:checking OpenSSL library version... configure: error: OpenSSL >= 1.0.1 required (have "10000003 (OpenSSL 1.0.0-fips 29 Mar 2010)")

            则需升级ssl

            c、若ssh -V还是老版本号

            退出当前登录账号(命令:exit)或重新登陆后再查询即可:ssh -V
五、升级失败恢复方法
    **升级前一定要多开一个窗口并使用top命令挂起,防止升级失败后无法连接服务器,就只能去机房了(最好装一个telnet server备用)**

    ssh恢复:
     升级前一定要备份好下面两个文件夹
     /etc/ssh
     /usr/local/openssh
     升级失败后,上面两个备份文件恢复就行
     ssl恢复:同理
     /etc/ssl
     /usr/local/openssl

=========================================================================

相关命令:

    which ssh
     which openssl

           
标签: 网络 linux

本文转载自: https://blog.csdn.net/weixin_48493949/article/details/134737451
版权归原作者 哇卡哇卡aaa 所有, 如有侵权,请联系我们删除。

“CVE-2023-38408漏洞修复--openssh&openssl升级”的评论:

还没有评论