diff --git a/templates/start.d/setup_main b/templates/start.d/setup_main index abac0b0..01fc04a 100644 --- a/templates/start.d/setup_main +++ b/templates/start.d/setup_main @@ -1,95 +1,68 @@ #!/bin/bash set -e +# Managing main.cf: +# postconf [-dfhHnopvx] [-c config_dir] [-C class,...] [parameter ...] +# postconf [-epv] [-c config_dir] parameter=value ... +# postconf -# [-pv] [-c config_dir] parameter ... +# postconf -X [-pv] [-c config_dir] parameter ... + +# Managing master.cf service entries: +# postconf -M [-fovx] [-c config_dir] [service[/type] ...] +# postconf -M [-ev] [-c config_dir] service/type=value ... +# postconf -M# [-v] [-c config_dir] service/type ... +# postconf -MX [-v] [-c config_dir] service/type ... + +# Managing master.cf service fields: +# postconf -F [-fhHovx] [-c config_dir] [service[/type[/field]] ...] +# postconf -F [-ev] [-c config_dir] service/type/field=value ... + +# Managing master.cf service parameters: +# postconf -P [-fhHovx] [-c config_dir] [service[/type[/parameter]] ...] +# postconf -P [-ev] [-c config_dir] service/type/parameter=value ... +# postconf -PX [-v] [-c config_dir] service/type/parameter ... + +# Managing bounce message templates: +# postconf -b [-v] [-c config_dir] [template_file] +# postconf -t [-v] [-c config_dir] [template_file] + +# Managing TLS features: +# postconf -T mode [-v] [-c config_dir] + +# Managing other configuration: +# postconf -a|-A|-l|-m [-v] [-c config_dir] + postconf maillog_file=/dev/stdout postconf alias_maps=hash:/etc/aliases -{{- if getenv "BIFF" }} -postconf biff='{{ getenv "BIFF" }}' -{{- end }} -{{- if getenv "MESSAGE_SIZE_LIMIT" }} -postconf message_size_limit='{{ getenv "MESSAGE_SIZE_LIMIT" }}' -{{- end }} -{{- if getenv "MYDESTINATION" }} -postconf mydestination='{{ getenv "MYDESTINATION" }}' -{{- end }} -{{- if getenv "MYDOMAIN" }} -postconf mydomain='{{ getenv "MYDOMAIN" }}' -{{- end }} -{{- if getenv "MYHOSTNAME" }} -postconf myhostname='{{ getenv "MYHOSTNAME" }}' -{{- end }} -{{- if getenv "MYNETWORKS" }} -postconf mynetworks='{{ getenv "MYNETWORKS" }}' -{{- end }} -{{- if getenv "MYNETWORKS_STYLE" }} -postconf mynetworks_style='{{ getenv "MYNETWORKS_STYLE" }}' -{{- end }} -{{- if getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }} -postconf propagate_unmatched_extensions='{{ getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }}' -{{- end }} -{{- if getenv "RECIPIENT_DELIMITER" }} -postconf recipient_delimiter='{{ getenv "RECIPIENT_DELIMITER" }}' -{{- end }} -{{- if getenv "SMTP_TLS_SECURITY_LEVEL" }} -postconf smtp_tls_security_level='{{ getenv "SMTP_TLS_SECURITY_LEVEL" }}' -{{- end }} -{{- if getenv "SMTPD_CLIENT_RESTRICTIONS" }} -postconf smtpd_client_restrictions='{{ getenv "SMTPD_CLIENT_RESTRICTIONS" }}' -{{- end }} -{{- if getenv "SMTPD_DATA_RESTRICTIONS" }} -postconf smtpd_data_restrictions='{{ getenv "SMTPD_DATA_RESTRICTIONS" }}' -{{- end }} -{{- if getenv "SMTPD_HELO_REQUIRED" }} -postconf smtpd_helo_required='{{ getenv "SMTPD_HELO_REQUIRED" }}' -{{- end }} -{{- if getenv "SMTPD_HELO_RESTRICTIONS" }} -postconf smtpd_helo_restrictions='{{ getenv "SMTPD_HELO_RESTRICTIONS" }}' -{{- end }} -{{- if getenv "SMTPD_RECIPIENT_RESTRICTIONS" }} -postconf smtpd_recipient_restrictions='{{ getenv "SMTPD_RECIPIENT_RESTRICTIONS" }}' -{{- end }} -{{- if getenv "SMTPD_RELAY_RESTRICTIONS" }} -postconf smtpd_relay_restrictions='{{ getenv "SMTPD_RELAY_RESTRICTIONS" }}' -{{- end }} -{{- if getenv "SMTPD_SASL_AUTH_ENABLE" }} -postconf smtpd_sasl_auth_enable='{{ getenv "SMTPD_SASL_AUTH_ENABLE" }}' -{{- end }} -{{- if getenv "SMTPD_SASL_PATH" }} -postconf smtpd_sasl_path='{{ getenv "SMTPD_SASL_PATH" }}' -{{- end }} -{{- if getenv "SMTPD_SASL_TYPE" }} -postconf smtpd_sasl_type='{{ getenv "SMTPD_SASL_TYPE" }}' -{{- end }} -{{- if getenv "SMTPD_TLS_AUTH_ONLY" }} -postconf smtpd_tls_auth_only='{{ getenv "SMTPD_TLS_AUTH_ONLY" }}' -{{- end }} -{{- if getenv "SMTPD_TLS_CERT_FILE" }} -postconf smtpd_tls_cert_file='{{ getenv "SMTPD_TLS_CERT_FILE" }}' -{{- end }} -{{- if getenv "SMTPD_TLS_KEY_FILE" }} -postconf smtpd_tls_key_file='{{ getenv "SMTPD_TLS_KEY_FILE" }}' -{{- end }} -{{- if getenv "SMTPD_TLS_SECURITY_LEVEL" }} -postconf smtpd_tls_security_level='{{ getenv "SMTPD_TLS_SECURITY_LEVEL" }}' -{{- end }} -{{- if getenv "SMTPD_TLS_SESSION_CACHE_DATABASE" }} -postconf smtpd_tls_session_cache_database='{{ getenv "SMTPD_TLS_SESSION_CACHE_DATABASE" }}' -{{- end }} -{{- if getenv "SMTPUTF8_ENABLE" }} -postconf smtputf8_enable='{{ getenv "SMTPUTF8_ENABLE" }}' -{{- end }} -{{- if getenv "VIRTUAL_ALIAS_MAPS" }} -postconf virtual_alias_maps='{{ getenv "VIRTUAL_ALIAS_MAPS" }}' -{{- end }} -{{- if getenv "VIRTUAL_MAILBOX_DOMAINS" }} -postconf virtual_mailbox_domains='{{ getenv "VIRTUAL_MAILBOX_DOMAINS" }}' -{{- end }} -{{- if getenv "VIRTUAL_MAILBOX_MAPS" }} -postconf virtual_mailbox_maps='{{ getenv "VIRTUAL_MAILBOX_MAPS" }}' -{{- end }} -{{- if getenv "VIRTUAL_TRANSPORT" }} -postconf virtual_transport='{{ getenv "VIRTUAL_TRANSPORT" }}' -{{- end }} +{{ with getenv "BIFF" }}postconf biff='{{.}}'{{ end }} +{{ with getenv "MESSAGE_SIZE_LIMIT" }}postconf message_size_limit='{{.}}'{{ end }} +{{ with getenv "MYDESTINATION" }}postconf mydestination='{{.}}'{{ end }} +{{ with getenv "MYDOMAIN" }}postconf mydomain='{{.}}'{{ end }} +{{ with getenv "MYHOSTNAME" }}postconf myhostname='{{.}}'{{ end }} +{{ with getenv "MYNETWORKS" }}postconf mynetworks='{{.}}'{{ end }} +{{ with getenv "MYNETWORKS_STYLE" }}postconf mynetworks_style='{{.}}'{{ end }} +{{ with getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }}postconf propagate_unmatched_extensions='{{.}}'{{ end }} +{{ with getenv "RECIPIENT_DELIMITER" }}postconf recipient_delimiter='{{.}}'{{ end }} +{{ with getenv "SMTP_TLS_SECURITY_LEVEL" }}postconf smtp_tls_security_level='{{.}}'{{ end }} +{{ with getenv "SMTPD_CLIENT_RESTRICTIONS" }}postconf smtpd_client_restrictions='{{.}}'{{ end }} +{{ with getenv "SMTPD_DATA_RESTRICTIONS" }}postconf smtpd_data_restrictions='{{.}}'{{ end }} +{{ with getenv "SMTPD_HELO_REQUIRED" }}postconf smtpd_helo_required='{{.}}'{{ end }} +{{ with getenv "SMTPD_HELO_RESTRICTIONS" }}postconf smtpd_helo_restrictions='{{.}}'{{ end }} +{{ with getenv "SMTPD_RECIPIENT_RESTRICTIONS" }}postconf smtpd_recipient_restrictions='{{.}}'{{ end }} +{{ with getenv "SMTPD_RELAY_RESTRICTIONS" }}postconf smtpd_relay_restrictions='{{.}}'{{ end }} +{{ with getenv "SMTPD_SASL_AUTH_ENABLE" }}postconf smtpd_sasl_auth_enable='{{.}}'{{ end }} +{{ with getenv "SMTPD_SASL_PATH" }}postconf smtpd_sasl_path='{{.}}'{{ end }} +{{ with getenv "SMTPD_SASL_TYPE" }}postconf smtpd_sasl_type='{{.}}'{{ end }} +{{ with getenv "SMTPD_TLS_AUTH_ONLY" }}postconf smtpd_tls_auth_only='{{.}}'{{ end }} +{{ with getenv "SMTPD_TLS_CERT_FILE" }}postconf smtpd_tls_cert_file='{{.}}'{{ end }} +{{ with getenv "SMTPD_TLS_KEY_FILE" }}postconf smtpd_tls_key_file='{{.}}'{{ end }} +{{ with getenv "SMTPD_TLS_SECURITY_LEVEL" }}postconf smtpd_tls_security_level='{{.}}'{{ end }} +{{ with getenv "SMTPD_TLS_SESSION_CACHE_DATABASE" }}postconf smtpd_tls_session_cache_database='{{.}}'{{ end }} +{{ with getenv "SMTPUTF8_ENABLE" }}postconf smtputf8_enable='{{.}}'{{ end }} +{{ with getenv "VIRTUAL_ALIAS_MAPS" }}postconf virtual_alias_maps='{{.}}'{{ end }} +{{ with getenv "VIRTUAL_MAILBOX_DOMAINS" }}postconf virtual_mailbox_domains='{{.}}'{{ end }} +{{ with getenv "VIRTUAL_MAILBOX_MAPS" }}postconf virtual_mailbox_maps='{{.}}'{{ end }} +{{ with getenv "VIRTUAL_TRANSPORT" }}postconf virtual_transport='{{.}}'{{ end }} postconf -M spamfilter/unix | grep -q spamfilter || { postconf -M spamfilter/unix="spamfilter unix - n n - - pipe"