From 4cc656a64154a4230a5d72d61c87ccc63bf55e83 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 11 Jul 2016 13:54:26 +0200 Subject: [PATCH] add spamass-milter --- rootfs/etc/confd/templates/main.cf.tmpl | 2 -- rootfs/etc/confd/templates/master.cf.tmpl | 7 ++++++- rootfs/etc/services.d/spamass-milter/run | 3 --- rootfs/usr/bin/spamfilter | 8 ++++++++ 4 files changed, 14 insertions(+), 6 deletions(-) delete mode 100644 rootfs/etc/services.d/spamass-milter/run create mode 100755 rootfs/usr/bin/spamfilter diff --git a/rootfs/etc/confd/templates/main.cf.tmpl b/rootfs/etc/confd/templates/main.cf.tmpl index f076cc7..6ed8ae7 100644 --- a/rootfs/etc/confd/templates/main.cf.tmpl +++ b/rootfs/etc/confd/templates/main.cf.tmpl @@ -48,11 +48,9 @@ smtpd_sasl_auth_enable = yes smtpd_relay_restrictions = permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination smtpd_milters = - unix:/var/run/spamass-milter/spamass.sock non_smtpd_milters = $smtpd_milters milter_default_action = accept milter_macro_daemon_name = ORIGINATING -milter_connect_macros = "i j {daemon_name} v {if_name} _" message_size_limit = {{getenv "MESSAGESIZELIMIT"}} diff --git a/rootfs/etc/confd/templates/master.cf.tmpl b/rootfs/etc/confd/templates/master.cf.tmpl index fcb28bb..17192a9 100644 --- a/rootfs/etc/confd/templates/master.cf.tmpl +++ b/rootfs/etc/confd/templates/master.cf.tmpl @@ -1,8 +1,9 @@ submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt + -o content_filter=spamfilter -smtp inet n - n - - smtpd +smtp inet n - n - - smtpd -o content_filter=spamfilter pickup unix n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr unix n - n 300 1 qmgr @@ -26,3 +27,7 @@ virtual unix - n n - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache + +spamfilter unix - n n - - pipe + flags=Rq user=postfix argv=/usr/bin/spamfilter ${sender} ${recipient} + \ No newline at end of file diff --git a/rootfs/etc/services.d/spamass-milter/run b/rootfs/etc/services.d/spamass-milter/run deleted file mode 100644 index 35a4329..0000000 --- a/rootfs/etc/services.d/spamass-milter/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/with-contenv sh - -s6-setuidgid postfix spamass-milter -p /var/run/spamass-milter/spamass.sock -- -d spamassassin diff --git a/rootfs/usr/bin/spamfilter b/rootfs/usr/bin/spamfilter new file mode 100755 index 0000000..33a1d23 --- /dev/null +++ b/rootfs/usr/bin/spamfilter @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv sh + +SENDMAIL=/usr/sbin/sendmail +SPAMASSASSIN=/usr/bin/spamc + +${SPAMASSASSIN} -u $1 -d spamassassin | ${SENDMAIL} -oi -f $1 $2 + +exit $?