make extra header checks configurable

This commit is contained in:
psy 2021-01-12 16:12:49 +01:00
parent 6d9f604b93
commit 41af92aea4
No known key found for this signature in database
GPG key ID: DFF5B17AC3A8ECF5
5 changed files with 18 additions and 11 deletions

View file

@ -67,6 +67,11 @@ mydestination: []
# Check quota with dovecot at 127.0.0.1:12340 # Check quota with dovecot at 127.0.0.1:12340
check_dovecot_quota: false check_dovecot_quota: false
# Header checks (only header_checks and mime_header_checks supported), see http://www.postfix.org/header_checks.5.html
# privacy related headers are removed in any case, you can add more like this:
add_header_checks:
- { regexp: "^Mime:", action: "IGNORE" }
``` ```
**postfixmaps** **postfixmaps**

View file

@ -37,3 +37,4 @@ postfix:
mailboxes: mailMessageStore mailboxes: mailMessageStore
check_dovecot_quota: false check_dovecot_quota: false
postfixmaps: [] postfixmaps: []
add_header_checks: []

View file

@ -1,4 +0,0 @@
/^Received:.*with ESMTPSA/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^User-Agent:/ IGNORE

View file

@ -54,16 +54,10 @@
- { src: "main.cf.j2", dest: "/etc/postfix/main.cf" } - { src: "main.cf.j2", dest: "/etc/postfix/main.cf" }
- { src: "master.cf.j2", dest: "/etc/postfix/master.cf" } - { src: "master.cf.j2", dest: "/etc/postfix/master.cf" }
- { src: "virtual-aliases.cf.j2", dest: "/etc/postfix/virtual-aliases.cf" } - { src: "virtual-aliases.cf.j2", dest: "/etc/postfix/virtual-aliases.cf" }
- { src: "header_checks.j2", dest: "/etc/postfix/header_checks" }
notify: notify:
- restart postfix - restart postfix
- name: Copy header_checks
copy:
src: header_checks
dest: /etc/postfix/header_checks
notify:
- restart postfix
- name: copy postfix maps - name: copy postfix maps
template: template:
src: maps.j2 src: maps.j2

View file

@ -0,0 +1,11 @@
/^Received:.*with ESMTPSA/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^User-Agent:/ IGNORE
{% if postfix.add_header_checks|length %}
# {{ ansible_managed }}
{% for item in postfix.add_header_checks %}
/{{ item.regexp }}/ {{ item.action }}
{% endfor %}
{% endif %}