From 4d2a676a5a883d3a2fa66478d3b74bf2704c7feb Mon Sep 17 00:00:00 2001 From: Christophe Guychard Date: Fri, 12 Aug 2022 18:38:40 +0200 Subject: [PATCH 1/2] Add support for smtp_bind_address* parameters --- README.md | 4 +++- defaults/main.yml | 2 ++ templates/etc/postfix/main.cf.j2 | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4f0dfa..8a71b34 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ None * `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_smtp_ipv6_bind` [default: empty]: Outbound network interfaces to use (IpV6) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address6)) +* `postfix_smtp_ipv4_bind` [default: `all`]: Outbound network interfaces to use (IpV4) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address)) +* * `postfix_relayhost` [default: `''` (no relay host)]: Hostname to relay all email to * `postfix_relayhost_mxlookup` [default: `false` (not using mx lookup)]: Lookup for MX record instead of A record for relayhost * `postfix_relayhost_port` [default: 587]: Relay port (on `postfix_relayhost`, if set) diff --git a/defaults/main.yml b/defaults/main.yml index 0ae3c00..9b6fba0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -43,6 +43,8 @@ postfix_smtp_tls_wrappermode: false postfix_smtp_tls_note_starttls_offer: true postfix_inet_interfaces: all +postfix_smtp_ipv6_bind: '' +postfix_smtp_ipv4_bind: all postfix_inet_protocols: all postfix_mydestination: - "{{ postfix_hostname }}" diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index 0ca384e..1e3340c 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -66,6 +66,12 @@ inet_interfaces = {{ postfix_inet_interfaces }} {% else %} inet_interfaces = {{ postfix_inet_interfaces | join(', ') }} {% endif %} +{% if postfix_smtp_ipv4_bind %} +smtp_bind_address = {{ postfix_smtp_ipv4_bind }} +{% endif %} +{% if postfix_smtp_ipv6_bind %} +smtp_bind_address6 = {{ postfix_smtp_ipv6_bind }} +{% endif %} {% if postfix_inet_protocols is string %} inet_protocols = {{ postfix_inet_protocols }} {% else %} From 5778da8587123e3383bb99ee5de6265c1e5787f5 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 20 Mar 2024 17:05:00 +0100 Subject: [PATCH 2/2] Add support for smtp_bind_address* parameters --- README.md | 6 +++--- defaults/main.yml | 2 -- templates/etc/postfix/main.cf.j2 | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3da2ebc..23857c3 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ None * `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_smtp_ipv6_bind` [default: empty]: Outbound network interfaces to use (IpV6) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address6)) -* `postfix_smtp_ipv4_bind` [default: `all`]: Outbound network interfaces to use (IpV4) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address)) -* + * `postfix_smtp_ipv4_bind` [optional]: Outbound network interfaces to use (IPv4) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address)) + * `postfix_smtp_ipv6_bind` [optional]: Outbound network interfaces to use (IPv6) ([see](http://www.postfix.org/postconf.5.html#smtp_bind_address6)) + * `postfix_relayhost` [default: `''` (no relay host)]: Hostname to relay all email to * `postfix_relayhost_mxlookup` [default: `false` (not using mx lookup)]: Lookup for MX record instead of A record for relayhost * `postfix_relayhost_port` [default: 587]: Relay port (on `postfix_relayhost`, if set) diff --git a/defaults/main.yml b/defaults/main.yml index 318be77..7ff626f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -44,8 +44,6 @@ postfix_smtp_tls_wrappermode: false postfix_smtp_tls_note_starttls_offer: true postfix_inet_interfaces: all -postfix_smtp_ipv6_bind: '' -postfix_smtp_ipv4_bind: all postfix_inet_protocols: all postfix_mydestination: - "{{ postfix_hostname }}" diff --git a/templates/etc/postfix/main.cf.j2 b/templates/etc/postfix/main.cf.j2 index 110e86c..eaecaf3 100644 --- a/templates/etc/postfix/main.cf.j2 +++ b/templates/etc/postfix/main.cf.j2 @@ -88,10 +88,10 @@ inet_interfaces = {{ postfix_inet_interfaces }} {% else %} inet_interfaces = {{ postfix_inet_interfaces | join(', ') }} {% endif %} -{% if postfix_smtp_ipv4_bind %} +{% if postfix_smtp_ipv4_bind is defined %} smtp_bind_address = {{ postfix_smtp_ipv4_bind }} {% endif %} -{% if postfix_smtp_ipv6_bind %} +{% if postfix_smtp_ipv6_bind is defined %} smtp_bind_address6 = {{ postfix_smtp_ipv6_bind }} {% endif %} {% if postfix_inet_protocols is string %}