CentOS6.5升级OpenSSH 8.3版本
OpenSSH 存在输入验证错误漏洞(CVE-2019-16905),需要对版本进行升级到8.3。
1、下载openssh8.3升级包及依赖的zlib和openssl。
openssh-8.3p1.tar.gz、zlib-1.2.11.tar.gz、openssl-1.1.1g.tar.gz
https://files-cdn.cnblogs.com/files/luckjinyan/zlib-1.2.11.tar.gz
https://files-cdn.cnblogs.com/files/luckjinyan/openssh-8.3p1.tar.gz
https://files-cdn.cnblogs.com/files/luckjinyan/openssl-1.1.1g.tar.gz
2、解压升级包
tar --no-same-owner -zxvf zlib-1.2.11.tar.gz tar --no-same-owner -zxvf openssh-8.3p1.tar.gz tar --no-same-owner -zxvf openssl-1.1.1g.tar.gz
3、编译安装zlib
cd zlib-1.2.11 ./configure --prefix=/usr/local/zlib make && make install
cd openssl-1.1.1g ./config --prefix=/usr/local/ssl -d shared make && make install echo '/usr/local/ssl/lib' >> /etc/ld.so.conf ldconfig -v
5、安装openssh
cd openssh-8.3p1 ./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl make && make install
6、sshd_config文件修改
echo 'PermitRootLogin yes' >>/usr/local/openssh/etc/sshd_config echo 'PubkeyAuthentication yes' >>/usr/local/openssh/etc/sshd_config echo 'PasswordAuthentication yes' >>/usr/local/openssh/etc/sshd_config
7、备份原有文件,并将新的配置复制到指定目录
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config mv /usr/sbin/sshd /usr/sbin/sshd.bak cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd mv /usr/bin/ssh /usr/bin/ssh.bak cp /usr/local/openssh/bin/ssh /usr/bin/ssh mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
8、启动sshd
service sshd restart
9、查看信息版本
ssh -V
10、升级完成后sftp登录后瞬间断开问题
修改/etc/ssh/sshd_config 文件中sftp路径,改为
Subsystem sftp /usr/libexec/sftp-server
有用请点推荐!