将Openssh升级到8.0版本


修复说明:OpenSSH 7.7及之前版本中存在安全漏洞

OpenSSH(OpenBSD Secure Shell)是OpenBSD计划组所维护的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现,支持对所有的传输进行加密,可有效阻止窃听、连接劫持以及其他网络级的攻击。OpenSSH 7.7及之前版本中存在安全漏洞,该漏洞源于程序会对有效的和无效的身份验证请求发出不同的响应。攻击者可通过发送特制的请求利用该漏洞枚举用户名称。

 

1)安装telnet-server及xinetd

ll /etc/xinetd.d/telnet

cat /etc/securetty

echo '''pts/0

pts/1

pts/2

pts/3''' >> /etc/securetty

 

cat /etc/securetty

systemctl enable xinetd

systemctl enable telnet.socket

systemctl status telnet.socket

systemctl start telnet.socket

systemctl start xinetd

netstat -lntp|grep 23

systemctl status xinetd

systemctl restart telnet.socket

 

2)安装相关依赖包:

yum install  -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel  pam-devel

yum install  -y pam* zlib*

 

3)安装openssl-1.0.2r  下载链接: https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/

tar xfz openssl-1.0.2r.tar.gz

mv /usr/bin/openssl /usr/bin/openssl_bak

mv /usr/include/openssl /usr/include/openssl_bak

cd openssl-1.0.2r/

./config shared && make && make install

echo $?

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

ln -s /usr/local/ssl/include/openssl /usr/include/openssl

echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

/sbin/ldconfig

openssl version

 

4)安装openssh-8.0p1.tar.gz   下载链接:https://ftp.openssl.org/source/old/1.0.2/

tar -xzf openssh-8.0p1.tar.gz

cd openssh-8.0p1/

chown -R root.root ~/openssh-data/openssh-8.0p1

mv  /usr/lib/systemd/system/sshd.service  /app/

rm -rf /etc/ssh/*

./configure --prefix=/usr/ --sysconfdir=/etc/ssh  --with-openssl-includes=/usr/local/ssl/include --with-ssl-dir=/usr/local/ssl   --with-zlib   --with-md5-passwords   --with-pam  && make && make install

cp -a contrib/redhat/sshd.init /etc/init.d/sshd

cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

修改sshd服务配置:

vim /etc/ssh/sshd_config

chmod +x /etc/init.d/sshd

chkconfig --add sshd

systemctl enable sshd

systemctl status sshd

systemctl restart sshd

systemctl status sshd

systemctl stop sshd

systemctl status sshd

systemctl start  sshd

systemctl status sshd

systemctl enable sshd

ssh -V

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM