您的位置:首页 > 运维架构

openssh升级7.2p1过程

2017-01-09 17:01 387 查看
一、升级和卸载均需要使用root用户来执行(哪怕是考文件),以免在安装的过程中,出现权限的问题。

在升级openssh之前,要先安装telnet server,以解决在卸载了openssh之后,登录不上服务器。
安装telnet server之前,需要依赖xinetd,所以在安装telnet server 将 xinetd这个包安装上。
rpm -ivh xinetd-2.3.14-38.el6.x86_64.rpm
rpm -ivh telnet-server-0.17-47.el6_3.1.x86_64.rpm
两个包安装好后,修改配置文件
vi /etc/xinetd.d/telnet
将里面的 disable=yes 修改成no

关闭防火墙

service iptables stop
service xinetd start
对本机器的telent 服务搭建进行测试,如果测试通过,再卸载openssh.

二、安装

升级需要几个组件
yum install -y gcc openssl-devel pam-develrpm-build

现在新版本,目前是openssh-7.3最新,但刚刚出来,为保险,我选用7.2版本
wgethttp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.3p1.tar.gz
wgethttp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.2p1.tar.gz
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.1p1.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
准备相关的包
openssh下载地址:http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/
openssl相关包下载:http://www.openssl.org/source/
pam相关包下载:http://pkgs.org/centos-6/centos-x86_64/
zlib包下载: http://zlib.net/
1、升级zlib
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install

2、更新pam的rpm包。
不然configureopenssh的时候会报错
yum install pam-1.1.1-13.el6.x86_64.rpmpam-devel-1.1.1-13.el6.x86_64.rpm
注意:以下安装时,请务必再开一个SSH窗口连接所需要升级的服务器,避免ssh升级失败后,无法连接服务器。 3、编译安装openssl
tar zxvfopenssl-1.0.2h.tar.gz
cdopenssl-1.0.2h
./config--prefix=/usr/ --openssldir=/usr/ shared
make&& make install

====以下6行不操作,有些文章说明要做这些操作,但是我升级的时候没有这个。
mv/usr/bin/openssl /usr/bin/openssl.OFF
mv/usr/include/openssl /usr/include/openssl.OFF

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
#ldconfig –v

查看openssl版本。opensslversion显示OpenSSL 1.0.2h 3 May 2016。

4、编译安装openssh
tar zxvf openssh-7.2p1.tar.gz
cd openssh-7.2p1
./configure --with-zlib --with-ssl-dir --with-pam --bindir=/usr/bin--sbindir=/usr/sbin --sysconfdir=/etc/ssh

如果提示configure:error: PAM headers not found,可能是第2步没执行,需要安装pam-devel。

make && make install

完成后查看ssh版本。ssh -V查看

[root@localhost software]# ssh -V
OpenSSH_7.2p1, OpenSSL 1.0.2h 3 May 2016

5、重启ssh服务。
ssh -V
service sshd restart

[root@testserver2 tmp]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: /etc/ssh/sshd_config line 81: Unsupported optionGSSAPIAuthentication
/etc/ssh/sshd_config line 83: Unsupported optionGSSAPICleanupCredentials [ OK ]

解决:
将/etc/ssh/sshd_config文件中以上行数内容注释下即可
Sed -i '/^GSSAPICleanupCredentials/s/GSSAPICleanupCredentialsyes/#GSSAPICleanupCredentials yes/' /etc/ssh/sshd_config
sed -i '/^GSSAPIAuthentication/s/GSSAPIAuthenticationyes/#GSSAPIAuthentication yes/' /etc/ssh/sshd_config
sed -i '/^GSSAPIAuthentication/s/GSSAPIAuthenticationno/#GSSAPIAuthentication no/' /etc/ssh/sshd_config

更新后ssh有如下提示,但不影响使用:
[root@testserver2 tmp]# ssh 10.111.32.51
/etc/ssh/ssh_config line 50: Unsupported option"gssapiauthentication"

解决:
可以注释/etc/ssh/ssh_config的gssapiauthentication内容
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息