天天看點

更新OpenSSH版本

Openssl

tar -xzvf openssl-openssl-1.0.2l.tar.gz

cd openssl-1.0.2le

./config --prefix=/usr/local/openssl

./config –t

make depend

cd /usr/local

ln -s openssl ssl

/etc/ld.so.conf檔案的最後面,添加

/usr/local/openssl/lib

ldconfig

/etc/profile的最後一行,添加

export OPENSSL=/usr/local/openssl/bin

export PATH=$OPENSSL:$PATH:$HOME/bin

重新登入

[root@localhost local]# openssl version

OpenSSL 1.0.1e-fips 11 Feb 2013

Openssh

舊版本OpenSSH存在遠端通路執行漏洞,安裝Linux系統後需要更新OpenSSH來修複此漏洞,加強伺服器安全性。

注意:更新過程中不要重新開機sshd服務,否則隻有進機房了!!!

1、加載本地源

2、檢查相關包,確定已成功安裝

yum install bash -y

yum install -y zlib zlib-devel openssl openssl-devel

tar -zxvf openssh-7.5p1.tar.gz -C /usr/local/src/

cd /usr/local/src/openssh-7.5p1/

cp /etc/init.d/sshd /etc/init.d/sshd.bak

yum install gcc -y

3、解除安裝老版本

rpm -qa|grep ssh

rpm -e openssh-server-5.3p1-81.el6.x86_64

rpm -e openssh-clients-5.3p1-81.el6.x86_64 --nodeps

or yum remove openssh-clients

rpm -e openssh-askpass-5.3p1-81.el6.x86_64

rpm -e openssh-5.3p1-81.el6.x86_64

4、開始更新

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords

make && make install

mv /etc/init.d/sshd.bak /etc/init.d/sshd

mkdir -p /var/empty/sshd/etc

/etc/init.d/sshd restart

chkconfig --add sshd

chkconfig sshd on

chkconfig --list|grep sshd

5、檢查是否更新成功

[root@centos6 openssh-7.5p1]# ssh -V

OpenSSH_7.5p1, OpenSSL 1.0.1e-fips 11 Feb 2013

6、troubleshooting

登入提示:no maching outgoing encryption algorithm found

請更新高版本Xshell

編譯中出現如下提示:

configure: error: *** OpenSSL headers missing - pleaseinstall first or check config.log ***

請安裝這兩個包libssl-dev和openssl-devel

更新後預設不允許root登入,修改配置檔案sshd_config:

#PermitRootLogin prohibit-password

PermitRootLogin yes

附:Index of /pub/OpenBSD/OpenSSH/portable:

http://www.openssl.org/source/

https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/

繼續閱讀