diff --git a/docs/rolereference.rst b/docs/rolereference.rst index e3feaf5a18026ae6fb8accfa602c65ccabd42350..83dc41b1463ebcc6aad3afaec2cb9c79c17292d8 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -601,11 +601,13 @@ Postfix is used SMTP, while Dovecot is used for IMAP. The role implements the following: +* Installs rsync. * Adds the Wheezy backports repository. * Installs and configures Dovecot (from backports), Postfix, ClamAV, and ClamAV Milter. * Purges Exim4 configuration (just in case). * Installs SWAKS (utility for testing SMTP servers). +* Sets-up the necessary directories and files under Postfix chroot. Deployed services are configured as follows: @@ -692,6 +694,12 @@ Parameters **mail_postmaster** (string, mandatory) Mail address to use for the postmaster account in Dovecot. +**smtp_allow_relay_from** (list, mandatory) + List of networks from which mail relaying is allowed even without + authentication. Each item in the list is a string defining a network. The + format must be compatible with Postfix ``mynetworks`` setting (for example: + ``192.168.1.0/24``, ``myhost.example.com`` etc). + Examples ~~~~~~~~ @@ -721,3 +729,7 @@ Here is an example configuration for setting-up XMPP server using Prosody: - bl.spamcop.net - zen.spamhaus.org mail_postmaster: postmaster@example.com + + smtp_allow_relay_from: + - ldap.example.com + - xmpp.example.com diff --git a/roles/mail_server/tasks/main.yml b/roles/mail_server/tasks/main.yml index 9baa464c9e71a7dbd61961412140f9698a194047..f31ab34fe852bc3ada4d011fe20e3541cc861b9d 100644 --- a/roles/mail_server/tasks/main.yml +++ b/roles/mail_server/tasks/main.yml @@ -46,7 +46,7 @@ - /var/spool/postfix/var/run/clamav - name: Copy the LDAP TLS truststore into Postfix chroot - command: rsync -ci "{{ mail_ldap_tls_truststore }}" "/var/spool/postfix/{{ mail_ldap_tls_truststore}}" + command: rsync -pci "{{ mail_ldap_tls_truststore }}" "/var/spool/postfix/{{ mail_ldap_tls_truststore}}" register: rsync_result changed_when: "rsync_result.stdout != ''" diff --git a/roles/mail_server/templates/main.cf.j2 b/roles/mail_server/templates/main.cf.j2 index 6315a8f8237db6f6d4819253f2f068fd1ea73cb5..09e17374e977246fb7bddc5d413f4afe85013fa8 100644 --- a/roles/mail_server/templates/main.cf.j2 +++ b/roles/mail_server/templates/main.cf.j2 @@ -33,7 +33,8 @@ alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = mail.example.com, mail, localhost.localdomain, localhost relayhost = -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128{% for network in smtp_allow_relay_from %} {{ network }}{% endfor %} + mailbox_command = procmail -a "$EXTENSION" mailbox_size_limit = 0 recipient_delimiter = + diff --git a/testsite/group_vars/mail.yml b/testsite/group_vars/mail.yml index 6f1dacffbcbb1e0e9cd45bfc82ee6cc1e61f1dde..5e8fddf1f98f29c0a4baaef8dc5daa936e60a9a6 100644 --- a/testsite/group_vars/mail.yml +++ b/testsite/group_vars/mail.yml @@ -30,4 +30,8 @@ smtp_rbl: - bl.spamcop.net - zen.spamhaus.org -mail_postmaster: postmaster@example.com \ No newline at end of file +mail_postmaster: postmaster@example.com + +smtp_allow_relay_from: + - ldap.example.com + - xmpp.example.com