rhel-server-6.6-x86_64 openssh源码升级

来源:互联网 发布:如何找到域名的ip地址 编辑:程序博客网 时间:2024/05/19 12:11

由于在OpenSSL1.0.1版本中存在严重漏洞(CVE-2014-0160)。要进行更新。
下面是我尝试了多个博客的方法后,找到的可行的rhel-server-6.6-x86_64 openssh升级方法,通过博客来记录并分享。
升级openssh之前要先升级openssl,zlib这里可升级可不升级。
下面升级openssh的时候会导致服务不可用,可以使用telnet暂时代替(请看博客telnet-server安装)

初始配置:

用以下命令查看rhel-server-6.6-x86_64 openssh初始配置

$ rpm -q zlibzlib-1.2.3-29.el6.x86_64$ openssl versionOpenSSL 1.0.1e-fips 11 Feb 2013$ ssh -VOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013

首先切换为root权限:

$ suPassword:

ssh程序升级:

备份启动脚本,以及ssh服务主配置目录

# cp /etc/init.d/sshd  /ssh5bak# cp /etc/ssh /ssh5bak

安装zlib

官网下载地址:http://www.zlib.net/
其实这里不升级zlib也可以。
准备好安装包,并进行安装,zlib-1.2.11.tar.gz

# tar --zxf zlib-1.2.11.tar.gz# cd zlib-1.2.11# ./config --shared# make && make install

安装openssl

openssl官网下载地址:https://www.openssl.org/source/
准备好安装包,并进行安装,openssl-1.0.2k.tar.gz

# tar -zxf openssl-1.0.2k.tar.gz# cd openssl-1.0.2k# ./config shared zlib# make# make install# mv /usr/bin/openssl /usr/bin/openssl.OFF# mv /usr/include/openssl /usr/include/openssl.OFF //此步骤可能提示无文件,忽略即可

移走原来系统自带的openssl,将自己编译产生的新文件进行链接:

# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl# ln -s /usr/local/ssl/include/openssl /usr/include/openssl

配置库文件搜索路径:

# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf# /sbin/ldconfig -v# openssl version -aOpenSSL 1.0.2k  26 Jan 2017built on: reproducible build, date unspecifiedplatform: linux-x86_64options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) compiler: gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASMOPENSSLDIR: "/usr/local/ssl"

openssl如上则更新完成

安装openssh

官网下载地址:http://openbsd.hk/pub/OpenBSD/OpenSSH/portable/
准备好安装包openssh-7.5p1.tar.gz

卸载原有openssh服务

# rpm -qa | grep openssh //查询系统原来安装的openssh包openssh-5.3p1-104.el6.x86_64openssh-server-5.3p1-104.el6.x86_64openssh-clients-5.3p1-104.el6.x86_64openssh-askpass-5.3p1-104.el6.x86_64# rpm -e --nodeps openssh-5.3p1-104.el6.x86_64 //卸载原有安装# rpm -e --nodeps openssh-server-5.3p1-104.el6.x86_64# rpm -e --nodeps openssh-clients-5.3p1-104.el6.x86_64# rpm -e --nodeps openssh-askpass-5.3p1-104.el6.x86_64

安装升级optenssh

# tar -zxf openssh-7.5p1.tar.gz# cd openssh-7.5p1# ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-zlib --with-ssl-dir=/usr/local/ssl  --with-md5-passwords --mandir=/usr/share/man# make# make install

启动服务

在openssh文件下:

# cp -p contrib/redhat/sshd.init /etc/init.d/sshd# chmod +x /etc/init.d/sshd# chkconfig --add sshd# cp sshd_config /etc/ssh/sshd_configcp: overwrite `/etc/ssh/sshd_config'? yes //如果提示覆盖,yes回车# cp sshd /usr/sbin/sshd cp: overwrite `/usr/sbin/sshd'? yes# cp -p ssh /usr/bin/sshcp: overwrite `/usr/bin/ssh'? yes

查看openssh版本,如下则安装完成:

# ssh -VOpenSSH_7.5p1, OpenSSL 1.0.2k  26 Jan 2017
原创粉丝点击