Oefenweb / ansible-fail2ban

Ansible role to set up fail2ban in Debian-like systems
MIT License
121 stars 55 forks source link

Set started/stopped mails sender and address #42

Open mathieumd opened 7 years ago

mathieumd commented 7 years ago

AFAIK, the specs of mails sent by Fail2ban when it starts are handled by action.d/{sendmail,mail}-common.conf (which one is used depends on mta value in jail.local).

So in order to configure this, this role could simply add a task like this:

  - name: set email sender address
    ini_file:
      dest: "/etc/fail2ban/action.d/{{fail2ban_mta}}-common.local"
      section: Init
      option: "{{item.k}}"
      value: "{{item.v}}"
    with_items:
      - { k: "dest", v: "{{fail2ban_destemail}}" }
      - { k: "sender", v: "{{fail2ban_sender}}" }
      - { k: "sendername", v: "{{fail2ban_sendername}}" }
    notify: restart fail2ban
vmpr commented 1 month ago

I would like that! at least until the underlying problem in Fail2ban is fixed?