changeset 318:6c89e2c3b5aa

Fix outbound mail IP Moved smtp_bind_address to the place where it makes a difference - the SMTP (not SMTPD) service!
author IBBoard <dev@ibboard.co.uk>
date Sat, 29 Feb 2020 14:08:49 +0000
parents 2a20a5b7f65a
children 6d719622c72f
files modules/postfix/templates/master.cf.epp
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/postfix/templates/master.cf.epp	Sat Feb 29 13:21:01 2020 +0000
+++ b/modules/postfix/templates/master.cf.epp	Sat Feb 29 14:08:49 2020 +0000
@@ -36,7 +36,6 @@
 
 [<%= $mailserver_proxy %>]:smtps     inet  n       -       n       -       -       smtpd
   -o smtpd_upstream_proxy_protocol=haproxy
-  -o smtp_bind_address6=<%= $mailserver_ip %>
   -o smtpd_tls_wrappermode=yes
   -o smtpd_sasl_auth_enable=yes
   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
@@ -44,7 +43,6 @@
 
 [<%= $mailserver_proxy %>]:submission inet n       -       n       -       -       smtpd
   -o smtpd_upstream_proxy_protocol=haproxy
-  -o smtp_bind_address6=<%= $mailserver_ip %>
   -o smtpd_tls_security_level=encrypt
   -o smtpd_sasl_auth_enable=yes
   -o smtpd_client_restrictions=permit_sasl_authenticated,reject
@@ -80,6 +78,11 @@
 proxymap  unix  -       -       n       -       -       proxymap
 proxywrite unix -       -       n       -       1       proxymap
 smtp      unix  -       -       n       -       -       smtp
+  <%- if $mailserver_ip =~ Stdlib::IP::Address::V6 { -%>
+  -o smtp_bind_address6=<%= $mailserver_ip %>
+  <%- } else { -%>
+  -o smtp_bind_address=<%= $mailserver_ip %>
+  <%- } -%>
 # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
 relay     unix  -       -       n       -       -       smtp
 	-o smtp_fallback_relay=