openssh版本升级centos7

openssh版本低漏洞

若是依赖 zlib、fips、openssl包与本文档版本一致则不需要更新,只需更新OpenSSH

  • OpenSSH 安全限制绕过漏洞(CVE-2016-10012)
  • OpenSSH J-PAKE授权问题漏洞(CVE-2010-4478)
  • OpenSSH auth_password函数拒绝服务漏洞(CVE-2016-6515)
  • OpenSSH 远程代码执行漏洞(CVE-2016-10009)
  • OpenSSH do_setup_env函数权限提升漏洞(CVE-2015-8325)
  • OpenSSH 安全漏洞(CVE-2016-1908)
  • OpenSSH 'schnorr.c’远程内存破坏漏洞(CVE-2014-1692)
  • Openssh MaxAuthTries限制绕过漏洞(CVE-2015-5600)
  • OpenSSH 'x11_open_helper()'函数安全限制绕过漏洞(CVE-2015-5352)
  • OpenSSH glob表达式拒绝服务漏洞(CVE-2010-4755)
  • OpenSSH默认服务器配置拒绝服务漏洞(CVE-2010-5107)
  • OpenSSH <=7.2p1 xauth命令注入漏洞(CVE-2016-3115)
  • OpenSSH 远程权限提升漏洞(CVE-2016-10010)
  • OpenSSH sshd mm_answer_pam_free_ctx释放后重利用漏洞(CVE-2015-6564)
  • Portable OpenSSH 'ssh-keysign’本地未授权访问漏洞
将系统版本openssh升级至较高版本、或最新
  • 查看当前openssh版本,并卸载
oh=`rpm -qa|grep openssh`
rpm -e --nodeps $oh
echo $oh
install  -v -m700 -d /var/lib/sshd
开始升级
pwd: /home/admin/openssl
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xf zlib-1.2.11.tar.gz
cd zlib-1.2.11 && ./configure && make && make install
  • 查看zlib版本
ll /usr/local/lib
libz.so.1.2.11
wget http://mirrors.ibiblio.org/openssl/source/old/fips/openssl-fips-2.0.12.tar.gz
tar -xf openssl-fips-2.0.12.tar.gz && cd openssl-fips-2.0.12 && ./config && make && make install 
wget http://mirrors.ibiblio.org/openssl/source/old/1.0.2/openssl-1.0.2i.tar.gz
tar -xf openssl-1.0.2i.tar.gz && cd openssl-1.0.2i && ./config && make && make install
cd /usr/local/ssl/bin && ln -sv /usr/local/ssl/bin/openssl /usr/bin/openssl (创建软连接前将当前的openssl备份)
openssl version -a(查看OpenSSL版本)
OpenSSL 1.0.2i22 Sep 2016
pwd:/home/admin/openssl
wget https://cloudflare.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
tar -xf openssh-8.2p1.tar.gz
cd openssh-8.2p1
./configure --prefix=/usr/  --sysconfdir=/etc/ssh --with-md5-passwords --with-privsep-path=/var/lib/sshd && make
make install   #执行可能能会提示WARNING: UNPROTECTED PRIVATE KEY FILE!原因是下面几个文件的权限问题
ll /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_ecdsa_key
chmod 600 /etc/ssh/ssh_host_ed25519_key
make install
install -v -m755    contrib/ssh-copy-id /usr/bin
install -v -m644    contrib/ssh-copy-id.1 /usr/share/man/man1 
install -v -m755 -d /home/admin/openssl/openssh-8.2p1
install -v -m644    INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-8.2p1    #可能会有警告,不过问题不大
  • 安装完成后备份sshd指令
mv /etc/init.d/sshd /etc/init.d/sshd20200506
  • 拷贝新的sshd
pwd:/home/admin/openssl/openssh-8.2p1/contrib/redhat
cp -p shd.init /etc/init.d/sshd
chmod u+x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
systemctl restart sshd
  • 拷贝备份文件(拷贝前将现有的配置文件备份)
pwd:/home/admin/openssl/openssh-8.2p1
cp ssh_config /etc/ssh/ssh_config
cp sshd_config /etc/ssh/sshd_config
  • 修改配置文件(如禁root、端口等)重启SSH服务,检测其ssh新版本
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
service sshd restart 或 systemctl restart sshd
ssh -V
OpenSSH_8.2p1, OpenSSL 1.0.2k-fips 11 Feb 2013
  • windows的cmd远程telnet,查看ssh版本是否后变化
telnet 192.168.0.1 22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值