1、安装包准备

https://www.openssl.org/source/openssl-1.0.2q.tar.gz

ftp://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz

http://www.openssh.com/portable.html下可获取其他下载地址)

2、安装

安装前,centos7上ssh版本为OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017,在虚拟机中尝试,并做好快照

a)openssl安装

卸载旧的openssl

rpm -qa | grep -i openssl | xargs -I {} rpm -e --nodeps {}

安装

tar zxvf openssl-1.0.2q.tar.gz
cd openssl-1.0.2q

./config --prefix=/usr --shared

make

make install

添加软连接

ln -sf /usr/lib64/libcrypto.so.1.0.0 /usr/lib64/libcrypto.so.10
ln -sf /usr/lib64/libssl.so.1.0.0 /usr/lib64/libssl.so.10
ln -sf /usr/lib64/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.10
ln -sf /usr/lib64/libssl.so.1.0.0 /usr/lib/libssl.so.10

b)openssh安装

卸载旧的openssh安装包

rpm -qa | grep -i openssh | xargs -I {} rpm -e --nodeps {}

安装

tar zxvf openssh-7.9p1.tar.gz
cd openssh-7.9p1

./configure  --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/ssl --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers --without-hardening --without-openssl-header-check

make

提前变更文件权限,否则可能造成安装失败

chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_ecdsa_key
chmod 600 /etc/ssh/ssh_host_ed25519_key

make install

更新文件权限

install -v -m755 contrib/ssh-copy-id /usr/bin
install -v -m644 contrib/ssh-copy-id.1 /usr/share/man/man1 
install -v -m755 -d /usr/share/doc/openssh-7.9p1
install -v -m644 INSTALL LICENCE OVERVIEW README*
install -v -m644 INSTALL LICENCE OVERVIEW README* /usr/share/doc/openssh-7.9p1

添加sshd服务,并设置开机启动

cp -p contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chkconfig --list sshd

允许root登录

if [ `grep -c \"PermitRootLogin yes\" /etc/ssh/sshd_config` -eq \'0\' ]
then
        logging \"**************insert PermitRootLogin yes********************\"
        echo \"PermitRootLogin yes\" >> /etc/ssh/sshd_config
else
        logging \"**************update Ciphers data********************\"
        sed -i \'s/^#PermitRootLogin yes/PermitRootLogin yes/g\' /etc/ssh/sshd_config
fi

service sshd restart / systemctl restart sshd

3、检查

安装完后,ssh -V显示版本号已变更为OpenSSH_7.9p1, OpenSSL 1.0.2q  20 Nov 2018,升级成功

但是在执行psql、curl等命令时,虽然会正常执行,显示结果,但是总会出现一些警告

psql: /lib64/libssl.so.10: no version information available (required by psql)
psql: /lib64/libcrypto.so.10: no version information available (required by /usr/pgsql-9.4/lib/libpq.so.5)
psql: /lib64/libssl.so.10: no version information available (required by /usr/pgsql-9.4/lib/libpq.so.5)

curl: /lib64/libcrypto.so.10: no version information available (required by /lib64/libssh2.so.1)

……

导出查找资料,最后发现是postgresql和curl当前版本不完全支持OpenSSL 1.0.2q

当前postgresql是9.4.5,pg在9.4.12才支持OpenSSL 1.1.0,而OpenSSL 1.1.0与OpenSSL 1.0.2q是同时发布的,估计9.4.5版本在支持上有点问题

当前curl版本是7.29.0,网上看到有人发现curl-7.20.1是不能跟openssl-1.0.2e配合使用,curl目前的最新版是7.63.0,而OpenSSL 1.0.2q是当前OpenSSL 1.0.2系列最新版,所以猜测7.29.0版本的curl不完全支持OpenSSL 1.0.2q

4、测试

恢复快照,重新升级ssh,只升级ssh,升级完后,ssh -V版本号变为OpenSSH_7.9p1, OpenSSL 1.0.2k-fips  26 Jan 2017

执行psql、curl等也没有了警告信息,over!!!

收藏 打印