diff --git a/Dockerfile b/Dockerfile index 4917797..244613d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,7 @@ ENV SMTPD_MILTERS="" ENV NON_SMTPD_MILTERS="\$smtpd_milters" ENV MILTER_DEFAULT_ACTION=accept ENV INTERNAL_MAIL_FILTER_CLASSES=bounce +ENV BOGOFILTER_ENABLE="" # TODO: template access lists diff --git a/confd/conf.d/setup_postscreen.toml b/confd/conf.d/setup_postscreen.toml index 596a74e..f15cb00 100644 --- a/confd/conf.d/setup_postscreen.toml +++ b/confd/conf.d/setup_postscreen.toml @@ -12,4 +12,5 @@ keys = [ "/postscreen/dnsbl/threshold", "/postscreen/dnsbl/whitelist/threshold", "/postscreen/greet/action", +"/bogofilter/enable", ] diff --git a/confd/templates/setup_postscreen.tmpl b/confd/templates/setup_postscreen.tmpl index 1fc9c13..bfdeb93 100644 --- a/confd/templates/setup_postscreen.tmpl +++ b/confd/templates/setup_postscreen.tmpl @@ -52,9 +52,11 @@ postconf -F dnsblog/unix/private=- \ dnsblog/unix/process_limit=0 \ dnsblog/unix/command="dnsblog" - +{{ if eq (getv "/bogofilter/enable") "yes" }} postconf -P smtpd/pass/content_filter=spamfilter - +{{ else }} +postconf -X -P smtpd/pass/content_filter +{{ end }} # FIXME: template tables instead of creating empty files touch /etc/postfix/rules/postscreen_access_list.cidr @@ -81,7 +83,13 @@ postconf -F smtp/inet/private=n \ smtp/inet/wakeup=- \ smtp/inet/process_limit=- \ smtp/inet/command="smtpd" + +{{ if eq (getv "/bogofilter/enable") "yes" }} postconf -P smtp/inet/content_filter=spamfilter +{{ else }} +postconf -X -P smtp/inet/content_filter +{{ end }} + postconf -M# dnsblog/unix {{ end }}