升级openssh【linux平台】
建议在第一步配置telnet之前,首先配置yum,用于安装可能需要的package
■■挂载OS的iso镜像
mount -o loop/u01/soft/os/rhel-server-6.4-x86_64-dvd.iso /u01/soft/os/iso
■■config yum - local
适用于redhat6:如redhat6.6,centos6.5
■屏蔽默认配置目录/etc/yum.repos.d
mv /etc/yum.repos.d /etc/yum.repos.d.old
■修改/etc/yum.conf,添加文件位置,并启用enabled=1
[server]
name=server
baseurl=file:///u01/soft/os
enabled=yes
gpgcheck=no
■配置httpd服务,用以配置http方式的yum源
将document配置到iso所挂载的位置
■■config yum - http
■屏蔽默认配置目录/etc/yum.repos.d
mv /etc/yum.repos.d /etc/yum.repos.d.old
■修改/etc/yum.conf
[os]
name=Red Hat Enterprise Linux
#sxyd-wxwy
baseurl = http://10.231.129.23
#hbyd-zhzy
#baseurl = http://10.216.6.138/os
gpgcheck=0
gpgkey = http://10.231.129.23/repodata/repomd.xml
一、■■配置telnet服务、gcc编译器
目的:便于远程操作、配置新版本的openssh,同时确保不会因为升级SSH失误导致无法远程登陆主机
■确认telnet服务是否已经安装
yum info telnet*
■如果没有安装telnet-server
yum install telnet-server
■安装telnet server后,修改/etc/xinetd.d/telnet的disable一行为no
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server =/usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
■安装telnet server后,改名/etc/securetty文件
mv /etc/securetty /etc/securetty.old
■启动xinetd服务,即同时启动了telnet服务
service xinetd start
■此时测试能否远程telnet登陆服务器,确认telnet服务生效后,就可以进行下一步
■升级openssh需gcc编译器,确认是否安装
yum info gcc
如没有安装,则安装:
yum install gcc
二、■■升级Zlib
www.zlib.net
下载最新的源码【已下载】
tar xvfz zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/zlib
make
make install
三、■■升级openssl
【升级openssl会导致yum、python等一系列依赖问题,因此暂时不升级openssl,只升级openssh到7.2版本】
www.openssl.org
下载最新的源码【已下载】
■卸载已有的openssl
rpm -e `rpm -qa | grep openssl`--allmatches --nodeps
■重新配置编译openssl到系统默认目录
tar xvfz openssl-1.1.0f.tar.gz
cd openssl-1.1.0f
./config --prefix=/usr --shared zlib
(安装openssl, 记得加--shared选项, 否则openssh编译的时候可能会找不到新安装的openssl的library, 会报错:openssl的 header和library版本不匹配)
(20151020:增加了zlib选项,可解决最后的错误提示“Zlib not supported: compression tests skipped”)
make clean(这一步很关键,务必执行)
make
make test(这一步是进行SSL 加密协议的完整测试,如出现错误需找出原因,否则可能导致 SSH 不能使用)
make install
■如果make时报错如下
c_zlib.c:25:18: 错误:zlib.h:没有那个文件或目录
原因是没有zlib的devel库,需要安装devel库:yum install zlib-delvel
■确认openssl版本
openssl version -a
■升级openssl后可能会导致如下错误1
[root@zhzy138 openssh-7.5p1]# yum infovncserver
There was a problem importing one of thePython modules
required to run yum. The error leading tothis problem was:
libssl.so.10: cannot open shared object file: No such file or directory
Please install a package which providesthis module, or
verify that the module is installedcorrectly.
It's possible that the above module doesn'tmatch the
current version of Python, which is:
2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
ln相关的lib库文件到默认的目录即可
ln -s /usr/lib64/libssl.so.1.1/usr/lib/libssl.so.10
■升级openssl后可能会导致如下错误2
[root@zhzy138 openssl-1.1.0f]# yum infovncserver
There was a problem importing one of thePython modules
required to run yum. The error leading tothis problem was:
libcrypto.so.10: cannot open shared object file: No such file ordirectory
Please install a package which providesthis module, or
verify that the module is installedcorrectly.
It's possible that the above module doesn'tmatch the
current version of Python, which is:
2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
如下方法并不能解决问题
ln -s /usr/lib64/libcrypto.so.1.1/usr/lib/libcrypto.so.10
从os源安装低版本的openssl包,可恢复libssl库,但openssl版本仍然过低,无法安装最新版本的openssh7.5
rpm -ivh openssl-1.0.0-27.el6.x86_64.rpm
rpm -ivhopenssl-devel-1.0.0-27.el6.x86_64.rpm
四、■■升级openssh
www.openssh.com
下载相关源码【已下载,使用7.2版本】
■备份已有的ssh
mv /etc/ssh /etc/ssh.old
■卸载ssh
rpm -e `rpm -qa|grep openssh` --allmatches--nodeps
■配置、编译、安装ssh
tar xvfz openssh-7.5p1.tar.gz
cd openssh-7.5p1
./configure --prefix=/usr--sysconfdir=/etc/ssh --with-pam --with-zlib=/usr/local/zlib--with-md5-passwords
如果提示没有openssl头文件,则需安装openssl-devel开发包:yum install openssl-devel
如果提示openssl版本太低:OpenSSL>= 1.0.1 required,则需升级openssl
如果提示没有pam头文件:PAMheaders not found,则需安装PAM开发包:yuminstall pam-devel
make
make install
■配置进系统服务
cp contrib/redhat/sshd.init/etc/init.d/sshd
chkconfig --add sshd
■修改PAM配置
cp contrib/sshd.pam.generic /etc/pam.d/sshd
这里的lib需要修改为正确的路径,否则会在/var/log/secure里面看到无法找到lib的报错,导致pam无法生效!路径可参见/etc/pam.d/里面的su、rlogin等文件,将路径/lib/security/删掉即可。
■确认升级后的版本
ssh -V
■修改sshd配置
根据原sshd配置:/etc/ssh.old/sshd_config
修改新sshd配置:/etc/ssh/sshd_config
ssh端口号是否是22
#Port 22
是否允许root远程登陆
#PermitRootLogin yes
sshd默认没打开PAM支持
#UsePAM no
■重新启动sshd服务
service sshd restart
■验证可以远程ssh登陆以后,可以关闭telnet服务
service xinetd stop
■■其他可能的问题
■升级完成后ssh登录正常,sftp不能通过4A正常登录;
处理方法:
将/etc/ssh/sshd_config文件中的
# override default of no subsystems
Subsystem sftp /usr/local/openssh/libexec/sftp-server
修改为:
# override default of no subsystems
Subsystem sftp internal-sftp
#Subsystem sftp /usr/local/openssh/libexec/sftp-server
后重启ssh后,绕行堡垒机登录正常;
■通过堡垒机登录设备失败,提示“不能切换至"XXXXXXXXXXXXX"指定目录”;
处理方法:
修改/etc/ssh/sshd_config文件,添加
KexAlgorithms +diffie-hellman-group1-sha1
重启sshd服务后,通过堡垒机登录sftp正常。
升级openssh【linux平台】相关推荐
- Linux升级OpenSSH完整手册
本手册旨在升级OpenSSH版本,提升Linux安全性. 在RedHat AS3 Update8和RedHat AS4 Update7上测试成功. 一. 升级zLib至1.2.3版本 1. 下载Zli ...
- Linux安装或升级openssh步骤和可能遇到的问题
另起一句:Linux升级openssh一次成功版本,这个是新总结的博客,如果还没看下面这篇博客,可以直接看这个 ============================================ ...
- 【linux】RedHat 7.x 升级 openssh 为 8.x 版本
前述 环境介绍 系统版本:RedHat 7.6 cat /etc/redhat-release # Red Hat Enterprise Linux Server release 7.6 (Maipo ...
- linux升级ssh到6.6版本,centos6.5升级openssh到7.4版本
一个同事rpm卸载openssh的时候,使用了参数--erase,导致libssl.so.10依赖也被卸载了,导致yum,wget等服务器无法运行,使用yum等命令时会出现以下报错 libssl.so ...
- linux升级ipv6协议栈,IPv6技术及基于Linux平台IPv6协议栈的实现
IPv6技术及基于Linux平台IPv6协议栈的实现 简单介绍了 IPv6的基本原理和特征 ,重点探讨了 IPv6技术在 L inux环境中的应用 :对支持 IPv6协 (本文共5页) 阅读全文> ...
- linux ssh rpm包,RHEL6(CentOS6)中使用源码包编译生成RPM的基本方法:升级OpenSSH篇
RHEL6(CentOS6)中使用源码包编译生成RPM的基本方法:升级OpenSSH篇 具体过程请见代码~ # cp openssh-7.1p1.tar.gz /root/rpmbuild/SOURC ...
- Linux升级OpenSSH修复高危漏洞
前言: 近期因centos 6.x和Redhat 6.x 默认openssh扫描存在大量漏洞,基于安全考虑,需要将openssh_5.3p1升级为最新版,网上查了很多教程,发现openssh存在大量依 ...
- ssh 用密码连接不上、查看openSSH 的版本、CentOS - 升级openSSH,修复安全漏洞
一 ssh密码连接 1,检查ssh配置文件 #vim /etc/ssh/sshd_config 130 UseDNS no 131 AddressFamily inet 132 PermitRoot ...
- linux5.5内核,一条命令就可以升级到Linux 5.5内核或Linux 5.5以上版本
升级Linux内核其实很简单,本文介绍的方法只需要一条命令,至少能够升级到Linux 5.5内核版本.当然,脚本当中要是加入新的Linux内核,你就能够升级到那个新内核,也就是说可以升级到Linux ...
最新文章
- php调用另一个页面内容,php怎么实现调用另一个页面
- 解决binwalk运行提示缺少LZMA模块
- python画动态爱心-【Python】五分钟画一条动态心形曲线~
- VTK:漫反射球用法实战
- Windows Server 2012 下安装MySQL 5.6 X64位包
- 优图yolo-v2 loss解析(tensorflow)
- Java 比特币开发系列教程汇总
- oracle数据库编程实验2答案,Oracle数据库-作业2-答案
- 实体类equals/hashCode
- 库查询所有表的权限_JSW 基于WEB的MSSQL数据库查询平台
- maven简单了解,没有Maven和使用Maven的区别
- 饭卡可以用水冲洗吗_关于饭卡使用与管理的规定
- Quick Batch File Compiler(BAT转EXE工具)bat文件转换成exe文件(启动jar包和自动打开浏览器)
- ValueError: operands could not be broadcast together with shapes、numpy广播错误
- python分句_Python 中文分句 | 学步园
- Android 悬浮窗的使用(2)
- WILDFLY + idea配置
- U3D客户端框架之 拓展StringBuilder实现InsertNoGC、IndexOf、LastIndexOf、ReplaceNoGC、AppendNoGC API 减少GC
- Qlik Sense中处理SQL语句的流程
- FreeCAD错误:没有激活的实体 解决办法