【Linux】环境下OpenSSH升级到 OpenSSH |
您所在的位置:网站首页 › geforce9300ge升级 › 【Linux】环境下OpenSSH升级到 OpenSSH |
漏洞描述
OpenSSH(OpenBSD 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.bak mv /usr/bin/ssh /usr/bin/ssh_old.bak mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen_old.bak mv /usr/sbin/sshd /usr/sbin/sshd_old.bak mv /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/sshd cp /usr/local/openssh9p6/bin/ssh /usr/bin/ssh cp /usr/local/openssh9p6/bin/ssh-keygen /usr/bin/ssh-keygen cp -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.开启开机自启sshdsystemctl enable sshd 11.重启sshdsystemctl restart sshd 11.验证是否成功sshd -V
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |