在线不卡日本ⅴ一区v二区_精品一区二区中文字幕_天堂v在线视频_亚洲五月天婷婷中文网站

  • <menu id="lky3g"></menu>
  • <style id="lky3g"></style>
    <pre id="lky3g"><tt id="lky3g"></tt></pre>

    centos7離線升級(jí)openssh,漏洞修復(fù)

    centos7離線升級(jí)openssh,漏洞修復(fù)

    1. 安裝telnet

    yum -y install xinetd telnet-server

    配置/etc/xinetd.d/telnet

    cat > /etc/xinetd.d/telnet <<EOF

    service telnet

    {

    disable = yes

    flags = REUSE

    socket_type = stream

    wait = no

    user = root

    server = /usr/sbin/in.telnetd

    log_on_failure += USERID

    }

    EOF

    配置telnet登錄的終端類型

    cat >> /etc/securetty <<EOF

    pts/0

    pts/1

    pts/2

    pts/3

    EOF

    啟動(dòng)telnet

    systemctl enable xinetd –now

    systemctl enable telnet.socket –now

    2. 下載安裝包

    wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.8p1.tar.gz

    wget https://www.openssl.org/source/openssl-1.1.1j.tar.gz –no-check-certificate

    wget http://www.zlib.net/zlib-1.2.12.tar.gz

    3. 安裝zlib

    tar -zxvf zlib-1.2.12.tar.gz

    cd zlib-1.2.12

    ./configure –prefix=/usr/local/zlib

    make && make install

    4. 安裝openssl

    tar -zxvf openssl-1.1.1j.tar.gz

    cd openssl-1.1.1j

    ./config –prefix=/usr/local/ssl -d shared

    make && make install

    echo ‘/usr/local/ssl/lib’ >> /etc/ld.so.conf

    ldconfig -v

    openssl version -a

    5. 安裝openssh

    tar -zxvf openssh-8.8p1.tar.gz

    cd openssh-8.8p1

    ./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

    # 備份原有文件,并將新的配置復(fù)制到指定目錄

    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

    # 修改systemd參數(shù)(去掉Type或改為Type=simple)

    vim /usr/lib/systemd/system/sshd.service

    [Unit]

    Description=OpenSSH server daemon

    Documentation=man:sshd(8) man:sshd_config(5)

    After=network.target sshd-keygen.service

    Wants=sshd-keygen.service

    [Service]

    #Type=notify

    Type=simple

    EnvironmentFile=/etc/sysconfig/sshd

    ExecStart=/usr/sbin/sshd -D $OPTIONS

    ExecReload=/bin/kill -HUP $MAINPID

    KillMode=process

    Restart=on-failure

    RestartSec=42s

    [Install]

    WantedBy=multi-user.target

    重啟sshd服務(wù)

    systemctl daemon-reload

    systemctl restart sshd

    systemctl status sshd

    # 驗(yàn)證是否升級(jí)成功

    ssh -V

    鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場(chǎng),版權(quán)歸原作者所有,如有侵權(quán)請(qǐng)聯(lián)系管理員(admin#wlmqw.com)刪除。
    上一篇 2022年7月12日 15:26
    下一篇 2022年7月12日 15:26

    相關(guān)推薦

    聯(lián)系我們

    聯(lián)系郵箱:admin#wlmqw.com
    工作時(shí)間:周一至周五,10:30-18:30,節(jié)假日休息