summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--IMAP.yml3
-rw-r--r--MX.yml1
-rw-r--r--roles/common/tasks/mail.yml5
-rw-r--r--roles/common/templates/etc/postfix/main.cf.j27
-rw-r--r--roles/mx/tasks/main.yml3
-rw-r--r--roles/mx/templates/etc/postfix/main.cf.j218
6 files changed, 18 insertions, 19 deletions
diff --git a/IMAP.yml b/IMAP.yml
index 2560f7e..0dfc52e 100644
--- a/IMAP.yml
+++ b/IMAP.yml
@@ -1,6 +1,5 @@
---
- name: Configure the IMAP server
hosts: IMAP
- sudo: True
roles:
- - IMAP
+ - { role: IMAP, inst: IMAP }
diff --git a/MX.yml b/MX.yml
index fc73e4d..11c1b0c 100644
--- a/MX.yml
+++ b/MX.yml
@@ -1,7 +1,6 @@
---
- name: Configure the MX:es
hosts: MX
- sudo: True
roles:
- { role: mx, inst: MX }
tags:
diff --git a/roles/common/tasks/mail.yml b/roles/common/tasks/mail.yml
index c562c42..e8d61a8 100644
--- a/roles/common/tasks/mail.yml
+++ b/roles/common/tasks/mail.yml
@@ -33,7 +33,6 @@
dest=/etc/postfix/{{ item }}
owner=root group=root
mode=0644
- register: r3
with_items:
- master.cf
- generic.pcre
@@ -45,7 +44,7 @@
dest=/etc/postfix/main.cf
owner=root group=root
mode=0644
- register: r4
+ register: r3
notify:
- Restart Postfix
@@ -60,6 +59,6 @@
- name: Start Postfix
service: name=postfix state=started
- when: not (r1.changed or r2.changed or r3.changed or r4.changed)
+ when: not (r1.changed or r2.changed or r3.changed)
- meta: flush_handlers
diff --git a/roles/common/templates/etc/postfix/main.cf.j2 b/roles/common/templates/etc/postfix/main.cf.j2
index a856843..10d4244 100644
--- a/roles/common/templates/etc/postfix/main.cf.j2
+++ b/roles/common/templates/etc/postfix/main.cf.j2
@@ -35,12 +35,11 @@ smtp_generic_maps = pcre:$config_directory/generic.pcre
# Forward everything to our internal mailhub
{% if 'MTA-out' in group_names %}
-# TODO: use a UNIX socket instead
-relay_transport = lmtp:unix:private/mta-out
+relayhost = [127.0.0.1]:{{ MTA_out.port }}
{% else %}
-relayhost = [{{ MTA_out.IPv4 }}]:{{ MTA_out.port }}
+relayhost = [{{ MTA_out.IPv4 }}]:{{ MTA_out.port }}
{% endif %}
-relay_domains =
+relay_domains =
# Tunnel everything through IPSec
smtp_tls_security_level = none
diff --git a/roles/mx/tasks/main.yml b/roles/mx/tasks/main.yml
index bd04feb..e2da61e 100644
--- a/roles/mx/tasks/main.yml
+++ b/roles/mx/tasks/main.yml
@@ -4,6 +4,7 @@
- postfix
- postfix-pcre
- postfix-ldap
+ - postfix-cdb
- postgrey
- libnet-ldap-perl
- libauthen-sasl-perl
@@ -53,8 +54,6 @@
- mailbox_maps.cf
- reserved_transport_maps
- transport_lists_maps.cf
- notify:
- - Restart Postfix
- name: Compile the Reserved Transport Maps
postmap: cmd=postalias instance={{ postfix_instance[inst].name }}
diff --git a/roles/mx/templates/etc/postfix/main.cf.j2 b/roles/mx/templates/etc/postfix/main.cf.j2
index 5c44781..8c1da35 100644
--- a/roles/mx/templates/etc/postfix/main.cf.j2
+++ b/roles/mx/templates/etc/postfix/main.cf.j2
@@ -23,7 +23,7 @@ master_service_disable = !smtp.inet inet
queue_directory = /var/spool/postfix-{{ postfix_instance[inst].name }}
data_directory = /var/lib/postfix-{{ postfix_instance[inst].name }}
-multi_instance_group = {{ postfix_instance[inst].group }}
+multi_instance_group = {{ postfix_instance[inst].group | default('') }}
multi_instance_name = postfix-{{ postfix_instance[inst].name }}
multi_instance_enable = yes
@@ -44,14 +44,15 @@ recipient_delimiter = +
# Forward everything to our internal mailhub
{% if 'MTA-out' in group_names %}
-relay_transport = lmtp:unix:private/mta-out
+relayhost = [127.0.0.1]:{{ MTA_out.port }}
{% else %}
-relayhost = [{{ MTA_out.IPv4 }}]:{{ MTA_out.port }}
+relayhost = [{{ MTA_out.IPv4 }}]:{{ MTA_out.port }}
{% endif %}
-relay_domains =
+relay_domains =
+# Virtual transport
{% if 'LDA' in group_names %}
-virtual_transport = lmtp:unix:private/lda
+virtual_transport = smtp:[127.0.0.1]:{{ LDA.port }}
{% else %}
virtual_transport = smtp:[{{ LDA.IPv4 }}]:{{ LDA.port }}
{% endif %}
@@ -65,17 +66,20 @@ virtual_mailbox_maps = ldap:$config_directory/virtual/mailbox_maps.cf
mailbox_transport_maps = cdb:$config_directory/virtual/reserved_transport_maps
ldap:$config_directory/virtual/transport_lists_maps.cf
-# Pass the client information along to the content filter
+# Don't rewrite remote headers
local_header_rewrite_clients =
+# Pass the client information along to the content filter
smtp_send_xforward_command = yes
+# Avoid splitting the envelope and scanning messages multiple times
smtp_destination_recipient_limit = 1000
+# Tolerate occasional high latency
smtp_data_done_timeout = 1200s
# Tunnel everything through IPSec
smtp_tls_security_level = none
smtp_bind_address = 172.16.0.1
-# Virtual
+# TLS
smtpd_tls_security_level = may
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key