From ad6c05d33b35f1e1ac90f7d280a6a30f9fa3a43c Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 23 Aug 2024 19:16:53 +0100 Subject: Run inbound mail through spamassassin --- ansible/roles/postfix/tasks/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ansible') 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 -- cgit v1.2.3