在线升级openSSL3.0.5和openSSH9.0p1

1. 配置yum缓存保存缓存

vi /etc/yum.conf 

2. 清除yum缓存,并且设置保存缓存且自动建立依赖之间的索引

yum clean all && yum makecache

3. 安装 perl

   wget https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz
     tar -xzf perl-5.36.0.tar.gz
     cd perl-5.36.0
     ./Configure -des -Dprefix=$HOME/localperl
     make
     make test
     make install

4. 安装依赖

yum -C install distro-sync rpm-build zlib-devel openssl-devel gcc perl-devel pam-devel xmkmf libXt-devel gtk2-devel make

5. perl安装

5.1. perl 在线模式安装: IPC/Cmd.pm

yum install -y perl-CPAN

5.1.1 per 交互模式

perl -MCPAN -e shell
​
cpan[1]> install IPC/Cmd.pm

6. 安装 zlib

wget http://zlib.net/zlib-1.2.12.tar.gz
​
tar -xvf zlib-1.2.12.tar.gz
​
cd zlib-1.2.12  
​
./configure
​
 make && make install

6.openSSL 安装

wget --no-check-certificate https://www.openssl.org/source/openssl-3.0.5.tar.gz
​
tar -xvf openssl-3.0.5.tar.gz
​
cd openssl-3.0.5
​
./config -fPIC --openssldir=/etc/pki/tls --prefix=/etc/pki/tls shared  zlib
​
 make && make install

备份:

mv /usr/bin/openssl /usr/bin/openssl.bak

mv /usr/include/openssl /usr/include/openssl.bak

配置指向新版

ln -s /etc/pki/tls/bin/openssl /usr/bin/openssl

ln -s /etc/pki/tls/include/openssl /usr/include/openssl

配置库文件

ln -sf /etc/pki/tls/lib64/libssl.so.3 /usr/lib64/libssl.so.3

ln -sf /etc/pki/tls/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3

配置文件生效

echo "/etc/pki/tls/lib64" >> /etc/ld.so.conf

ldconfig -v

openssl 这里已经升级完成,通过openssl version -a 可以查看下当前openssl的版本信息:

7.openssh安装

wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
​
tar -zxvf openssh-9.0p1.tar.gz
​
cd openssh-9.0p1
​
mv /etc/ssh /etc/ssh.bak  //备份配置文件
​
./configure --prefix=/usr/local/openssh9.0 --sysconfdir=/etc/ssh/  --with-md5-passwords --mandir=/usr/share/man --with-zlib --with-pam  --with-ssl-dir=/etc/pki/tls/
​
 make && make install

安装完成后通过这个命令检测一下配置文件:

/usr/local/openssh9.0/sbin/sshd -t -f /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 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 'KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1' >> /etc/ssh/sshd_config

更新备份ssh相关执行脚本:

mv /usr/sbin/sshd /usr/sbin/sshd20220825.bak cp -rf /usr/local/openssh9.0/sbin/sshd /usr/sbin/sshd mv /usr/bin/ssh /usr/bin/ssh20220825.bak cp -rf /usr/local/openssh9.0/bin/ssh /usr/bin/ssh mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen2022-08-25.bak cp -rf /usr/local/openssh9.0/bin/ssh-keygen /usr/bin/ssh-keygen

更换sshd的启动脚本:

rm -rf /usr/lib/systemd/system/sshd.service

在解压的openssh安装包目录下执行:

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

最后再执行:

systemctl enable sshd.service systemctl daemon-reload systemctl restart sshd

参考博客:centos7的openssl和openssh升级到最新版本分别为3.0.5和9.0.p1_qq_28684191的博客-CSDN博客_openssh最新版本

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值