本人纯linux小白,内网服务器被检测出漏洞需要升级openSSH 7.8p,自己网上一步步查询,断断续续搞了近两周干掉了四台虚拟机后终于成功了。
记录下心酸过程,因为是小白,会有好多白痴问题。
1、安装zlib
zlib-1.2.11.tar.gz
# tar xzvf zlib-1.2.11.tar.gz
#cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install
这样,就把 zlib 编译安装在/usr/local/zlib 中了
2、安装rpm包
# rpm -ivh pam-devel-1.1.1-13.el6.x86_64.rpm
# rpm -ivh zlib-devel-1.2.7-18.el7.x86_64.rpm
3、openssl-fips-2.0.16.tar.gz
# tar -xzvf openssl-fips-2.0.16.tar.gz
# cd openssl-fips-2.0.16
# ./config
# make
# make install
4. 安装OpenSSL
# tar zxpf openssl-1.0.1h.tar.gz
# cd openssl-1.0.1h
# ./config fips --shared
# make && make install
5. 将新编译的openssl library 加入系统动态库链接中
# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
# ldconfig
update :如果在第4步openssl 编译过程中,将其设定为OS默认安装目录(--prefix=/usr),那么此步骤无需执行!
6.安装OpenSSH
# tar -xvf openssh-7.8p1.tar.gz
# cd openssh-7.8p1
#./configure --prefix=/opt/openssh7.8p1 --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/ --without-hardening
# make && make install
# echo 'export PATH=/opt/openssh7.8p1/bin:/opt/openssh7.8p1/sbin:$PATH' >> /etc/profile.d/path.sh
# . /etc/profile.d/path.sh
安装过程可能会遇到N种错误
1.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Error loading host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
这里是说密钥文件权限不能为0640,0640权限太开放了,要求你的密钥文件不能被其它用户读取。
所以我们现在需要修改一下密钥文件权限。
在命令行输入chmod 700 parkcloud-new.pem即可。
这里“parkcloud-new.pem”就是warning里给出的密钥文件名,
所以你需要换成你的warning信息里给出的秘钥文件名。
chmod 700 /etc/ssh/ssh_host_ed25519_key
格式如下:chmod 权限码 密钥文件名