
最近银行的项目都需要升级ssl和ssh到最新版本。要注意顺序想升级ssl再升级ssh,因为升级ssh时需要用到ssl的库。而且升级时最好能接触到实体机或者安装telnet等其他的远程软件,以免安装失败后无法连接。升级后ssh可能会出现无法连接情况,升级xshell或SecureCRT到新版即可。
一、openssl升级到1.1.1f版。
1、安装依赖,同时上传软件包到服务器。
yum -y install perl-core libtemplate-perl zlib-devel gcc wget
2、下载openssl
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz
3、备份原openssl
mv /usr/bin/openssl /usr/bin/openssl.bak
4、解压
tar zxvf openssl-1.1.1f.tar.gz
5、进入文件夹
cd openssl-1.1.1f
6、配置
./config --prefix=/usr/local/ssl
7、编译安装
make&&make install
8、处理库文件
echo "/usr/local/ssl/lib">>/etc/ld.so.conf ldconfig -v
9、处理命令文件
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl
10、检查版本
openssl version
二、openssh升级到8.2p1
1、关闭Selinux
setenforce 0 sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
2、 卸载旧openssh
rpm -qa |grep openssh for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done
3、安装依赖关系
yum install -y gcc pam-devel rpm-build wget
4、 安装 openssh
wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
5、解压
tar -xvf openssh-8.2p1.tar.gz
进入安装文件
cd openssh-8.2p1
6、 设置、编译安装
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl/lib --without-hardening mv /etc/ssh /etc/ssh.old cp contrib/redhat/sshd.pam /etc/pam.d/sshd make && make install
7、复制启动脚本到/etc/init.d
cp contrib/redhat/sshd.init /etc/init.d/sshd chkconfig --add sshd chkconfig sshd on chkconfig --list|grep sshd sed -i "32a PermitRootLogin yes" /etc/ssh/sshd_config
8、重启ssh服务
service sshd restart
9、查看升级情况
ssh -V