1. 程式人生 > >centos5.5:升級openssl和openssh

centos5.5:升級openssl和openssh

1.檢視openssl和openssh版本

openssl version

OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

ssh -V

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

2.開啟telnet服務,以防萬一ssh連不上去,rpm包安裝telnet一下就行

rpm-ivh xinetd-2.3.14-10.el5.x86_64.rpm

rpm -ivh telnet-server-0.17-39.el5.x86_64.rpm

rpm -ivh telnet-0.17-39.el5.x86_64.rpm

也可以直接yum install telnet* 


3.修改設定檔案/etc/xinetd.d/telnet中disable欄位改為no

mv/etc/securetty /etc/securetty1
4.重啟服務#ntsysv或#servicexinetd restart

chkconfig xinetd on

telnet連線一下(電腦進入命令提示符介面,輸入:telnet x.x.x.x(x.x.x.x為伺服器ip))

安裝zlib

    檢查原來是否有zlib

    rpm –qa | grep zlib

    預設有安裝zlib

    如果沒有,rpm包安裝一下:

rpm-ivh zlib-1.2.3-3.x86_64.rpm

    rpm -ivh zlib-devel-1.2.3-3.x86_64.rpm

也可以直接yum install zlib*

安裝openssl

解除安裝老版的openssl:

rpm -qa | grep openssl

rpm -e --allmatches --nodeps`rpm -qa | grep openssl`

解壓新版的openssl:

tar –zxvf openssl-fips-2.0.16.tar.gz

cd openssl-fips-2.0.16

編譯:

./config

make

make install

解壓:

tar -zxvf openssl-1.0.2o.tar.gz

cd openssl-1.0.2o

編譯

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

make

make install

設定軟連結:

ln -s /usr/lib64/libssl.so.1.0.0/usr/lib64/libssl.so.6

ln -s /usr/lib64/libcrypto.so.1.0.0/usr/lib64/libcrypto.so.6

檢視openssl版本是否升級完畢

openssl version


升級openssh

1.  停止OpenSSH服務
service sshd stop

2. 備份當前openssh

mv /etc/ssh /etc/ssh.old
mv /etc/init.d/sshd /etc/init.d/sshd.old

3.檢視openssh

rpm -qa | grep openssh


4. 解除安裝openssh

rpm -e --noscripts `rpm -qa | grep openssh`

5. 解壓openssh安裝包

tar -xvf openssh-7.7p1.tar.gz

6. 安裝pam-devel安裝包,rpm–ivh pam-devel-0.99.6.2-6.el5_4.1.x86_64.rpm(不然config ssh時會報錯)

7. cd openssh-7.7p1

8. 執行:

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-tcp-wrappers --with-ssl-dir=/usr/ssl 

執行

make

make install

9.將sshd加入啟動服務,進入ssh安裝解壓目錄
cp ./contrib/redhat/sshd.init/etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig --add sshd

最後,啟動 SSH 服務使修改生效:
servicesshd start

重啟後確認一下當前的 OpenSSH 和OpenSSL 是否正確:

ssh –V


由於預設禁止root遠端登入,如果要允許的話,修改/etc/ssh/sshd_config下列引數:
#PermitRootLoginprohibit-password

PermitRootLogin yes

並重啟sshd

關閉telnet

修改設定檔案/etc/xinetd.d/telnet中disable欄位改為yes

mv/etc/securetty /etc/securetty2
啟動服務#ntsysv或#servicexinetd restart

至此,openssl以及openssh升級完畢