V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wnarutou
V2EX  ›  程序员

fail2ban 设置了提醒邮件,却只能收到 stop 的提醒

  •  
  •   wnarutou · 2021-11-02 22:15:36 +08:00 · 539 次点击
    这是一个创建于 906 天前的主题,其中的信息可能已经有所发展或是发生改变。
    /etc/fail2ban/jail.local 内容如下:
    ```
    [DEFAULT]
    destemail = root

    sender = root

    mta = mail

    action = %(action_mwl)s

    ```

    /etc/fail2ban/action.d/mail-whois-lines.conf 中 actionstart 、actionstop 、actionban 均不为空,且都有 mail 命令

    Ubuntu 系统,已安装 mail ,很奇怪的是,重启 fail2ban ,可以收到 stop 提醒,但是没有 start 提醒,且 /var/log/fail2ban.log 中有看到 ban 了 ip ,也没有 ban 提醒。

    请问下给位,还有哪里配置不对导致的吗?
    wnarutou
        1
    wnarutou  
    OP
       2021-11-02 22:55:21 +08:00
    修正一下,刚才通过 systemctl restart 重启 fail2ban ,确定可以接收到 start 提醒,但是 ban 提醒确实没有
    wnarutou
        2
    wnarutou  
    OP
       2021-11-03 21:51:02 +08:00
    破案了,这期间我有修改系统的时区,从 UTC+0 时区修改到+8 区,而没有重启服务器,或者 rsyslog 服务,导致往 /var/log/auth.log 的日志记录的时间还是 UTC+0 的时间记录的,但是呢,fail2ban 是读取的 /var/log/auth.log 的日志以及其中时间来判断 ban 和 unban ,auth.log 中的时间比通过 date 得到的时间要晚 8 小时,所以总是没有被 ban 的 ip 。

    至于最上面提到说 fail2ban.log 中有 ban 的 ip ,那是在修改时区之前已经被 ban 的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2243 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 00:37 · PVG 08:37 · LAX 17:37 · JFK 20:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.