Mauro Torrez 1a3a46a003
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
automatically run postmap_all on startup
2020-04-20 22:55:33 -03:00

74 lines
3.9 KiB
Bash

#!/bin/bash
# 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
{{ with getv "/mydestination" }}postconf mydestination='{{.}}'{{ end }}
{{ with getv "/myhostname" }}postconf myhostname='{{.}}'{{ end }}
{{ with getv "/mydomain" }}postconf mydomain='{{.}}'{{ end }}
{{ with getv "/mynetworks" }}postconf mynetworks='{{.}}'{{ end }}
{{ with getv "/mynetworks/style" }}postconf mynetworks_style='{{.}}'{{ end }}
{{ with getv "/virtual/alias/maps" }}postconf virtual_alias_maps='{{.}}'{{ end }}
{{ with getv "/virtual/mailbox/maps" }}postconf virtual_mailbox_maps='{{.}}'{{ end }}
{{ with getv "/virtual/transport" }}postconf virtual_transport='{{.}}'{{ end }}
{{ with getv "/virtual/mailbox/domains" }}postconf virtual_mailbox_domains='{{.}}'{{ end }}
{{ with getv "/smtpd/sasl/path" }}postconf smtpd_sasl_path='{{.}}'{{ end }}
{{ with getv "/smtpd/sasl/type" }}postconf smtpd_sasl_type='{{.}}'{{ end }}
{{ with getv "/smtpd/sasl/auth/enable" }}postconf smtpd_sasl_auth_enable='{{.}}'{{ end }}
{{ with getv "/smtpd/tls/cert/file" }}postconf smtpd_tls_cert_file='{{.}}'{{ end }}
{{ with getv "/smtpd/tls/key/file" }}postconf smtpd_tls_key_file='{{.}}'{{ end }}
{{ with getv "/smtp/tls/security/level" }}postconf smtp_tls_security_level='{{.}}'{{ end }}
{{ with getv "/smtpd/tls/security/level" }}postconf smtpd_tls_security_level='{{.}}'{{ end }}
{{ with getv "/smtpd/tls/auth/only" }}postconf smtpd_tls_auth_only='{{.}}'{{ end }}
{{ with getv "/smtpd/tls/session/cache/database" }}postconf smtpd_tls_session_cache_database='{{.}}'{{ end }}
{{ with getv "/smtpd/client/restrictions" }}postconf smtpd_client_restrictions='{{.}}'{{ end }}
{{ with getv "/smtpd/data/restrictions" }}postconf smtpd_data_restrictions='{{.}}'{{ end }}
{{ with getv "/smtpd/helo/restrictions" }}postconf smtpd_helo_restrictions='{{.}}'{{ end }}
{{ with getv "/smtpd/relay/restrictions" }}postconf smtpd_relay_restrictions='{{.}}'{{ end }}
{{ with getv "/smtpd/recipient/restrictions" }}postconf smtpd_recipient_restrictions='{{.}}'{{ end }}
{{ with getv "/message/size/limit" }}postconf message_size_limit='{{.}}'{{ end }}
{{ with getv "/smtpd/helo/required" }}postconf smtpd_helo_required='{{.}}'{{ end }}
{{ with getv "/biff" }}postconf biff='{{.}}'{{ end }}
postconf -M spamfilter/unix | grep -q spamfilter || {
postconf -M spamfilter/unix="spamfilter unix - n n - - pipe"
}
postconf -F spamfilter/unix/private=- \
spamfilter/unix/unprivileged=n \
spamfilter/unix/chroot=n \
spamfilter/unix/wakeup=- \
spamfilter/unix/process_limit=- \
spamfilter/unix/command='pipe flags=Rq user=vmail argv=/usr/local/bin/spamfilter -oi -f ${sender} ${recipient}'
# run postmap for all lookup tables
postmap_all