近期因centos 6.x 默认openssh扫描存在大量漏洞,基于安全考虑,需要将openssh_5.3p1升级为最新版,网上查了很多教程,发现openssh存在大量依赖,不解决依赖问题很难保证其他服务政策。而openssl又被大量程序依赖。实在是头疼。最后发现一个不破坏各种依赖又可以完美升级的方案

注:curl wget yum等依赖openssl   gitlab依赖openssh因卸载openssh与openssl编译安装导致各种依赖程序被破坏,虽然最后升级成功,但是wget curl 和代码库被破坏。

1、下载openssh7.7p源码包

http://www.openssh.com/portable.html

下载之后解压看readme和install

  1. 1. Prerequisites
  2. ----------------
  3.  
  4. A C compiler. Any C89 or better compiler should work. Where supported,
  5. configure will attempt to enable the compiler's run-time integrity checking
  6. options. Some notes about specific compilers:
  7. - clang: -ftrapv and -sanitize=integer require the compiler-rt runtime
  8. (CC=clang LDFLAGS=--rtlib=compiler-rt ./configure)
  9.  
  10. You will need working installations of Zlib and libcrypto (LibreSSL /
  11. OpenSSL)
  12.  
  13. Zlib 1.1.4 or 1.2.1.2 or greater (earlier 1.2.x versions have problems):
  14. http://www.gzip.org/zlib/
  15.  
  16. libcrypto (LibreSSL or OpenSSL >= 1.0.1 < 1.1.0)
  17. LibreSSL http://www.libressl.org/ ; or
  18. OpenSSL http://www.openssl.org/
  19.  
  20. LibreSSL/OpenSSL should be compiled as a position-independent library
  21. (i.e. with -fPIC) otherwise OpenSSH will not be able to link with it.
  22. If you must use a non-position-independent libcrypto, then you may need
  23. to configure OpenSSH --without-pie. Note that because of API changes,
  24. OpenSSL 1.1.x is not currently supported.
  25.  
  26. The remaining items are optional.

官方给出的文档中提到的先决条件openssh安装依赖zlib1.1.4并且openssl>=1.0.1版本就可以了。那么直接看当前系统的openssl版本是多少

  1. [root@zabbix-serv ~]# openssl version
  2. OpenSSL 1.0.1e-fips 11 Feb 2013
  3. [root@zabbix-serv ~]# rpm -q zlib
  4. zlib-1.2.3-29.el6.x86_64
  5. [root@zabbix-serv ~]# rpm -q zlib-devel
  6. zlib-devel-1.2.3-29.el6.x86_64

发现自带的openssl版本符合openssh7.7p的安装条件,自带的zlib也符合OpenSSH7.7P的依赖。那么就直接安装吧。

2、打包OpenSSH

  1. mkdir -p /usr/src/redhat/{SOURCES,SPECS}
  2. cd /usr/src/redhat/SOURCES/
  3. wget http://ftp.riken.jp/Linux/momonga/6/Everything/SOURCES/x11-ssh-askpass-1.2.4.1.tar.gz
  4. tar xf openssh-7.7p1.tar.gz
  5. cp openssh-7.7p1/contrib/redhat/openssh.spec /usr/src/redhat/SPECS/
  6. chown sshd:sshd /usr/src/redhat/SPECS/ -R
  7. sed -i 's@%define no_gnome_askpass 0@%define no_gnome_askpass 1@g' /usr/src/redhat/SPECS/openssh.spec
  8. sed -i 's@%define no_x11_askpass 0@%define no_x11_askpass 1@g' /usr/src/redhat/SPECS/openssh.spec
  9. cp /usr/src/redhat/SOURCES/openssh-7.7p1.tar.gz ~/rpmbuild/SOURCES/
  10. cd /usr/src/redhat/SPECS/
  11. rpmbuild -ba openssh.spec

可以看到rpm包和yum安装的是一样的。

  1. ├── RPMS
  2. └── x86_64
  3. ├── openssh-7.7p1-1.el6.x86_64.rpm
  4. ├── openssh-clients-7.7p1-1.el6.x86_64.rpm
  5. ├── openssh-debuginfo-7.7p1-1.el6.x86_64.rpm
  6. └── openssh-server-7.7p1-1.el6.x86_64.rpm
  1. [root@zabbix-serv SPECS]# rpm -qa|grep openssh
  2. openssh-clients-5.3p1-117.el6.x86_64
  3. openssh-5.3p1-117.el6.x86_64
  4. openssh-server-5.3p1-117.el6.x86_64

直接替换安装rpm包

  1. [root@zabbix-serv x86_64]# rpm -Uvh *
  2. Preparing... ########################################### [100%]
  3. 1:openssh ########################################### [ 25%]
  4. 2:openssh-clients ########################################### [ 50%]
  5. 3:openssh-server warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnew
  6. ########################################### [ 75%]
  7. 4:openssh-debuginfo ########################################### [100%]

安装后查看各项依赖openssl的匀使用正常。这么安装比编译安装要好很多。

  1. [root@zabbix-serv x86_64]# sshd -V
  2. unknown option -- V
  3. OpenSSH_7.7p1, OpenSSL 1.0.1e-fips 11 Feb 2013
  4. usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
  5. [-E log_file] [-f config_file] [-g login_grace_time]
  6. [-h host_key_file] [-o option] [-p port] [-u len]
  7. [root@zabbix-serv x86_64]# ssh -V
  8. OpenSSH_7.7p1, OpenSSL 1.0.1e-fips 11 Feb 2013
  9. [root@zabbix-serv x86_64]# curl baidu.com -I
  10. HTTP/1.1 200 OK
  11. Date: Wed, 25 Apr 2018 16:37:49 GMT
  12. Server: Apache
  13. Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT
  14. ETag: "51-47cf7e6ee8400"
  15. Accept-Ranges: bytes
  16. Content-Length: 81
  17. Cache-Control: max-age=86400
  18. Expires: Thu, 26 Apr 2018 16:37:49 GMT
  19. Connection: Keep-Alive
  20. Content-Type: text/html
  21.  
  22. [root@zabbix-serv x86_64]# wget -q baidu.com
  23. [root@zabbix-serv x86_64]# yum list >>/dev/null
  1.  
  1. 测试yum安装,依赖openssh的是否会将7.7p替换为5.3p
  1. [root@zabbix-serv x86_64]# yum install openssh*
  2. Loaded plugins: fastestmirror, security
  3. Setting up Install Process
  4. Examining openssh-7.7p1-1.el6.x86_64.rpm: openssh-7.7p1-1.el6.x86_64
  5. openssh-7.7p1-1.el6.x86_64.rpm: does not update installed package.
  6. Examining openssh-clients-7.7p1-1.el6.x86_64.rpm: openssh-clients-7.7p1-1.el6.x86_64
  7. openssh-clients-7.7p1-1.el6.x86_64.rpm: does not update installed package.
  8. Examining openssh-debuginfo-7.7p1-1.el6.x86_64.rpm: openssh-debuginfo-7.7p1-1.el6.x86_64
  9. openssh-debuginfo-7.7p1-1.el6.x86_64.rpm: does not update installed package.
  10. Examining openssh-server-7.7p1-1.el6.x86_64.rpm: openssh-server-7.7p1-1.el6.x86_64
  11. openssh-server-7.7p1-1.el6.x86_64.rpm: does not update installed package.
  12. Error: Nothing to do

CentOS 6.8升级OpenSSH7.7p的更多相关文章

  1. centos 6.5 升级openssh-7.5

    1.环境 2.安装telnet 服务,防止ssh升级之后登陆不上服务器,使用telnet 连接服务器 yum install telnet-server -y chkconfig telnet on ...

  2. CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)

    ---恢复内容开始--- CentOS 6.6 升级GCC G++ (当前最新GCC/G++版本为v6.1.0) 没有便捷方式, yum update....   yum install 或者 添加y ...

  3. Centos 6.5升级到Git2.1.2的步骤

    Centos 6.5升级到Git2.1.2的步骤 Centos 6.5升级到Git2.1.2其实是非常的简单,因这款版本控制程序非常的好用,所以小编自己也是使用它了,下面一起来看看Centos 6.5 ...

  4. CentOS 6.9 升级MySQL 5.6.36到5.7.18

    CentOS 6.9 升级MySQL 5.6.36到5.7.18 MySQL 5.6.36 安装过程:http://www.cnblogs.com/imweihao/p/7156754.html 升级 ...

  5. Centos 6.x 升级到 7.x

    Centos6.5跨越大版本升级到Centos7.4 - Linux学习与应用 - CSDN博客https://blog.csdn.net/whbttst/article/details/805348 ...

  6. 【转】CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)

    原文地址:https://www.cnblogs.com/lzpong/p/5755678.html 我这里是centos7 升级到gcc8.1,过程差不多,参考这篇文章,记录一下. ---原文--- ...

  7. CentOS 7下升级MySQL5.7.23的一个坑

    发现CentOS 7下升级MySQL5.7.23的一个坑,以前面升级到MySQL 5.7.23的一个集群为例 在我们环境下打开文件描述符个数的参数open_files_limit在MySQL 5.6. ...

  8. CentOS 6 下升级安装Mysql 5.5 完整步骤

    使用系统CentOS 6.2本来已经系统自带安装了mysql 5.1,但是奈何5.1不支持utf8mb4字符集(详见:http://blog.csdn.net/shootyou/article/det ...

  9. CentOS 6.5 升级内核到 3.10.28

    本文适用于CentOS 6.4, CentOS 6.5,亲测可行,估计也适用于其他Linux发行版. 1. 准备工作 1.1 下载源码包 Linux内核版本有两种:稳定版和开发版 ,Linux内核版本 ...

随机推荐

  1. 「HDU - 2857」Mirror and Light(点关于直线的对称点)

    题目链接 Mirror and Light 题意 一条直线代表镜子,一个入射光线上的点,一个反射光线上的点,求反射点.(都在一个二维平面内) 题解 找出入射光线关于镜子直线的对称点,然后和反射光线连边 ...

  2. 【AtCoder3611】Tree MST(点分治,最小生成树)

    [AtCoder3611]Tree MST(点分治,最小生成树) 题面 AtCoder 洛谷 给定一棵\(n\)个节点的树,现有有一张完全图,两点\(x,y\)之间的边长为\(w[x]+w[y]+di ...

  3. a span做成按钮样式不选中文字

    a,span做成按钮样式时,文字会被选中.加以下CSS可以让其不选中.测试三大浏览器都可以 .button { display: inline-block; -moz-user-select: non ...

  4. 152. Maximum Product Subarray 以及 讨论【最大连续子序列】

    题目大意: 连续最大子段积 题目思路: 最大值只能产生在一个正数x一个正数,一个负数乘一个负数,所以维护两个值,一个区间最大值,一个最小值 其他的话: 在讨论这个问题之前,我先来说一说大一刚开学就学了 ...

  5. NOI2009管道取珠(dp)

    题意:给定两列球,可以从任意一列球的末尾弹出一个球,最后会得到一个序列,设第i种序列可以被a[i]种操作产生,那么会产生a[i]^2的贡献,求贡献和. Solution: 首先我们观察a[i]^2的含 ...

  6. SCOI2009游戏 (数论+dp)

    题解 很显然,对于一个确定的排列,每个数字的移动规则是一定的,我们根据这个排列,把它抽象为i向a[i]连一条边,很显然最后会构成一个环,那么行数就是这些环长的lcm. 那么问题变成了把n任意进行划分, ...

  7. Spring -- <mvc:annotation-driven />

    <mvc:annotation-driven /> 会自动注册:RequestMappingHandlerMapping .RequestMappingHandlerAdapter 与Ex ...

  8. SpringBoot学习笔记(6) SpringBoot数据缓存Cache [Guava和Redis实现]

    https://blog.csdn.net/a67474506/article/details/52608855 Spring定义了org.springframework.cache.CacheMan ...

  9. Dubbo x Cloud Native 服务架构长文总结(很全)

    Dubbo x Cloud Native 服务架构长文总结(很全) mercyblitz SpringForAll社区 3天前 分享简介 Cloud Native 应用架构随着云技术的发展受到业界特别 ...

  10. 【SDOI2008】仪仗队

    //裸的欧拉函数//y=kx//求不同的k有多少#include<bits/stdc++.h> #define ll long long #define N 40010 using nam ...