网站优化推广费用,网站运营策划书,怎么做公众号,福州网站建设服务公司漏洞描述
OpenSSH#xff08;OpenBSD Secure Shell#xff09;是加拿大OpenBSD计划组的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现#xff0c;支持对所有的传输进行加密#xff0c;可有效阻止窃听、连接劫持以及其他网络级的攻击。OpenSSH 9.6之前…漏洞描述
OpenSSHOpenBSD Secure Shell是加拿大OpenBSD计划组的一套用于安全访问远程计算机的连接工具。该工具是SSH协议的开源实现支持对所有的传输进行加密可有效阻止窃听、连接劫持以及其他网络级的攻击。OpenSSH 9.6之前版本存在安全漏洞该漏洞源于存在操作系统命令注入漏洞。
CVE编号 CVE-2023-51385 CNNVD编号 CNNVD-202312-1665 解决方法升级openssh版本至9.6
操作步骤
1.查看当前服务器的openssh版本
ssh -V 2.openssh下载地址
Index of /pub/OpenBSD/OpenSSH/portable/ 3.对原来的openssh备份
1通过whereis ssh 找到openssh的文件 2备份ssh和sshd文件或目录
mv /etc/ssh /etc/ssh_old.bakmv /usr/bin/ssh /usr/bin/ssh_old.bakmv /usr/bin/ssh-keygen /usr/bin/ssh-keygen_old.bakmv /usr/sbin/sshd /usr/sbin/sshd_old.bakmv /etc/pam.d/sshd.pam /etc/pam.d/sshd.pam_old.bak
4.将openssh上传并解压
tar -zxvf openssh-9.6p1.tar.gz
5.卸载原有的openssh包
此命令会将找到的openssh相关的rpm包强制删除。
rpm -e --nodeps rpm -qa | grep openssh
6.编译安装openssh
1切换到解压后的openssh目录
cd openssh-9.6p1
2初始化openssh
./configure --prefix/usr/local/openssh9p6 --sysconfdir/etc/ssh --with-pam --with-zlib
大家可以通过命令查看初始化的参数信息 ./configure --help
若出现如下错误那我们就重新编译安装高一点版本的openssl
error: OpenSSL 1.1.1 required (have 100020bf (OpenSSL 1.0.2k-fips 26 Jan 2017))
重新下载一个openssl 我选择的是openssl1.1.1d版本 上传到服务器之后。
1编译安装openssl
这里是相当于重新安装的openssl单独给安装opensshs使用。
openssl下载地址/source/old/index.html tar -zxvf openssl-1.1.1d.tar.gz cd openssl-1.1.1d ./config --prefix/usr/local/openssl -d shared make make install 2)重新初始化openssh
切换到openssh这次我们在初始化的时候加上刚刚安装好openssl的目录。
./configure --prefix/usr/local/openssh9p6 --sysconfdir/etc/ssh --with-pam --with-ssl-dir/usr/local/openssl --with-zlib
如果安装单独的openssl之后,再执行初始化openssh命令报错 configure: error: OpenSSL headers,not found.那么openssl可能没安装成功参考如下博客重新安装openssl并更新到系统服务中【Linux】升级openssl版本-CSDN博客
(3)编译安装
make -j 4 make install
7.复制新的配置文件到原来目录
cp /usr/local/openssh9p6/sbin/sshd /usr/sbin/sshdcp /usr/local/openssh9p6/bin/ssh /usr/bin/sshcp /usr/local/openssh9p6/bin/ssh-keygen /usr/bin/ssh-keygencp -p contrib/redhat/sshd.init /etc/init.d/sshd 8.添加权限 chmod x /etc/init.d/sshd 9.修改sshd_config文件(一定
vim /etc/ssh/sshd_config
PermitRootLogin yes 、PubkeyAuthentication yes、PasswordAuthentication yes 将配置文件中这几个改为yes.
说明
PermitRootLogin yes允许root用户通过SSH登录到系统 PubkeyAuthentication yes启用公钥身份验证 PasswordAuthentication yes启用密码身份验证
10.开启开机自启sshd systemctl enable sshd
11.重启sshd systemctl restart sshd 11.验证是否成功
sshd -V