文章声明

【Linux】 OpenSSH_9.3p1 升级到 OpenSSH_9.5p1(亲测无问题,建议收藏)-LMLPHP

漏洞描述

OpenSSH 命令注入漏洞(CVE-2020-15778) 详细描述:

OpenSSH 安全漏洞(CVE-2023-38408) 详细描述:

前述

注意事项:

此文升级是基于9.3p1升级9.5p1

备份openssh9.3p1的配置文件

[root@localhost ~]# mv /usr/sbin/sshd /usr/sbin/sshd-9.3p1
[root@localhost ~]# mv /usr/bin/ssh /usr/bin/ssh-9.3p1
[root@localhost ~]# mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen-9.3p1
[root@localhost ~]# mv /etc/init.d/sshd /etc/init.d/sshd-9.3p1
[root@localhost ~]# mv /etc/pam.d/sshd.pam /etc/pam.d/sshd.pam-9.3p1

下载 openssh9.5p1 的安装包:

OpenSSH官网:下载官网

或者是使用我提供的离线包:openssh7.4p1 升级到 openssh9.5p1 所需的离线包

网盘下载:
链接: https://pan.baidu.com/s/1HHzOCP3w0Rc8_sHotIzg7g?pwd=open
提取码:open

wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.5p1.tar.gz

解压并编译安装openssh9.5p1

# 将下载的openssh安装包移动到/usr/local下
[root@localhost ~]# mv openssh-9.5p1.tar.gz /usr/local/

# 进入/usr/local/目录解压openssh9.4
[root@localhost ~]# cd /usr/local/
[root@localhost local]# tar xf openssh-9.5p1.tar.gz

# 进入openssh目录
[root@localhost local]# cd openssh-9.5p1

# 编译安装
[root@localhost openssh-9.5p1]# CCFLAGS="-I/usr/local/include" \
LDFLAGS="-L/usr/local/lib64" \
./configure \
--sysconfdir=/etc/ssh \
--with-zlib \
--with-ssl-dir=/usr/local/openssl

[root@localhost openssh-9.5p1]# make -j 4
[root@localhost openssh-9.5p1]# make install

授权

[root@localhost openssh-9.5p1]# chmod 600 /etc/ssh/*

复制配置文件

[root@localhost openssh-9.5p1]# cp -rf /usr/local/sbin/sshd /usr/sbin/sshd
[root@localhost openssh-9.5p1]# cp -rf /usr/local/bin/ssh /usr/bin/ssh
[root@localhost openssh-9.5p1]# cp -rf /usr/local/bin/ssh-keygen /usr/bin/ssh-keygen
[root@localhost openssh-9.5p1]# cp -ar /usr/local/openssh-9.5p1/contrib/redhat/sshd.init /etc/init.d/sshd
[root@localhost openssh-9.5p1]# cp -ar /usr/local/openssh-9.5p1/contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

给sshd授予权限

 chmod 755 /etc/init.d/sshd

启用sshd,生成服务配置文件,并重启服务

# 启用sshd,生成服务配置文件
[root@localhost openssh-9.5p1]# systemctl enable sshd
sshd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sshd on

# 重启服务
[root@localhost openssh-9.5p1]# systemctl restart sshd
# 查看服务状态
[root@localhost openssh-9.5p1]# systemctl status sshd

验证升级是否成功

[root@localhost openssh-9.5p1]#  ssh -V
OpenSSH_9.5p1, OpenSSL 1.1.1t  7 Feb 2023

【Linux】 OpenSSH_9.3p1 升级到 OpenSSH_9.5p1(亲测无问题,建议收藏)-LMLPHP

相关文章

12-07 16:57