安装telnet
进行下面操作前,务必确保telnet服务安装成功。
安装xinetd
yum install xinetd -y
安装telnet服务,下载地址下载地址
rpm -ivh telnet-0.17-86.aarch64.rpm
rpm -ivh telnet-server-0.17-86.aarch64.rpm
重启
service xinetd restart
确保能够telnet登录需要升级ssh的服务器
升级ssl
下载
wget https://www.openssl.org/source/openssl-3.2.0.tar.gz
编译安装
tar -zxvf openssl-3.2.0.tar.gz
cd openssl-3.2.0
./config --prefix=/usr/local/openssl
make -j 16
make install
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl
使配置生效
打开文件,把“/usr/local/openssl/lib”加到文件最后。
vim /etc/ld.so.conf
sudo ldconfig -v
openssl version
安装ssh
yum安装编译依赖的组件
yum install -y rpm-build gcc gcc-c++ glibc glibc-devel openssl-devel openssl pcre-devel zlib zlib-devel make wget krb5-devel pam-devel libX11-devel libXt-devel initscripts libXt-devel gtk2-devel lrzsz
建立编译目录
mkdir -pv /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
源码包下载并修改,迁移到到/root/rpmbuild/SOURCES
wget http://mirror.aarnet.edu.au/pub/OpenBSD/OpenSSH/portable/openssh-9.5p1.tar.gz -O /home/openssh-9.5p1.tar.gz
cd /home && tar -xf openssh-9.5p1.tar.gz && cd openssh-9.5p1/contrib/redhat/
cp -p sshd.pam sshd.pam.old && cp -p sshd.init sshd.init.old
cd ../../..;mv openssh-9.5p1.tar.gz openssh-9.5p1_$(date "+%Y%m%d%H%M%S").tar.gz
tar -cf openssh-9.5p1.tar.gz openssh-9.5p1/
cp openssh-9.5p1.tar.gz /root/rpmbuild/SOURCES/openssh-9.5p1.tar.gz
解压spec编译文件
cd /root/rpmbuild/SOURCES/
tar -xf openssh-9.5p1.tar.gz openssh-9.5p1/contrib/redhat/openssh.spec
mv openssh-9.5p1 /root/rpmbuild/SPECS
不生成askpass包
cd /root/rpmbuild/SPECS/openssh-9.5p1/contrib/redhat/
sed -i -e "s/%global no_gnome_askpass 0/%global no_gnome_askpass 1/g" openssh.spec
sed -i -e "s/%global no_x11_askpass 0/%global no_x11_askpass 1/g" openssh.spec
解决openssl-devel < 1.1报错
sed -i '/openssl-devel < 1.1/s/^/#/' openssh.spec
编译openssh源码
rpmbuild -bb /root/rpmbuild/SPECS/openssh-9.5p1/contrib/redhat/openssh.spec
编译最后无报错即编译成功
查看编译的RPM文件
ll /root/rpmbuild/RPMS/aarch64
校验配置文件
sshd -t
校验配置文件,注释掉过期选项
vi /etc/ssh/sshd_config
授权文件
chmod 600 /etc/ssh/ssh_host_*
chown root:root /etc/ssh/ssh_host_*
升级
rpm -Uvh openssh-9.5p1-1.aarch64.rpm openssh-clients-9.5p1-1.aarch64.rpm openssh-server-9.5p1-1.aarch64.rpm
如果升级成功,无需以下操作
其它命令
重启
systemctl restart sshd
查看状态
systemctl status sshd.service
查看版本号
ssh -V
原文链接:https://blog.csdn.net/rzhidong/article/details/134512216