鉴于openssh升级太过麻烦,这里自制了一个openssh自动化升级脚本,以root权限一键运行脚本即可:
sh openssh-update.sh
注意:这里只使用于ubuntu系统,centos系统可以参考之前的文章。
#!/bin/bash
cd ~ && mkdir update && cd update
#官方地址如下:
#openssl
#官方下载地址: https://www.openssl.org/source/
#openssh
#官方下载地址:
#https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/
#zlib
#官方下载地址: http://www.zlib.net/
wget https://openssh-update.oss-cn-beijing.aliyuncs.com/zlib-1.2.13.tar.gz
wget https://openssh-update.oss-cn-beijing.aliyuncs.com/openssl-1.1.1q.tar.gz
wget https://openssh-update.oss-cn-beijing.aliyuncs.com/openssh-8.8p1.tar.gz
apt-get -y install gcc
apt-get -y install make
apt-get -y install libpam0g-dev
apt-get -y remove openssh-server openssh-client
tar -xzvf zlib-1.2.13.tar.gz
cd zlib-1.2.13
./configure --prefix=/usr/local/zlib && make && make install
cd ..;
tar -zxvf openssl-1.1.1q.tar.gz && cd openssl-1.1.1q
./config --prefix=/usr/local/ssl shared && make && make install
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf.d/openssl.conf
echo "/usr/lib" >> /etc/ld.so.conf.d/libc.conf
ldconfig -v
openssl version -a
cd ..
mv /etc/init.d/ssh /etc/init.d/ssh.old
cp -r /etc/ssh /etc/ssh.old
tar xf openssh-8.8p1.tar.gz
cd openssh-8.8p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl --with-privsep-path=/var/lib/sshd && make && make install
cd /etc/ssh
mv sshd_config sshd_config.default
cp ../ssh.old/sshd_config ./
mv /etc/init.d/ssh.old /etc/init.d/ssh
systemctl unmask ssh
systemctl restart sshd
systemctl status sshd
sshd -v
echo "安装完毕"
手机扫一扫
移动阅读更方便
你可能感兴趣的文章