configure mail logging
This commit is contained in:
parent
17ecb3d1ca
commit
26977ade52
5 changed files with 33 additions and 5 deletions
4
files/rsyslog.d/mail-sasl.conf
Normal file
4
files/rsyslog.d/mail-sasl.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Managed by Ansible
|
||||
# Write SASLS log to file
|
||||
|
||||
:msg, contains, "SASL" /var/log/mail-sasl.log
|
4
files/rsyslog.d/mail.conf
Normal file
4
files/rsyslog.d/mail.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Managed by Ansible
|
||||
|
||||
module(load="mmanon")
|
||||
mail.* action(type="mmanon")
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
- name: "Fail2ban | Copy jaiil file"
|
||||
- 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"
|
||||
- name: "Fail2ban | Copy SASL filter"
|
||||
ansible.builtin.copy:
|
||||
src: files/fail2ban/postfix-sasl.local
|
||||
dest: "{{ fail2ban_filter_dir }}/postfix-sasl.local"
|
||||
|
@ -14,9 +14,10 @@
|
|||
notify: reload fail2ban
|
||||
|
||||
- name: "Fail2ban | Setup SASL logging"
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/rsyslog.d/postfix.conf
|
||||
line: ':msg, contains, \"SASL\" /var/log/{{ mail_sasl_log }}'
|
||||
ansible.builtin.copy:
|
||||
src: rsyslog.d/mail-sasl.conf
|
||||
dest: /etc/rsyslog.d/mail-sasl.conf
|
||||
mode: "0644"
|
||||
notify: restart rsyslog
|
||||
|
||||
- name: "Fail2ban | Setup logrotate"
|
||||
|
|
|
@ -49,3 +49,8 @@
|
|||
- name: Monitoring
|
||||
ansible.builtin.import_tasks: monitoring.yml
|
||||
tags: monitoring
|
||||
|
||||
- name: Logging
|
||||
ansible.builtin.import_tasks: rsyslog.yml
|
||||
tags: logging
|
||||
when: postfix_type == "internet"
|
||||
|
|
14
tasks/rsyslog.yml
Normal file
14
tasks/rsyslog.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: "Rsyslog | Disable logging of IP addresses"
|
||||
ansible.builtin.copy:
|
||||
src: rsyslog.d/mail.conf
|
||||
dest: /etc/rsyslog.d/mail.conf
|
||||
mode: "0644"
|
||||
notify: restart rsyslog
|
||||
|
||||
- name: "Rsyslog | Disable mail logging to syslog"
|
||||
ansible.builtin.replace:
|
||||
path: /etc/rsyslog.conf
|
||||
regexp: "^\\*\\.\\*(?!.*(mail\\.none).*$).*"
|
||||
replace: "*.*;auth,authpriv.none,mail.none -/var/log/syslog"
|
||||
notify: restart rsyslog
|
Loading…
Reference in a new issue