• DenyHosts 安装及配置详解


    下载 http://downloads.sourceforge.net/denyhosts/DenyHosts-2.6.tar.gz 并上传到服务器

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    tar zxvf DenyHosts-2.6.tar.gz
    cd DenyHosts-2.6
    chmod +x setup.py
    python setup.py install
    cd /usr/share/denyhosts/
    cp denyhosts.cfg-dist denyhosts.cfg
    cp daemon-control-dist daemon-control
    chown root daemon-control
    chmod 700 daemon-control
    ./daemon-control start
    cd /etc/init.d
    ln -s /usr/share/denyhosts/daemon-control denyhosts
    chkconfig --add denyhosts
    chkconfig --level 2345 denyhosts on
    service denyhosts start


    配置文件的几个配置项解释

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    SECURE_LOG = /var/log/secure
    ssh服务的日志,读取上面的文件内容判断非法IP 
    ###################################### 
    HOSTS_DENY = /etc/hosts.deny 
    控制用户登录的文件,把IP加入上面的文件内,达到拒绝的效果 
    #################################### 
    PURGE_DENY = 30m 
    限制30分钟不能登录 
    # purge entries older than 1 week
    #PURGE_DENY = 1w 
    限制1个星期不能连接 
    # purge entries older than 5 days 
    #PURGE_DENY = 5d
    限制5天不能连接 
    ################################ 
    BLOCK_SERVICE  = sshd 
    表示禁止的服务名 
    ############################### 
    DENY_THRESHOLD_INVALID = 5 
    允许无效用户登录失败次数(/etc/passwd中没有的用户) 
    ############################### 
    DENY_THRESHOLD_VALID = 10 
    允许有效用户登录失败次数 
    ############################## 
    DENY_THRESHOLD_ROOT = 1 
    允许root登录失败次数 
    ############################# 
    WORK_DIR = /usr/share/denyhosts/data
    主要工作目录,里面很多文件名和配置文件都是对应的 
    ############################# 
    HOSTNAME_LOOKUP=YES 
    表示是否做域名反向解析
    ############################# 
    ADMIN_EMAIL = 384343423@qq.com 
    管理员邮箱 
    DAEMON_LOG = /var/log/denyhosts
    表示denyhosts服务的日志文件 
    #############################
  • 相关阅读:
    24-移动端app数据爬取
    24-移动端app数据爬取
    18闭包
    mysql日期 获取本月第一天 获取下个月的第一天
    介绍shell的来龙去脉给你看
    RHEL 和centos 的区别
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
    CDH管理界面查看各框架的版本(hive为例)
    Cloudera hadoop配置文件地址和修改配置属性方法
    idea快速创建级联目录
  • 原文地址:https://www.cnblogs.com/shihao/p/2627103.html
Copyright © 2020-2023  润新知