diff --git a/rootfs/etc/confd/templates/main.cf.tmpl b/rootfs/etc/confd/templates/main.cf.tmpl index cfb4139..eedbc8b 100644 --- a/rootfs/etc/confd/templates/main.cf.tmpl +++ b/rootfs/etc/confd/templates/main.cf.tmpl @@ -29,3 +29,4 @@ non_smtpd_milters = $smtpd_milters milter_default_action = accept milter_connect_macros = "i j {daemon_name} v {if_name} _" message_size_limit = {{getenv "MESSAGESIZELIMIT"}} +sender_dependent_default_transport_maps = hash:/etc/postfix/sender-transport diff --git a/rootfs/etc/confd/templates/master.cf.tmpl b/rootfs/etc/confd/templates/master.cf.tmpl index b88064e..dc8199a 100644 --- a/rootfs/etc/confd/templates/master.cf.tmpl +++ b/rootfs/etc/confd/templates/master.cf.tmpl @@ -1,24 +1,19 @@ -{{range $mailhosts := split (getenv "MAILHOSTS") ";"}} -{{$values := split ($mailhosts) ":"}} -{{index $values 0}}:smtp inet n - - - - smtpd - -o myhostname={{index $values 1}} - -o smtpd_tls_key_file=/etc/ssl/mail/{{index $values 1}}/privkey.pem - -o smtpd_tls_cert_file=/etc/ssl/mail/{{index $values 1}}//fullchain.pem +smtp inet n - - - - smtpd + -o myhostname={{getenv "MYDOMAIN"}} + -o smtpd_tls_key_file=/etc/ssl/mail/privkey.pem + -o smtpd_tls_cert_file=/etc/ssl/mail/fullchain.pem -{{index $values 1}}-out unix - - - - - smtp - -o smtp_bind_address={{index $values 0}} - -o smtp_helo_name={{index $values 2}} - -o syslog_name=postfix-{{index $values 2}} +{{getenv "MYDOMAIN"}}-out unix - - - - - smtp + -o smtp_helo_name={{getenv "MYHOSTNAME"}} -{{index $values 0}}:submission inet n - - - - smtpd +submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_relay_restrictions=permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination -o milter_macro_daemon_name=ORIGINATING - -o smtpd_tls_key_file=/etc/ssl/mail/{{index $values 1}}/privkey.pem - -o smtpd_tls_cert_file=/etc/ssl/mail/{{index $values 1}}//fullchain.pem -{{end}} + -o smtpd_tls_key_file=/etc/ssl/mail/privkey.pem + -o smtpd_tls_cert_file=/etc/ssl/mail/fullchain.pem smtp inet n - n - - smtpd pickup unix n - n 60 1 pickup diff --git a/rootfs/etc/confd/templates/sender-transport.tmpl b/rootfs/etc/confd/templates/sender-transport.tmpl new file mode 100644 index 0000000..abb7743 --- /dev/null +++ b/rootfs/etc/confd/templates/sender-transport.tmpl @@ -0,0 +1 @@ +@{{getenv "MYDOMAIN"}} {{getenv "MYDOMAIN"}}-out \ No newline at end of file diff --git a/rootfs/etc/cont-init.d/02-sender-transport b/rootfs/etc/cont-init.d/02-sender-transport new file mode 100644 index 0000000..85027a2 --- /dev/null +++ b/rootfs/etc/cont-init.d/02-sender-transport @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv sh + +postmap /etc/postfix/sender-transport diff --git a/tmp b/tmp deleted file mode 100644 index fa0cc7f..0000000 --- a/tmp +++ /dev/null @@ -1,21 +0,0 @@ -{{range $mailhosts := split (getenv "MAILHOSTS") ";"}} -{{$values := split ($mailhosts) ":"}} -{{index $values 0}}:smtp inet n - - - - smtpd - -o myhostname={{index $values 1}} - -o smtpd_tls_key_file=/etc/ssl/mail/{{index $values 1}}/privkey.pem - -o smtpd_tls_cert_file=/etc/ssl/mail/{{index $values 1}}//fullchain.pem - -{{index $values 1}}-out unix - - - - - smtp - -o smtp_bind_address={{index $values 0}} - -o smtp_helo_name={{index $values 2}} - -o syslog_name=postfix-{{index $values 2}} - -{{index $values 0}}:submission inet n - - - - smtpd - -o syslog_name=postfix/submission - -o smtpd_tls_security_level=encrypt - -o smtpd_sasl_auth_enable=yes - -o smtpd_relay_restrictions=permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination - -o milter_macro_daemon_name=ORIGINATING - -o smtpd_tls_key_file=/etc/ssl/mail/{{index $values 1}}/privkey.pem - -o smtpd_tls_cert_file=/etc/ssl/mail/{{index $values 1}}//fullchain.pem -{{end}} \ No newline at end of file