zoukankan      html  css  js  c++  java
  • Centos7安全加固

    Centos7 安全加固密码规则
    vi /etc/login.defs

    PASS_MAX_DAYS   60         # 密码到期时间
    #设置密码过期的天数。 用户必须在几天内更改密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -M(days)(user)”

    PASS_MIN_DAYS   3          # 初始密码更改时间
    #设置可用密码的最短天数。 至少在改变它之后,用户必须至少使用他们的密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -m(days)(user)”

    PASS_MIN_LEN    8          # 密码最小长度
    #用户不能将密码长度设置为小于此参数。

    PASS_WARN_AGE   7          # 密码过期提示时间
    #在到期前设置警告的天数。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为存在用户,请运行命令“chage -W(days)(user)”

     

    账号锁定规则
    vi /etc/pam.d/login
    #%PAM-1.0
    auth required pam_tally2.so deny=3 lock_time=300 even_deny_root root_unlock_time=10


    deny 设置普通用户和root用户连续错误登陆的最大次数,超过最大次数,则锁定该用户

    unlock_time 设定普通用户锁定后,多少时间后解锁,单位是秒;

    even_deny_root 也限制root用户;

    root_unlock_time 设定root用户锁定后,多少时间后解锁,单位是秒;

    Centos7 ssh和vsftp限制IP登录白名单和黑名单(白名单优先级大于黑名单)
    vi /etc/hosts.deny  (黑名单)
    最后面加上两行代码的意思是,限制sshd和vsftpd服务所有IP登陆
    # hosts.deny    This file describes the names of the hosts which are
    #               *not* allowed to use the local INET services, as decided
    #               by the '/usr/sbin/tcpd' server.
    #
    # The portmap line is redundant, but it is left to remind you that
    # the new secure portmap uses hosts.deny and hosts.allow. In particular
    # you should know that NFS uses portmap!

    sshd:ALL
    vsftpd:ALL

    vi /etc/hosts.allow  (白名单)
    最后面加上的代码意思是,该IP可以访问sshd和vsftpd服务
    # hosts.allow   This file describes the names of the hosts which are
    #               allowed to use the local INET services, as decided
    #               by the '/usr/sbin/tcpd' server.
    #
    #sshd
    sshd:192.168.199.171:allow

    #vsfptd
    vsftpd:192.168.199.171:allow

  • 相关阅读:
    LeetCode OJ 107. Binary Tree Level Order Traversal II
    LeetCode OJ 116. Populating Next Right Pointers in Each Node
    LeetCode OJ 108. Convert Sorted Array to Binary Search Tree
    LeetCode OJ 105. Construct Binary Tree from Preorder and Inorder Traversal
    LeetCode OJ 98. Validate Binary Search Tree
    老程序员解Bug的通用套路
    转载 四年努力,梦归阿里,和大家聊聊成长感悟
    转载面试感悟----一名3年工作经验的程序员应该具备的技能
    Web Service和Servlet的区别
    关于spring xml文件中的xmlns,xsi:schemaLocation
  • 原文地址:https://www.cnblogs.com/z1110/p/11139187.html
Copyright © 2011-2022 走看看