Updated: 2024/03/21

Install, start and enable required package:
dnf install spamassassin
systemctl enable spamassassin
systemctl start spamassassin

Create spamd user:
adduser spamd --user-group -s /bin/false

Modify /etc/postfix/master.cf:
#smtp      inet  n       -       n       -       -       smtpd
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamfilter

spamfilter  unix -        n       n       -       -       pipe
    user=spamd argv=/usr/bin/spamc -f -e
    /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Restart postfix:
systemctl restart postfix

Configure /etc/mail/spamassassin/local.cf:
required_hits 5
report_safe 0
rewrite_header Subject [SPAM] (_SCORE_)
add_header ham HAM-Report _REPORT_
whitelist_from *@domain.com *@domain.net


Home > Build Procedures > Postfix SMTP gateway for Exchange on Rocky 9