• 请不要在回答技术问题时复制粘贴 AI 生成的内容
wnarutou
V2EX  ›  程序员

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

  •  
  •   wnarutou · Nov 2, 2021 · 1305 views
    This topic created in 1651 days ago, the information mentioned may be changed or developed.
    /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
       Nov 2, 2021
    修正一下,刚才通过 systemctl restart 重启 fail2ban ,确定可以接收到 start 提醒,但是 ban 提醒确实没有
    wnarutou
        2
    wnarutou  
    OP
       Nov 3, 2021
    破案了,这期间我有修改系统的时区,从 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 的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5650 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 07:18 · PVG 15:18 · LAX 00:18 · JFK 03:18
    ♥ Do have faith in what you're doing.