修复openssh低版本漏洞,将其升级到9.8版本
0.系统对应关系
openEuler22.03系统内核为Linux,大部分情况可以视为其对应的 CentOS 版本是 CentOS 7.9,因此 CentOS 7.9的解决方案基本适用于openEuler 22.03。
1.下载openssh-9.8p1-el7.tgz
这里是刺猬老师已经编译好的版本,自带所有相关依赖,感谢大佬刺猬老师的无私分享!
https://cikeblog.com/s/openssh-9.8p1-el7.tgz
2.解压tgz文件
将原始文件解压得到rpm软件
tar -xzf example.tgz
3.安装脚本
rpm -ivh --force --nodeps --replacepkgs --replacefiles openssh-*.rpm
4.启动openssh9.8
sudo systemctl start sshd
5.查看openssh版本是否为9.8
ssh -V
如果结果为OpenSSH_9.8p1,OpenSSL 1.1.1wa 代表正确。
6.将openssh9.8设为开机自启动
openssh作为高频使用的工具,为了便于使用,可以设置为开机自动启动。
sudo systemctl enable sshd
如果成功执行代表设置开机自启动成功,不过注意一般有时候会有一个提示:
sshd.service is not a native service, redirecting to systemd-sysv-install
Executing:/user/lib/systemd/systemd-sysv-install enable sshd
此时就输入提示的命令再次设置开机启动即可:
/user/lib/systemd/systemd-sysv-install enable sshd
7. 检查SSH开机启动是否设置成功
chkconfig --list sshd
如果执行结果为: sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off 代表开机启动是否设置成功,2、3、4、5是on状态即可。
如果结果一样,通过下面命令设置后即可变成开机启动:
chkconfig --level 2345 sshd on
参考链接:
https://cikeblog.com/upgrade-openssh-to-openssh-9-8p1-under-centos7.html