CentOS 5.X自帶的OpenSSH版本很低,還是4.3P2的,不支持SFTP Chroot功能,而且一些漏洞掃描工具會(huì )根據版本號報出openssh漏洞,加上之前的心髒出血漏洞,也有升級OpenSSL的需求。
因此,特總結了以下三種升級到新版本的方法:
實(shí)際操作中如果提前將自動(dòng)超時(shí)取消(執行 export TMOUT=0),並在未最終升級完openssh前不重啓ssh服務(wù),一般都不會(huì )斷開(kāi)遠程ssh連接。爲了升級安全,可先啓用telnet服務(wù),默認系統是沒(méi)有啓用這個(gè)服務(wù)的。
啓用Telnet遠程管理
- vi /etc/xinetd.d/krb5-telnet
# default: off
# description: The kerberized telnet server accepts normal telnet sessions, \
# but can also use Kerberos 5 authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/telnetd
log_on_failure += USERID
disable = no
}
重啓xinetd,開(kāi)啓Telnet服務(wù),如果沒(méi)有安裝xinetd的話(huà),需要先進(jìn)行安裝
- yum install xinetd
- yum install telnet-server
- service xinetd restart
- netstat -tnlp | grep :23
方法一:源碼包編譯安裝
- wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-6.9p1.tar.gz
- tar xvf openssh-6.9p1.tar.gz
- cd openssh-6.9p1
- ./configure --prefix=/usr --sysconfdir=/etc/ssh
- make
- make install
建議安裝還是換個(gè)路徑比較好,特別是線(xiàn)上服務(wù)器。下面給出的是官方給出的幾種方案,根據自己情況調整吧!
- To install OpenSSH with default options:
- ./configure
- make
- make install
- This will install the OpenSSH binaries in /usr/local/bin, configuration files
- in /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different
- installation prefix, use the --prefix option to configure:
- ./configure --prefix=/opt
- make
- make install
- Thsi will install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override
- specific paths, for example:
- ./configure --prefix=/opt --sysconfdir=/etc/ssh
- make
- make install
- This will install the binaries in /opt/{bin,lib,sbin}, but will place the
- configuration files in /etc/ssh.
方法二:編譯RPM包安裝
此安裝方法分兩步驟,首先要升級openssl新版本,然後才可以正常安裝openssh新版本,具體如下:- wget https://www.openssl.org/source/openssl-0.9.8zg.tar.gz
- cp openssl-0.9.8zg.tar.gz /usr/src/redhat/SOURCES/
- tar xvf openssl-0.9.8zg.tar.gz
- cp openssl-0.9.8zg/openssl.spec /usr/src/redhat/SPECS/
- rpmbuild /usr/src/redhat/SPECS/openssl.spec
- cd /usr/src/redhat/RPMS/i386/
- ls -l
- -rw-r--r-- 1 root root 1219140 06-24 11:22 openssl-0.9.8zg-1.i386.rpm
- -rw-r--r-- 1 root root 118129 06-24 11:22 openssl-debuginfo-0.9.8zg-1.i386.rpm
- -rw-r--r-- 1 root root 2187227 06-24 11:22 openssl-devel-0.9.8zg-1.i386.rpm
- -rw-r--r-- 1 root root 608743 06-24 11:22 openssl-doc-0.9.8zg-1.i386.rpm
在openssl.spec原文件的基礎上對應增加以下對操作版本判斷的語(yǔ)句,
- %ifarch i386 i486 i586 i686
- %attr(0755,root,root) /usr/lib/*.so*
- %attr(0755,root,root) /usr/lib/engines/*.so*
- %endif
- %ifarch x86_64
- %attr(0755,root,root) /usr/lib64/*.so*
- %attr(0755,root,root) /usr/lib64/engines/*.so*
- %endif
- ................
- %ifarch i386 i486 i586 i686
- %attr(0644,root,root) /usr/lib/*.a
- %attr(0644,root,root) /usr/lib/pkgconfig/
- %endif
- %ifarch x86_64
- %attr(0644,root,root) /usr/lib64/*.a
- %attr(0644,root,root) /usr/lib64/pkgconfig/
- %endif

openssl.spec

