经过安全扫描,系统被发现了openssh漏洞,于是升级乎! 本教程历经生产所有服务器(基于centos7.x)进行操作,并完美运行! 升级的小伙伴请按照命令依次执行!
- 下载最新ssh包 https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/
- 下载依赖 pam 相关的 rpm ,此gcc包中基本涵盖了 https://share.ljserver.cn/file/soft/linux/gcc.zip
- 先不执行步骤2中下载的gcc,先解压openssh包
- 执行命令前,建议先开一个ssh窗口备用,或者是打开telnet连接(安装telnet),避免ssh升级失败导致无法连接ssh
- 执行命令
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening
make && make install
---
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key
chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key
---
vim /etc/ssh/sshd_config
PermitRootLogin yes
X11Forwarding yes
PasswordAuthentication yes
KexAlgorithms diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
---
cp ./contrib/redhat/sshd.init /etc/init.d/sshd
---
vim /etc/init.d/sshd
OPTIONS="-f /etc/ssh/sshd_config"
---
cd /usr/lib/systemd/system/
mkdir sh.bak
mv ssh* ./sh.bak
systemctl daemon-reload
---
systemctl restart sshd
service sshd status
|