centos7.9升级openssh到9.8p1

[root@localhost ~]# cat openssh-update.sh
##!/bin/bash
mkdir /software && cd /software
wget --no-check-certificate https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
#升级openssl
yum install -y gcc gcc-c++ glibc make automake autoconf zlib zlib-devel
tar xf openssl-1.1.1w.tar.gz && cd openssl-1.1.1w/
./config shared zlib -fPIC --prefix=/usr/local/openssl && make -j 4 && make install
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
echo '/usr/local/openssl/lib' > /etc/ld.so.conf.d/openssl-x86_64.conf && ldconfig -v && openssl version

#安装Telnet防止升崩了无法登陆
yum install telnet-server telnet xinetd -y
systemctl enable xinetd.service
systemctl enable telnet.socket
systemctl start telnet.socket
systemctl start xinetd
useradd appadmin
echo 123456 | passwd --stdin appadmin
vi /etc/pam.d/remote #注释auth required pam_securetty.so
systemctl restart xinetd
systemctl restart telnet.socket
#升级openssh
cd /software
wget --no-check-certificate https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
systemctl stop sshd
mv /etc/ssh /etc/ssh.bak
mv /usr/sbin/sshd /usr/sbin/sshd.bak
mv /usr/bin/ssh /usr/bin/ssh.bak
yum remove openssh -y
yum install -y pcre-devel perl perl-Test-Simple
tar -zxf openssh-9.8p1.tar.gz && cd openssh-9.8p1/ && ./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --with-zlib
make -j 4 && make install
rm -f /usr/lib/systemd/system/ssh* && cp contrib/redhat/sshd.init /etc/init.d/sshd
mkdir /etc/ssh
sed -i 's@\#PermitRootLogin@PermitRootLogin@g' /usr/local/openssh/etc/sshd_config
sed -i 's@\#PubkeyAuthentication@PubkeyAuthentication@g' /usr/local/openssh/etc/sshd_config
cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp /usr/local/openssh/bin/ssh /usr/bin/ssh
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
systemctl daemon-reload
systemctl start sshd && systemctl enable sshd
ssh -V

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值