赞
踩
前言
整个过程不要断开ssh链接,如有必要可使用telnet远程操作。
系统版本:centos 7.9
OpenSSL版本:1.0.2k -> 1.1.1q
OpenSSH版本:7.4p1 -> 9.1p1
需要安装GCC
CentOS 7安装新版本的 OpenSSL_centos安装openssl_番茄炒蛋没有番茄的博客-CSDN博客
步骤
下载OpenSSL和openssh的源码包并解压。
OpenSSL官网地址: https://www.openssl.org/
OpenSSH官网地址:http://www.openssh.com/
wget https://www.zlib.net/zlib-1.2.13.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz
wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
tar xf openssl-1.1.1q.tar.gz
tar xf openssh-9.1p1.tar.gz
yum -y install zlib zlib-devel
yum -y install gcc
编译安装OpenSSL
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
cd openssl-1.1.1q
./config shared && make && make install
ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl/ /usr/include/openssl
echo "/usr/local/lib64" >> /etc/ld.so.conf
/sbin/ldconfig
openssl version
编译安装OpenSSH
mv /etc/ssh /etc/ssh.bak
cd openssh-9.1p1
mkdir /usr/local/openssh
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include --with-ssl-dir=/usr/local/lib64 --with-zlib --with-md5-passwords
make
make install
echo "UseDNS no" >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
echo "X11Forwarding yes" >> /etc/ssh/sshd_config
echo "X11UseLocalhost no" >> /etc/ssh/sshd_config
echo "XAuthLocation /usr/bin/xauth" >> /etc/ssh/sshd_config
mv /usr/sbin/sshd /usr/sbin/sshd0909
mv /usr/bin/ssh /usr/bin/ssh0909
mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen0909
ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh
ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
ln -s /usr/local/openssh/sbin/sshd /usr/sbin/sshd
ssh -V
mv /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.service.bak
cp -a ./contrib/redhat/sshd.init /etc/init.d/sshd
cp -a ./contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chkconfig --add sshd
systemctl enable sshd --now
systemctl restart sshd
测试ssh连接 完美升级 修补openSSH版本低的漏洞
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。