一、打开telnet
mv /etc/securetty /etc/securetty.bak
systemctl enable telnet.socket
systemctl start telnet.socket
systemctl status telnet.socket
systemctl enable xinetd.service
systemctl start xinetd.service
systemctl status xinetd.service
二、升级openssl
cd /opt/software/oepnssh8.4
tar -xf openssl-1.1.1h.tar.gz
tar -xf openssh-8.4p1.tar.gz
chown -R root.root openssh-8.4p1
cd /opt/software/openssh8.4/openssl-1.1.1h
./config -fPIC threads shared zlib
make
make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
cd /usr/local/bin
cp openssl /usr/local/ssl/bin/
cp /usr/local/ssl/bin/openssl /usr/local/bin
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
cp /opt/openssh8.4/openssl-1.1.1h/libcrypto.so.1.1 /usr/lib64/
cp /opt/openssh8.4/openssl-1.1.1h/libcrypto.so.1.1 /usr/local/lib64/
cp /opt/openssh8.4/openssl-1.1.1h/libcrypto.so.1.1 /usr/local/ssl/lib/
cp /opt/openssh8.4/openssl-1.1.1h/libssl.so.1.1 /usr/lib64/
cp /opt/openssh8.4/openssl-1.1.1h/libssl.so.1.1 /usr/local/lib64/
cp /opt/openssh8.4/openssl-1.1.1h/libssl.so.1.1 /usr/local/ssl/lib/
cd /usr/lib64/
rm -rf libcrypto.so
rm -rf libssl.so
ln -s libcrypto.so.1.1 libcrypto.so
ln -s libssl.so.1.1 libssl.so
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig
openssl version -a
三、升级openssh
cd /opt/software/openssh8.4/openssh-8.4p1
mv /etc/ssh /etc/ssh_bak
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man --with-pam --without-openssl-header-check
make
make install
cp -p contrib/redhat/sshd.init /etc/init.d/sshd
cp -p contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
cp -p contrib/redhat/sshd.init /usr/lib/systemd/system/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chkconfig --list sshd
cp -rf sshd_config /etc/ssh/sshd_config
cp sshd /usr/sbin/sshd
cp ssh-keygen /usr/bin/ssh-keygen
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
echo "UsePAM no" >> /etc/ssh/sshd_config
echo "Port 10022" >> /etc/ssh/sshd_config
systemctl restart sshd
systemctl status sshd
四、验证shell登录正常,关闭telnet
mv /etc/securetty.bak /etc/securetty
systemctl stop telnet.socket
systemctl stop xinetd.service