From 73835a541f83e8009dc05584dbe4a3aad48f5bff Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 13 Jul 2017 10:49:49 +0200 Subject: [PATCH] Make mydestination configurable And remove $mydomain from it (by default) --- README.md | 9 ++++++++- defaults/main.yml | 5 +++++ templates/etc/postfix/main.cf.j2 | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d929d08..18bafe7 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ None * `postfix_aliases` [default: `[]`]: Aliases to ensure present in `/etc/aliases` * `postfix_virtual_aliases` [default: `[]`]: Virtual aliases to ensure present in `/etc/postfix/virtual` * `postfix_sender_canonical_maps` [default: `[]`]: Sender address rewriting in `/etc/postfix/sender_canonical_maps` ([see](http://www.postfix.org/postconf.5.html#sender_canonical_maps)) + * `postfix_mydestination` [default: `["{{ postfix_hostname }}", 'localdomain', 'localhost', 'localhost.localdomain']`]: Specifies what domains this machine will deliver locally, instead of forwarding to another machine * `postfix_mynetworks` [default: `['127.0.0.0/8', '[::ffff:127.0.0.0]/104', '[::1]/128']`]: The list of "trusted" remote SMTP clients that have more privileges than "strangers" * `postfix_inet_interfaces` [default: `all`]: Network interfaces to bind ([see](http://www.postfix.org/postconf.5.html#inet_interfaces)) * `postfix_inet_protocols` [default: `all`]: The Internet protocols Postfix will attempt to use when making or accepting connections ([see](http://www.postfix.org/postconf.5.html#inet_protocols)) @@ -56,7 +57,13 @@ A simple example with virtual aliases for mail forwarding that doesn't use SASL roles: - postfix vars: - - postfix_virtual_aliases: + postfix_mydestination: + - "{{ postfix_hostname }}" + - '$mydomain' + - localdomain + - localhost + - localhost.localdomain + postfix_virtual_aliases: - virtual: webmaster@yourdomain.com alias: personal_email@gmail.com - virtual: billandbob@yourdomain.com diff --git a/defaults/main.yml b/defaults/main.yml index cc47ffc..76dca5f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,6 +20,11 @@ postfix_sasl_password: 'k8+haga4@#pR' postfix_sasl_security_options: noanonymous postfix_inet_interfaces: all postfix_inet_protocols: all +postfix_mydestination: + - "{{ postfix_hostname }}" + - localdomain + - localhost + - localhost.localdomain postfix_mynetworks: - 127.0.0.0/8 - '[::ffff:127.0.0.0]/104' diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index dea2847..9c21e83 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -37,7 +37,7 @@ virtual_alias_maps = hash:/etc/postfix/virtual {% if postfix_sender_canonical_maps %} sender_canonical_maps = hash:/etc/postfix/sender_canonical_maps {% endif %} -mydestination = {{ postfix_hostname }}, $mydomain, localdomain, localhost, localhost.localdomain +mydestination = {{ postfix_mydestination | join(', ') }} mynetworks = {{ postfix_mynetworks | join(' ') }} mailbox_size_limit = 0 recipient_delimiter = +