zoukankan      html  css  js  c++  java
  • 升级openSSH

    1、当前系统版本

     [root@localhost ~]# cat /etc/redhat-release  

    Red Hat Enterprise Linux Server release 7.4 (Maipo)

    [root@localhost ~]# uname -m

    x86_64

    [root@localhost ~]# uname -r

    3.10.0-693.el7.x86_64

    2、SSL版本信息

     [root@localhost ~]# openssl version

    OpenSSL 1.0.2k-fips  26 Jan 2017

    3、更新zlib

    1、下载最新版本 Zlib
    Zlib 官方网站:http://www.zlib.net/
    2、编译安装 Zlib
    # tar xzvf zlib-1.2.11.tar.gz

    # cd zlib-1.2.11
    # ./configure --prefix=/usr/local/zlib
    # make
    # make install
    这样,就把 zlib 编译安装在
    /usr/local/zlib 中了。

    4、安装pam-devel

    1.下载最新版本pam-devel

    pam-devel官方下载网站: https://pkgs.org/download/pam-devel

    2.rpm安装pam-devel

    # rpm -ivh pam-devel-1.1.8-18.el7.x86_64.rpm

    这样就安装好了

    5、安装 OpenSSL
    1、下载最新版本openssl以及openssl-fips
    OpenSSL 的官方网站:http://www.openssl.org
    2、编译安装openssl-fips

    [root@localhost ~]# tar -xzvf openssl-fips-2.0.16.tar.gz

    [root@localhost ~]# cd openssl-fips-2.0.16

    [root@localhost openssl-fips-2.0.16]# ./config

    [root@localhost openssl-fips-2.0.16]# make

    [root@localhost openssl-fips-2.0.16]# make install

    默认安装到/usr/local/ssl/fips-2.0

    3、编译安装openssl 
    [root@localhost ~]# tar -xzvf openssl-1.0.2m.tar.gz
    [root@localhost openssl-1.0.2m]# cd openssl-1.0.2m
    [root@localhost openssl-1.0.2m]# ./config --prefix=/usr/ --shared zlib 
     

    或者

    [root@localhost openssl-1.0.2m]# ./config --prefix=/usr/ --shared fips

    (必须加上--shared,否则编译时会找不到新安装的openssl的库而报错)
    [root@localhost openssl-1.0.2m]# make
    [root@localhost openssl-1.0.2m]# make test 

    (这一步很重要哦!是进行 SSL加密协议的完整测试,如果出现错误就要一定先找出哪里的原因,否则一味继续可能导致最终 SSH 不能使用,后果很严重哦!)
    [root@localhost openssl-1.0.2m]# make install

    或者安装的升级方式如下所示:

    # pwd  

    /root/tools  

    # ls  

    openssl-1.0.1g.tar.gz  

    # tar xf openssl-1.0.1g.tar.gz   

    # cd openssl-1.0.1g  

    # ./config shared zlib  

    # make  

    # make install  

    # cd ..  

    # mv /usr/bin/openssl /usr/bin/openssl.ori              # 将之前的备份  

    # mv /usr/include/openssl /usr/include/openssl.ori  

    # ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl     # 软链接  

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

    # cp /etc/ld.so.conf /etc/ld.so.conf.ori                # 操作前备份【这样如果出现错误,可以及时还原】  

    # echo “/usr/local/ssl/lib” >> /etc/ld.so.conf  

    # ldconfig -v  

    其中 /etc/ld.so.conf 修改后的信息【使用vim修改】

    [zhang@zhang ~] $ cat /etc/ld.so.conf  

    include ld.so.conf.d/*.conf  

    #  Update openssl from OpenSSL 1.0.1e-fips  To   OpenSSL 1.0.1g  

    /usr/local/ssl/lib  

    4、查看是否升级成功

    [root@localhost openssl-1.0.2m]# openssl version

    OpenSSL 1.0.2m  2 Nov 2017       # 升级成功  

    6、安装 OpenSSH

    1、下载最新软件包源码

    官方下载地址http://www.openssh.com/portable.html#http

    2、备份当前openssh

    [root@localhost openssl-1.0.2m]# mv /etc/ssh /etc/ssh.old

    3、卸载当前openssh

    [root@localhost openssl-1.0.2m]# rpm -qa | grep openssh

    openssh-clients-7.4p1-11.el7.x86_64

    openssh-server-7.4p1-11.el7.x86_64

    openssh-7.4p1-11.el7.x86_64

    [root@localhost openssl-1.0.2m]# rpm -e --nodeps openssh-clients-7.4p1-11.el7.x86_64

    [root@localhost openssl-1.0.2m]# rpm -e --nodeps openssh-server-7.4p1-11.el7.x86_64

    [root@localhost openssl-1.0.2m]# rpm -e --nodeps openssh-7.4p1-11.el7.x86_64

    [root@localhost openssl-1.0.2m]# rpm -qa | grep openssh

    4、安装openssh

    [root@localhost ~]# tar -xzvf openssh-7.6p1.tar.gz

    [root@localhost ~]# cd openssh-7.6p1

    编译(同时兼容ssh1协议)

    [root@localhost openssh-7.6p1]# ./configure --prefix=/usr  --sysconfdir=/etc/ssh  --with-md5-passwords  --with-pam  --with-zlib --with-ssh1

    [root@localhost openssh-7.6p1]#make

    [root@localhost openssh-7.6p1]#make install

    5、安装后环境配置

    [root@localhost redhat]# cp /root/openssh-7.6p1/contrib/redhat/sshd.init /etc/init.d/sshd

    [root@localhost redhat]# chmod +x /etc/init.d/sshd

    [root@localhost redhat]# chkconfig --add sshd

    进入/etc/ssh目录修改sshd_config文件,添加PermitRootLogin yes到文件末尾

    cd /etc/ssh

    修改文件

    vi sshd_config

    添加PermitRootLogin yes到文件末尾

    保存,退出

    6、启动ssh服务

    service sshd start

    7、验证是否升级成功

     [root@localhost ssh]# ssh -V

    OpenSSH_7.6p1, OpenSSL 1.0.2m  2 Nov 2017 (升级成功)

     

    注意:记得关闭防火墙systemctl stop firewalld,记得关闭SELinux:

    1、临时关闭(不用重启机器):

    setenforce 0                  ##设置SELinux 成为permissive模式

                                  ##setenforce 1 设置SELinux 成为enforcing模式

    2、修改配置文件需要重启机器:

    修改/etc/selinux/config 文件

    将SELINUX=enforcing改为SELINUX=disabled

  • 相关阅读:
    WPF:linq
    WPF:ListView数据绑定及Style
    WPF: DatePicker
    多线程16--单例--懒汉模式和静态内部类形
    多线程15--线程本地变量ThreadLocal
    多线程14---模拟消息队列
    多线程13--多线程并发购票--低效的线程安全的车票容器
    多线程10--线程间实时通信--耗性能的轮询
    自定义video的controls(播放暂停按钮、进度条、快进快退等)
    js+css 写出 简单2048游戏
  • 原文地址:https://www.cnblogs.com/warylee/p/13545509.html
Copyright © 2011-2022 走看看