zoukankan      html  css  js  c++  java
  • centos 7 升级OpenSSH-8.2p1

    openssh-7.9p1版本存在漏洞需要升级到最新的版本。

    注意:升级存在风险,导致无法远程登录,最好临时安装Telnet远程服务。

    1. 系统版本
    [root@test01 ~]# cat /etc/redhat-release 
    CentOS Linux release 7.7.1908 (Core)
    
    [root@test01 ~]# openssl version
    OpenSSL 1.0.2k-fips  26 Jan 2017
    
    [root@test01 ~]# rpm -qa | grep openssh
    openssh-7.4p1-11.el7.x86_64
    openssh-clients-7.4p1-11.el7.x86_64
    openssh-server-7.4p1-11.el7.x86_64
    
    2. 安装编辑工具
    yum install gcc openssl-devel zlib-devel -y
    
    3. 下载openssh最新包
    [root@test01 tmp]# wget https://mirrors.sonic.net/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
    
    [root@test01 tmp]# wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
    
    4. 备份ssh目录
    cp -r /etc/ssh/ /etc/ssh_bak
    
    5.解压编辑
    tar zxvf openssh-8.2p1.tar.gz 
    cd openssh-8.2p1
    ./configure --prefix=/usr --sysconfdir=/etc/ssh
    make
    
    6.卸载旧版本openssh
    rpm -e --nodeps `rpm -qa | grep openssh`
    rpm -qa | grep openssh
    make install
    

    报警:

    ssh-keygen: generating new host keys: DSA 
    /usr/sbin/sshd -t -f /etc/ssh/sshd_config
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_rsa_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Permissions 0640 for '/etc/ssh/ssh_host_ed25519_key' are too open.
    It is required that your private key files are NOT accessible by others.
    This private key will be ignored.
    sshd: no hostkeys available -- exiting.
    make: [check-config] 错误 1 (忽略)
    

    执行:

    [root@test01 openssh-8.2p1]# chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key
    
    7. 查看版本
    [root@test01 openssh-8.2p1]# ssh -V
    OpenSSH_8.2p1, OpenSSL 1.0.2k-fips  26 Jan 2017
    
    8.添加服务并允许root登录
    [root@test01 openssh-8.2p1]# cp contrib/redhat/sshd.init /etc/init.d/sshd
    [root@test01 openssh-8.2p1]# chkconfig --add sshd && chkconfig sshd on
    [root@test01 openssh-8.2p1]# sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g'  /etc/ssh/sshd_config
    [root@test01 openssh-8.2p1]# sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g'  /etc/ssh/sshd_config
    
    9. 重启sshd服务--验证远程登录
    [root@test01 openssh-8.2p1]# service sshd restart
    
    10. 关闭selinux
    [root@test01 openssh-8.2p1]# setenforce 0
    [root@test01 openssh-8.2p1]# sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config
    
  • 相关阅读:
    【现代程序设计】【Homework01】
    Apache 关于 mod_rewrite 遇到 %2F或%5C (正反斜杠)等特殊符号导致URL重写失效出现404的问题
    PHP 使用CURL库IP欺骗,隐藏真实客户端IP
    php客服聊天回话系统,长连接加ajax轮询实现
    Which PHP version do I choose
    批量操作,向后台传数组
    angularjs的directive详解
    table中表头不动,表体产生滚动条
    3263232
    forEach、for+i、map的用法及区别
  • 原文地址:https://www.cnblogs.com/it-baibai/p/12873531.html
Copyright © 2011-2022 走看看