From 041d6bb0ce679f42c23bec54969fe91a166f9d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Blanco=20Garc=C3=ADa-Lomas?= Date: Wed, 9 Mar 2016 13:08:52 +0100 Subject: [PATCH 1/4] Make postfix_mynetworks configurable, default to 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 --- defaults/main.yml | 1 + templates/etc/postfix/main.cf.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7b8379e..2525353 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,3 +16,4 @@ postfix_sasl_user: "postmaster@{{ ansible_domain }}" postfix_sasl_password: 'k8+haga4@#pR' postfix_inet_interfaces: all postfix_inet_protocols: all +postfix_mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index 41e8d8b..a8737b5 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -32,7 +32,7 @@ myhostname = {{ postfix_hostname }} alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = {{ postfix_hostname }}, localdomain, localhost, localhost.localdomain -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +mynetworks = {{ postfix_mynetworks }} mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = {{ postfix_inet_interfaces }} From ee9f610f78ff3c0b4cde9ff14e26571fe5389ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Blanco=20Garc=C3=ADa-Lomas?= Date: Wed, 9 Mar 2016 13:14:47 +0100 Subject: [PATCH 2/4] Added postfix_mynetworks to the documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9e4fed4..2d3dd33 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ None * `postfix_hostname` [default: `{{ ansible_fqdn }}`]: Host name, used for `myhostname` and in `mydestination` * `postfix_mailname` [default: `{{ ansible_fqdn }}`]: Mail name (in `/etc/mailname`), used for `myorigin` * `postfix_aliases` [default: `[]`]: Aliases to ensure present in `/etc/aliases` + * `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)) * `postfix_relayhost` [default: `false` (no relay host)]: Hostname to relay all email to From d345c6eb7eaa927e67580ca5ae5f16f91c3f596f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Blanco=20Garc=C3=ADa-Lomas?= Date: Wed, 9 Mar 2016 15:12:48 +0100 Subject: [PATCH 3/4] turned postfix_mynetworks into a list --- defaults/main.yml | 5 ++++- templates/etc/postfix/main.cf.j2 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 2525353..7105f90 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,4 +16,7 @@ postfix_sasl_user: "postmaster@{{ ansible_domain }}" postfix_sasl_password: 'k8+haga4@#pR' postfix_inet_interfaces: all postfix_inet_protocols: all -postfix_mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +postfix_mynetworks: + - 127.0.0.0/8 + - "[::ffff:127.0.0.0]/104" + - "[::1]/128" diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index a8737b5..0570233 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -32,7 +32,7 @@ myhostname = {{ postfix_hostname }} alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = {{ postfix_hostname }}, localdomain, localhost, localhost.localdomain -mynetworks = {{ postfix_mynetworks }} +mynetworks = {{ postfix_mynetworks|join(' ') }} mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = {{ postfix_inet_interfaces }} From 803c10fa83b59f7c83275b7476f677b9555e5c7e Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 9 Mar 2016 15:35:22 +0100 Subject: [PATCH 4/4] Consistency changes --- README.md | 8 ++++---- defaults/main.yml | 4 ++-- templates/etc/postfix/main.cf.j2 | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2d3dd33..c3ff02b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ None * `postfix_hostname` [default: `{{ ansible_fqdn }}`]: Host name, used for `myhostname` and in `mydestination` * `postfix_mailname` [default: `{{ ansible_fqdn }}`]: Mail name (in `/etc/mailname`), used for `myorigin` * `postfix_aliases` [default: `[]`]: Aliases to ensure present in `/etc/aliases` - * `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_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)) * `postfix_relayhost` [default: `false` (no relay host)]: Hostname to relay all email to @@ -38,7 +38,7 @@ A simple example that doesn't use SASL relaying: - postfix vars: postfix_aliases: - - { user: root, alias: you@yourdomain.org } + - { user: root, alias: you@yourdomain.org } ``` Provide the relay host name if you want to enable relaying: @@ -49,7 +49,7 @@ Provide the relay host name if you want to enable relaying: - postfix vars: postfix_aliases: - - { user: root, alias: you@yourdomain.org } + - { user: root, alias: you@yourdomain.org } postfix_relayhost: mail.yourdomain.org ``` @@ -61,7 +61,7 @@ For AWS SES support: - postfix vars: postfix_aliases: - - { user: root, alias: sesverified@yourdomain.org } + - { user: root, alias: sesverified@yourdomain.org } postfix_relayhost: email-smtp.us-east-1.amazonaws.com postfix_relaytls: true # AWS IAM SES credentials (not access key): diff --git a/defaults/main.yml b/defaults/main.yml index 7105f90..024e6ce 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,5 +18,5 @@ postfix_inet_interfaces: all postfix_inet_protocols: all postfix_mynetworks: - 127.0.0.0/8 - - "[::ffff:127.0.0.0]/104" - - "[::1]/128" + - '[::ffff:127.0.0.0]/104' + - '[::1]/128' diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index 0570233..0e79c34 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -32,7 +32,7 @@ myhostname = {{ postfix_hostname }} alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = {{ postfix_hostname }}, localdomain, localhost, localhost.localdomain -mynetworks = {{ postfix_mynetworks|join(' ') }} +mynetworks = {{ postfix_mynetworks | join(' ') }} mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = {{ postfix_inet_interfaces }}