Refactor: gomplate + debian 13 #1

Merged
mauro merged 5 commits from feature/debian-13-gomplate-refactor into main 2026-01-18 03:51:53 +00:00
Showing only changes of commit 5581eecbab - Show all commits

View File

@@ -1,95 +1,68 @@
#!/bin/bash #!/bin/bash
set -e 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 maillog_file=/dev/stdout
postconf alias_maps=hash:/etc/aliases postconf alias_maps=hash:/etc/aliases
{{- if getenv "BIFF" }} {{ with getenv "BIFF" }}postconf biff='{{.}}'{{ end }}
postconf biff='{{ getenv "BIFF" }}' {{ with getenv "MESSAGE_SIZE_LIMIT" }}postconf message_size_limit='{{.}}'{{ end }}
{{- end }} {{ with getenv "MYDESTINATION" }}postconf mydestination='{{.}}'{{ end }}
{{- if getenv "MESSAGE_SIZE_LIMIT" }} {{ with getenv "MYDOMAIN" }}postconf mydomain='{{.}}'{{ end }}
postconf message_size_limit='{{ getenv "MESSAGE_SIZE_LIMIT" }}' {{ with getenv "MYHOSTNAME" }}postconf myhostname='{{.}}'{{ end }}
{{- end }} {{ with getenv "MYNETWORKS" }}postconf mynetworks='{{.}}'{{ end }}
{{- if getenv "MYDESTINATION" }} {{ with getenv "MYNETWORKS_STYLE" }}postconf mynetworks_style='{{.}}'{{ end }}
postconf mydestination='{{ getenv "MYDESTINATION" }}' {{ with getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }}postconf propagate_unmatched_extensions='{{.}}'{{ end }}
{{- end }} {{ with getenv "RECIPIENT_DELIMITER" }}postconf recipient_delimiter='{{.}}'{{ end }}
{{- if getenv "MYDOMAIN" }} {{ with getenv "SMTP_TLS_SECURITY_LEVEL" }}postconf smtp_tls_security_level='{{.}}'{{ end }}
postconf mydomain='{{ getenv "MYDOMAIN" }}' {{ with getenv "SMTPD_CLIENT_RESTRICTIONS" }}postconf smtpd_client_restrictions='{{.}}'{{ end }}
{{- end }} {{ with getenv "SMTPD_DATA_RESTRICTIONS" }}postconf smtpd_data_restrictions='{{.}}'{{ end }}
{{- if getenv "MYHOSTNAME" }} {{ with getenv "SMTPD_HELO_REQUIRED" }}postconf smtpd_helo_required='{{.}}'{{ end }}
postconf myhostname='{{ getenv "MYHOSTNAME" }}' {{ with getenv "SMTPD_HELO_RESTRICTIONS" }}postconf smtpd_helo_restrictions='{{.}}'{{ end }}
{{- end }} {{ with getenv "SMTPD_RECIPIENT_RESTRICTIONS" }}postconf smtpd_recipient_restrictions='{{.}}'{{ end }}
{{- if getenv "MYNETWORKS" }} {{ with getenv "SMTPD_RELAY_RESTRICTIONS" }}postconf smtpd_relay_restrictions='{{.}}'{{ end }}
postconf mynetworks='{{ getenv "MYNETWORKS" }}' {{ with getenv "SMTPD_SASL_AUTH_ENABLE" }}postconf smtpd_sasl_auth_enable='{{.}}'{{ end }}
{{- end }} {{ with getenv "SMTPD_SASL_PATH" }}postconf smtpd_sasl_path='{{.}}'{{ end }}
{{- if getenv "MYNETWORKS_STYLE" }} {{ with getenv "SMTPD_SASL_TYPE" }}postconf smtpd_sasl_type='{{.}}'{{ end }}
postconf mynetworks_style='{{ getenv "MYNETWORKS_STYLE" }}' {{ with getenv "SMTPD_TLS_AUTH_ONLY" }}postconf smtpd_tls_auth_only='{{.}}'{{ end }}
{{- end }} {{ with getenv "SMTPD_TLS_CERT_FILE" }}postconf smtpd_tls_cert_file='{{.}}'{{ end }}
{{- if getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }} {{ with getenv "SMTPD_TLS_KEY_FILE" }}postconf smtpd_tls_key_file='{{.}}'{{ end }}
postconf propagate_unmatched_extensions='{{ getenv "PROPAGATE_UNMATCHED_EXTENSIONS" }}' {{ with getenv "SMTPD_TLS_SECURITY_LEVEL" }}postconf smtpd_tls_security_level='{{.}}'{{ end }}
{{- end }} {{ with getenv "SMTPD_TLS_SESSION_CACHE_DATABASE" }}postconf smtpd_tls_session_cache_database='{{.}}'{{ end }}
{{- if getenv "RECIPIENT_DELIMITER" }} {{ with getenv "SMTPUTF8_ENABLE" }}postconf smtputf8_enable='{{.}}'{{ end }}
postconf recipient_delimiter='{{ getenv "RECIPIENT_DELIMITER" }}' {{ with getenv "VIRTUAL_ALIAS_MAPS" }}postconf virtual_alias_maps='{{.}}'{{ end }}
{{- end }} {{ with getenv "VIRTUAL_MAILBOX_DOMAINS" }}postconf virtual_mailbox_domains='{{.}}'{{ end }}
{{- if getenv "SMTP_TLS_SECURITY_LEVEL" }} {{ with getenv "VIRTUAL_MAILBOX_MAPS" }}postconf virtual_mailbox_maps='{{.}}'{{ end }}
postconf smtp_tls_security_level='{{ getenv "SMTP_TLS_SECURITY_LEVEL" }}' {{ with getenv "VIRTUAL_TRANSPORT" }}postconf virtual_transport='{{.}}'{{ end }}
{{- 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 }}
postconf -M spamfilter/unix | grep -q spamfilter || { postconf -M spamfilter/unix | grep -q spamfilter || {
postconf -M spamfilter/unix="spamfilter unix - n n - - pipe" postconf -M spamfilter/unix="spamfilter unix - n n - - pipe"