aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-08-23 19:16:53 +0100
committerGravatar Joe Banks <[email protected]>2024-08-24 19:07:07 +0100
commitad6c05d33b35f1e1ac90f7d280a6a30f9fa3a43c (patch)
tree15d7fd9e1305595c99e5ce074e22e571ad341400
parentRun spamassassin role on mail hosts (diff)
Run inbound mail through spamassassin
-rw-r--r--ansible/roles/postfix/tasks/main.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/ansible/roles/postfix/tasks/main.yml b/ansible/roles/postfix/tasks/main.yml
index 9723276..f647c24 100644
--- a/ansible/roles/postfix/tasks/main.yml
+++ b/ansible/roles/postfix/tasks/main.yml
@@ -134,6 +134,16 @@
tags:
- role::postfix
+- name: Pass inbound mail through spamassassin content filter
+ lineinfile:
+ path: /etc/postfix/master.cf
+ insertafter: "smtp inet n - y - - smtpd"
+ line: " -o content_filter=spamassassin"
+ tags:
+ - role::postfix
+ notify:
+ - Restart postfix
+
- name: Add custom services to master.cf
blockinfile:
path: /etc/postfix/master.cf
@@ -164,6 +174,11 @@
-o smtpd_sasl_path=private/auth
-o cleanup_service_name=authcleanup
+ # spamassassin filtering
+ spamassassin unix - n n - - pipe
+ user=spamd argv=/usr/bin/spamc -f -e
+ /usr/sbin/sendmail -oi -f ${sender} ${recipient}
+
# authenticated submission cleanup
authcleanup unix n - y - 0 cleanup
-o header_checks=pcre:/etc/postfix/header-checks-submission