Browse Source

Merge pull request #141 from cji/master

Fixes issue #8
Luke Cyca 10 years ago
parent
commit
7ac1954020

+ 5
- 0
roles/mailserver/files/etc_postfix_maps_smtp_header_checks.pcre View File

@@ -0,0 +1,5 @@
1
+/^\s*(Received: from)[^\n]*(.*)/ REPLACE $1 [127.0.0.1] (localhost [127.0.0.1])$2
2
+/^\s*User-Agent/        IGNORE
3
+/^\s*X-Enigmail/        IGNORE
4
+/^\s*X-Mailer/          IGNORE
5
+/^\s*X-Originating-IP/  IGNORE

+ 9
- 0
roles/mailserver/tasks/postfix.yml View File

@@ -8,6 +8,7 @@
8 8
     - postgresql-9.1
9 9
     - postfix-pgsql
10 10
     - python-psycopg2
11
+    - postfix-pcre
11 12
 
12 13
 - name: Set postgres password
13 14
   command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with  password '{{ db_admin_password }}';"
@@ -25,6 +26,14 @@
25 26
   template: src=mailserver.sql.j2 dest=/etc/postfix/import.sql owner=root group=root mode=0600
26 27
   notify: import sql postfix
27 28
 
29
+- name: Create postfix maps directory
30
+  file: path=/etc/postfix/maps state=directory owner=root group=root
31
+  when: mail_header_privacy == 1
32
+
33
+- name: Copy smtp_header_checks.pcre
34
+  copy: src=etc_postfix_maps_smtp_header_checks.pcre dest=/etc/postfix/maps/smtp_header_checks.pcre owner=root group=root
35
+  when: mail_header_privacy == 1
36
+
28 37
 - name: Copy main.cf
29 38
   template: src=etc_postfix_main.cf.j2 dest=/etc/postfix/main.cf owner=root group=root
30 39
   notify: restart postfix

+ 5
- 0
roles/mailserver/templates/etc_postfix_main.cf.j2 View File

@@ -110,3 +110,8 @@ postscreen_dnsbl_sites =
110 110
 postscreen_dnsbl_threshold = 3
111 111
 postscreen_dnsbl_action = enforce
112 112
 postscreen_greet_action = enforce
113
+
114
+{% if mail_header_privacy == 1 %}
115
+# Remove local client IP from headers
116
+smtp_header_checks = pcre:/etc/postfix/maps/smtp_header_checks.pcre
117
+{% endif %}

+ 1
- 0
vars/testing.yml View File

@@ -41,6 +41,7 @@ mail_virtual_aliases:
41 41
   - source: "webmaster@{{ domain }}"
42 42
     destination: "{{ admin_email }}"
43 43
     domain_pk_id: 1
44
+mail_header_privacy: 1
44 45
 
45 46
 # z-push
46 47
 zpush_timezone: "America/New_York"  #Example: "America/New_York"

+ 1
- 0
vars/user.yml View File

@@ -46,6 +46,7 @@ mail_virtual_aliases:
46 46
   - source: "webmaster@{{ domain }}"
47 47
     destination: "{{ admin_email }}"
48 48
     domain_pk_id: 1
49
+mail_header_privacy: 1
49 50
 
50 51
 # z-push
51 52
 zpush_timezone: "TODO"  #Example: "America/New_York"

Loading…
Cancel
Save