Centos下的Openssh漏洞修复(版本升级)

   近期对机房服务器做了一次安全漏洞扫描,漏扫结果显示服务器的OpenSSH版本太低,存在漏洞隐患,安全部门建议升级到最新版本。特别需要注意的是:如果是通过ssh远程连接服务器后进行的版本升级操作,如果升级失败,则ssh便无法远程登录。为了防止此现象的发生,建议先安装部署telnet服务。

漏洞描述:

OpenSSH(OpenBSD Secure Shell)是OpenBSD计划组所维护的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现,支持对所有的传输进行加密,可有效阻止窃听、连接劫持以及其他网络级的攻击。

OpenSSH 6.9及之前版本的sshd中的auth2-chall.c文件中的‘kbdint_next_device’函数存在安全漏洞,该漏洞源于程序没有正确限制处理单链接中的keyboard-interactive设备。远程攻击者可借助ssh -oKbdInteractiveDevices选项中较长且重复的列表利用该漏洞实施暴力破解攻击,或造成拒绝服务(CPU消耗)。

实验环境:

#查看selinux的状态,必须为关闭状态
[root@localhost ~]# getenforce 
Disabled
#查看防火墙的状态,必须为关闭状态
[root@localhost ~]# service iptables status
iptables: Firewall is not running.
#查看操作系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
#查看openssh版本
[root@localhost ~]# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

操作过程:

1.数据备份

[root@localhost ~]# cp -rf /etc/ssh/ /etc/ssh.bak

2.安装部署telnet服务

(1).安装telnet

[root@localhost ~]# yum install -y xinetd
[root@localhost ~]# yum install -y telnet
[root@localhost ~]# yum install -y telnet-server

(2).允许root用telnet登陆

默认情况下,linux不允许root用户以telnet方式登录linux主机

方法1:

#增加pts配置;如果登录用户较多,需要更多的pts/*
[root@localhost ~]# vim /etc/securetty
###################
在末尾添加:
pts/0
pts/1

方法2:

#验证规则设置在/etc/security文件中,该文件定义root用户只能在tty1-tty6的终端上记录,删除该文件或者将其改名即可避开验证规则实现root用户远程登录。
[root@localhost ~]# rm -rf /etc/securetty

(3).启动telnet服务

[root@localhost ~]# vim /etc/xinetd.d/telnet 
###################
disable  = no     #开启telnet服务功能,否则telnet启动后,23端口起不来

#开启xinetd
[root@localhost ~]# service xinetd start
Starting xinetd:                                           [  OK  ]
#查看端口
[root@localhost ~]# netstat -antp|grep 23
tcp        0      0 :::23                       :::*                        LISTEN      6133/xinetd 
#设定开机自启
[root@localhost ~]# chkconfig xinetd on

测试:

[root@localhost ~]# telnet 172.16.3.1

小贴士:

一般不建议直接用root用户远程通过telnet登陆系统,因为telnet在数据传输过程采用明文方式,如果数据包被人截获,将会很容易获取root用户的登陆口令;建议以普通用户通过telnet远程登陆,然后利用su切换到root,这样相对比较安全。如果非要用root用户远程连接,建议采用SSH.

3.升级openssh

安装包:  openssh-8.0p1.tar.gz 

(1).查看openssh的版本信息

[root@localhost ~]# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

(2).卸载旧版本openssh

[root@localhost ~]# rpm -aq openssh
openssh-5.3p1-123.el6_9.x86_64
[root@localhost ~]# rpm -e  `rpm -aq openssh` --nodeps

(3).安装新版本openssh

   1.在官网上下载8.0版本的openssh             点击此处即可下载

[root@localhost ~]# ls
openssh-8.0p1.tar.gz

   2.解压

[root@localhost ~]# tar zxf openssh-8.0p1.tar.gz 
[root@localhost ~]# ls
openssh-8.0p1  openssh-8.0p1.tar.gz

  3.configure配置

#安装依赖包
[root@localhost ~]# cd openssh-8.0p1
[root@localhost openssh-8.0p1]# yum install -y gcc zlib-devel openssl-devel
#configure配置
[root@localhost openssh-8.0p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh

  4.编译与安装

[root@localhost openssh-8.0p1]# make && make install

(4).更改配置文件

[root@localhost ~]# vim /etc/ssh/sshd_config 
###################
42 PermitRootLogin yes
48 PubkeyAuthentication yes
66 PasswordAuthentication yes

(5).开启sshd服务

#开启sshd服务
[root@localhost ~]# service sshd start
#设定开机自启
[root@localhost ~]# chkconfig sshd on

测试:

[root@localhost ~]# ssh -V
OpenSSH_8.0p1, OpenSSL 1.0.1e-fips 11 Feb 2013

 

  • 6
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值