openssh升级的坑爹之路

安装Zlib

http://zlib.net/zlib-1.2.8.tar.gz

tar -zxvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure --shared

                       

make

 

make test

 

make install

 

三、安装OpenSSL

tar zxf openssl-1.0.2j.tar.gz

cd openssl-1.0.2j/

./config --prefix=/usr/  --shared(默认安装路径/usr/local/ssl)

make

make test

(确认编译是否有问题)

make install

vi /etc/ld.so.conf  在第一行加  /usr/local/ssl/lib

/usr/local/lib

之后ldconfig

让配置文件生效

 

最后查看当前openssl版本信息

openssl version -a

 

四、安装OpenSSH

tar zxf openssh-7.3p1-CVE-2016-8858.tar.gz

如为原版openssh-7.3p1包则添加下图代码,此包已经添加过。

cd openssh-7.3p1/

解压openssh源码包,修改源码包根目录中的kex.c文件

搜debug("SSH2_MSG_KEXINIT received"); 在这附近

加ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL);

./configure --prefix=/usr --sysconfdir=/etc/ssh --without-zlib-version-check --with-ssl-dir=/usr/ --with-pam --with-zlib --mandir=/usr/share/man --with-md5-passwords

 (标红的部分是openssh安装的文件目录,可以自定义)

make

(make之后没有报错)

make install

 

#分享下我做的过程
yum -y install zlib-devel*
yum -y install openssl-devel*
yum -y install perl* gcc* pam*


cd openssl-1.0.2l
./config --prefix=/usr --shared
make && make install


#将pam中的一个包拷出来,没有这个包ulimit会失效
cd /etc/pam.d/
cp sshd /root

rpm -e --nodeps `rpm -qa | grep openssh`
 ./configure --prefix=/usr --sysconfdir=/etc/ssh --without-zlib-version-check --with-ssl-dir=/usr/ --with-pam --with-zlib --mandir=/usr/share/man --with-md5-passwords
 cp ./contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig --add sshd

#改掉ssh配置文件中的权限 chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key service sshd restart ssh -V

 

posted @ 2017-07-31 11:16  sexiaoshuai  阅读(1007)  评论(0编辑  收藏  举报