zoukankan      html  css  js  c++  java
  • 限制SSH访问源,禁止4A之外的地址跳转访问

    【fuel节点】

    在/etc/hosts.allow文件中
    添加:
    sshd:10.129.0.1:allow
    sshd:10.129.0.2:allow
    sshd:10.129.0.3:allow
    sshd:10.129.3.1:allow
    sshd:10.129.3.2:allow
    sshd:10.129.3.3:allow

    在/etc/hosts.deny文件中
    添加:
    sshd:ALL

    最后sshd重启
    service sshd restart

    【control节点】

    在/etc/hosts.allow文件中
    添加:
    sshd:10.129.0.1:allow
    sshd:10.129.0.2:allow
    sshd:10.129.0.3:allow
    sshd:10.129.3.1:allow
    sshd:10.129.3.2:allow
    sshd:10.129.3.3:allow
    sshd:10.254.1.1:allow

    在/etc/hosts.deny文件中
    添加:
    sshd:ALL

    最后sshd重启
    service sshd restart

    【compute节点】

    在/etc/hosts.allow文件中
    添加:
    sshd:10.129.0.1:allow
    sshd:10.129.0.2:allow
    sshd:10.129.0.3:allow
    sshd:10.129.3.1:allow
    sshd:10.129.3.2:allow
    sshd:10.129.3.3:allow
    sshd:10.254.1.1:allow
    sshd:10.254.1.15:allow
    sshd:10.254.1.30:allow
    sshd:10.254.1.45:allow

    在/etc/hosts.deny文件中
    添加:
    sshd:ALL

    最后sshd重启
    service sshd restart

    其中,计算节点可用如下脚本:

    #! /bin/bash
    line=`grep ^10 ~/hosts|wc -l`
    for i in `seq $line`
    do
    des=`grep ^10 hosts|sed -n ${i}p`
    ssh $des ' echo 'sshd:10.129.0.1:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.129.0.2:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.129.0.3:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.129.3.1:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.129.3.2:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.129.3.3:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.254.1.1:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.254.1.15:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.254.1.30:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:10.254.1.45:allow' >> /etc/hosts.allow'
    ssh $des ' echo 'sshd:ALL' >> /etc/hosts.deny'
    ssh $des ' service sshd restart '

    echo $des >> ip.log
    done
    if [ $i == $line ];then
    echo 'deploy success'
    else
    echo 'deploy failed'
    fi

  • 相关阅读:
    【win10】浏览器Chrome 和edge 体验对比与使用心得
    【Java】 VM 环境配置过程要点( win10,64位)
    office2013 激活方法
    产品激活 比如Windows激活 , office激活 等激活的原理是什么? KMS等激活工具安全吗?
    回顾外滩踩踏事件,吸取的教训
    【win7】Ubuntu安装使用中的一些注意事项
    黑屏
    mock测试(一)
    Django模型类(一)
    获取本机局域网ip和出口ip
  • 原文地址:https://www.cnblogs.com/cmss/p/5131510.html
Copyright © 2011-2022 走看看