centos7 openssh安全漏洞解决:升级到OpenSSH_8.9p1
Openssh安全漏洞介绍
OpenSSH(OpenBSD Secure Shell)是OpenBSD计划组的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现,支持对所有的传输进行加密,可有效阻止窃听、连接劫持以及其他网络级的攻击。
OpenSSH 8.6p1及之前版本中的scp的scp.c文件存在命令注入漏洞。该漏洞源于外部输入数据构造可执行命令过程中,网络系统或产品未正确过滤其中的特殊元素。攻击者可利用该漏洞执行非法命令。
…
根据官方的解决方案,最好的解决办法是升级到最新稳定版本。
升级安装OpenSSH 8.9p1准备工作
安装telnet服务
1.telnet服务是用于防止openssh更新失败失去连接时的补救措施
# yum install xinetd -y
# yum install telnet telnet-server -y
2.编辑配置文件
# vim /etc/xinetd.d/telnet
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
3.启动telnet服务
# systemctl start xinetd
4.查看状态
# systemctl status xinetd
● xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
Active: active (running) since 日 2022-04-17 09:49:53 CST; 2min 0s ago
Process: 12624 ExecStart=/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid $EXTRAOPTIONS (code=exited, status=0/SUCCESS)
Main PID: 12625 (xinetd)
CGroup: /system.slice/xinetd.service
└─12625 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing discard
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing discard
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing echo
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing echo
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing tcpmux
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing time
4月 17 09:49:53 localhost.localdomain xinetd[12625]: removing time
4月 17 09:49:53 localhost.localdomain xinetd[12625]: xinetd Version 2.3.15 started with libwrap loadavg labeled-networking options compiled in.
4月 17 09:49:53 localhost.localdomain xinetd[12625]: Started working: 1 available service
4月 17 09:49:53 localhost.localdomain systemd[1]: Started Xinetd A Powerful Replacement For Inetd.
上面的状态可以看到服务默认就是开机自启动的状态
4.查看系统默认分配给telnet服务的端口号
# vim /etc/services
搜索telnet,可以看到如下:
ssh 22/tcp # The Secure Shell (SSH) Protocol
ssh 22/udp # The Secure Shell (SSH) Protocol
telnet 23/tcp
telnet 23/udp
5.确定telnet服务是23端口,查看telnet端口是否已存在:
# netstat -anp|grep 23
tcp6 0 0 :::23 :::* LISTEN 12625/xinetd
6.关闭防火墙并取消开机启动防火墙设置
# systemctl stop firewalld && systemctl disable firewalld
7.创建一个登陆帐号