升級OpenSSL和OpenSSH

本文在CentOS7.4環(huán)境下,使用源碼安裝方式升級OpenSSL和OpenSSH

安裝后查看版本效果

# openssl version

OpenSSL 1.1.1h  22 Sep 2020

# ssh -V

OpenSSH_8.4p1, OpenSSL 1.1.1h  22 Sep 2020

安裝需要注意的事情

  1. 在安裝時需要卸載OpenSSH,卸載后除當前打開窗口外,不在接受新的SSH連接。
  2. 可以安裝Telnet,通過Telnet代替SSH連接,直到升級完畢再關閉Telnet
  3. 從OpenSSH6.7開始默認關閉TCPwrappers支持,也就說當升級后/etc/hosts.allow和/etc/hosts.deny配置將失效,如果有限制IP需求可以在firewalld中配置
  4. 升級后SELINUX要永久關閉,否者會出現(xiàn)拒絕連接情況

下載源碼包

OpenSSL下載地址:https://www.openssl.org/source/
OpenSSH下載地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/

下載OpenSSL和OpenSSH

# wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
# wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz

查詢當前版本

# ssh -V

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017

卸載OpenSSL和OpenSSH

# yum remove openssl openssl-devel openssh -y

安裝OpenSSL

安裝依賴

# yum install gcc perl zlib zlib-devel -y

編譯OpenSSL

# tar -zxvf openssl-1.1.1h.tar.gz && cd openssl-1.1.1h
# ./config shared zlib --prefix=/usr/local/openssl --openssldir=/usr/local/openssl/ssl
# make && make install

配置OpenSSL

# echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
# ldconfig -v
# mv /usr/bin/openssl /usr/bin/openssl.old
# ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

查看版本

# openssl version

OpenSSL 1.1.1h  22 Sep 2020

安裝OpenSSH

安裝依賴

# yum -y install pam-devel

編譯OpenSSH

# tar -zxvf openssh-8.4p1.tar.gz && cd openssh-8.4p1
# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/openssl/include/ --with-ssl-dir=/usr/local/openssl --with-zlib --with-md5-passwords--with-pam
# make && make install

配置OpenSSH

# echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
# echo "UseDNS no" >> /etc/ssh/sshd_config
# cp -a contrib/redhat/sshd.init /etc/init.d/sshd
# chmod +x /etc/init.d/sshd
# chkconfig --add sshd
# systemctl enable sshd
# chkconfig sshd on
# chmod 600 /etc/ssh/ssh_host_rsa_key
# chmod 600 /etc/ssh/ssh_host_ecdsa_key
# /etc/init.d/sshd restart

查看版本

# ssh -V

OpenSSH_8.4p1, OpenSSL 1.1.1h  22 Sep 2020
最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容