From 53f2925435ea949d0d905ab1d47711ad6c89a1ce Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 26 Oct 2023 22:33:49 +0200 Subject: [PATCH] Remove fail2ban config files Better install them via fail2ban role --- files/fail2ban/postfix-sasl.conf | 7 ------- files/fail2ban/postfix-sasl.local | 21 --------------------- handlers/main.yml | 5 ----- tasks/fail2ban.yml | 14 -------------- 4 files changed, 47 deletions(-) delete mode 100644 files/fail2ban/postfix-sasl.conf delete mode 100644 files/fail2ban/postfix-sasl.local diff --git a/files/fail2ban/postfix-sasl.conf b/files/fail2ban/postfix-sasl.conf deleted file mode 100644 index ebb7285..0000000 --- a/files/fail2ban/postfix-sasl.conf +++ /dev/null @@ -1,7 +0,0 @@ -[sasl] -enabled = true -findtime = 3600 -bantime = 3600 -port = submission -filter = postfix-sasl -logpath = /var/log/mail-sasl.log \ No newline at end of file diff --git a/files/fail2ban/postfix-sasl.local b/files/fail2ban/postfix-sasl.local deleted file mode 100644 index 4a6ceaa..0000000 --- a/files/fail2ban/postfix-sasl.local +++ /dev/null @@ -1,21 +0,0 @@ -# Fail2Ban filter for postfix authentication failures -# - -[INCLUDES] - -before = common.conf - -[Definition] - -_daemon = postfix(-\w+)?/(?:submission/|smtps/)?smtp[ds] - -failregex = ^%(__prefix_line)swarning: [-._\w]+\[\]: SASL ((?i)LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [ A-Za-z0-9+/:]*={0,2})?\s*$ - -ignoreregex = authentication failed: Connection lost to authentication server$ - -[Init] - -journalmatch = _SYSTEMD_UNIT=postfix.service - - -# Author: Yaroslav Halchenko diff --git a/handlers/main.yml b/handlers/main.yml index cd6817c..9761c78 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,11 +4,6 @@ name: rsyslog state: restarted -- name: reload fail2ban - ansible.builtin.service: - name: fail2ban - state: reloaded - - name: reload postfix ansible.builtin.service: name: postfix diff --git a/tasks/fail2ban.yml b/tasks/fail2ban.yml index 98aef5e..7a0b1b2 100644 --- a/tasks/fail2ban.yml +++ b/tasks/fail2ban.yml @@ -1,18 +1,4 @@ --- -- name: "Fail2ban | Copy jail file" - ansible.builtin.copy: - src: files/fail2ban/postfix-sasl.conf - dest: "{{ fail2ban_jail_dir }}/postfix-sasl.conf" - mode: "0644" - notify: reload fail2ban - -- name: "Fail2ban | Copy SASL filter" - ansible.builtin.copy: - src: files/fail2ban/postfix-sasl.local - dest: "{{ fail2ban_filter_dir }}/postfix-sasl.local" - mode: "0644" - notify: reload fail2ban - - name: "Fail2ban | Setup SASL logging" ansible.builtin.copy: src: rsyslog.d/mail-sasl.conf