Centos7升级openssl及openssh

Centos7升级openssl及openssh

一、查看原始版本

以下操作均使用root用户操作

[root@localhost src]# openssl version 
OpenSSL 1.0.2k-fips  26 Jan 2017

[root@localhost src]# ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017

二、安装相关依赖包

yum install  -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel  pam-devel zlib-devel

三、安装telnet-server

查看有没有安装telnet-server

[root@localhost src]# rpm -qa|egrep 'xinetd|telnet'
telnet-0.17-65.el7_8.x86_64

使用yum进行安装

##若不能连接外网可以从其他机器下载安装包然后拷贝过去
yum -y install xinetd telnet-server telnet

加入开机自启(非必须)

systemctl enable telnet.socket
systemctl enable  xinetd
systemctl status  xinetd

启动服务并查看端口是否启动

systemctl start xinetd
systemctl start telnet.socket 

#查看23端口是否监听
netstat -apn | grep -w 23

把23端口加入防火墙白名单

firewall-cmd --permanent --add-port=23/tcp
firewall-cmd --reload

修改/etc/securetty

echo 'pts/0' >> /etc/securetty
echo 'pts/1' >> /etc/securetty

在其他主机验证是否能通过telnet登录到该服务器,步骤略。

四、升级openssl

准备好两个安装包

[root@localhost src]# pwd
/usr/local/src

[root@localhost src]# ll|grep open
-rw-r--r--. 1 root root  1706358 99 10:31 openssh-8.3p1.tar.gz
-rw-r--r--. 1 root root  5287321 99 16:02 openssl-1.1.0k.tar.gz

安装步骤

mv /usr/bin/openssl /usr/bin/openssl_bak`date +%Y%m%d`
mv /usr/include/openssl /usr/include/openssl_bak`date +%Y%m%d`
cd /usr/local/src/
tar -zxf openssl-1.1.0k.tar.gz 
cd openssl-1.1.0e/
./config --prefix=/usr --shared
make && make install
 ll /usr/include/openssl /usr/bin/openssl
#查看升级后的版本
openssl version -a

五、升级openssh

安装步骤

mv /etc/ssh /etc/ssh_bak`date +%Y%m%d`
cd /usr/local/src/
tar -zxf openssh-8.3p1.tar.gz 
cd openssh-8.3p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-ssl --with-md5-passwords --mandir=/usr/share/man && make && make install
echo 'PermitRootLogin no' >> /etc/ssh/sshd_config
\cp -a contrib/redhat/sshd.init /etc/init.d/sshd
\cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
chmod +x /etc/init.d/sshd
chkconfig --add sshd
systemctl enable sshd

##把原先的systemd管理的sshd文件删除或者移走,不移走的话影响我们重启sshd服务
rm -f /usr/lib/systemd/system/sshd.service 

#启动文件列表reload
systemctl daemon-reload

#启动sshd服务
systemctl restart sshd

##查看是否监听22端口
netstat -apn|grep ssh

##查看版本
ssh -V


**升级完成!**
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值