zoukankan      html  css  js  c++  java
  • Centos7 openssh 离线升级8.4

    openssh 低版本存在漏洞,所以需要升级到最新版,由于客户是离线环境所以采用离线安装。

    下载依赖openssl、zlib、openssh

    在有网络的主机上下载依赖 拷贝到目标服务器

    升级前请 看注意事项 看注意事项 看注意事项

    wget https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/openssh-8.4p1.tar.gz
    wget http://www.zlib.net/zlib-1.2.11.tar.gz
    wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
    

    解压升级包

    tar  --no-same-owner -zxvf zlib-1.2.11.tar.gz
    tar  --no-same-owner -zxvf openssh-8.4p1.tar.gz
    tar  --no-same-owner -zxvf openssl-1.1.1g.tar.gz
    

    编译安装zlib

    cd zlib-1.2.11
    ./configure --prefix=/usr/local/zlib
    make && make install
    

    编译安装openssl

    cd openssl-1.1.1g
    ./config --prefix=/usr/local/ssl -d shared
    make && make install
    echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
    ldconfig -v
    

    安装openssh

    cd openssh-8.4p1
    ./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
    make && make install
    

    sshd_config文件修改

    echo 'PermitRootLogin yes' >>/usr/local/openssh/etc/sshd_config
    echo 'PubkeyAuthentication yes' >>/usr/local/openssh/etc/sshd_config
    echo 'PasswordAuthentication yes' >>/usr/local/openssh/etc/sshd_config
    

    备份原有文件,并将新的配置复制到指定目录

    mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
    cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
    mv /usr/sbin/sshd /usr/sbin/sshd.bak
    cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
    mv /usr/bin/ssh /usr/bin/ssh.bak
    cp /usr/local/openssh/bin/ssh /usr/bin/ssh
    mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
    cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
    mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak
    cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
    

    启动sshd

    service sshd restart
    ssh -V
    # OpenSSH_8.4p1, OpenSSL 1.1.1g  21 Apr 2020
    

    注意事项

    • 安装openssl 需要安装perl 安装完成后如果没有pod2html 需要手动拷贝pod2html到/usr/local/bin 我是通过虚拟机安装相同的操作系统的开发套件然后复制的。
    • 如果有堡垒机,重启openssh会出现无法访问情况,原因是堡垒机记录了ssh连接记录 需要删除堡垒机账户下.ssh/know_host 文件 当然大部分是没有这个权限的,所以需要更换未连接过改服务器的堡垒机账号。
  • 相关阅读:
    1.27
    1.25
    Representation Learning with Contrastive Predictive Coding
    Learning a Similarity Metric Discriminatively, with Application to Face Verification
    噪声对比估计(负样本采样)
    Certified Adversarial Robustness via Randomized Smoothing
    Certified Robustness to Adversarial Examples with Differential Privacy
    Dynamic Routing Between Capsules
    Defending Adversarial Attacks by Correcting logits
    Visualizing Data using t-SNE
  • 原文地址:https://www.cnblogs.com/tongchengbin/p/13809096.html
Copyright © 2011-2022 走看看