0

I'm trying to set up an MX server using Postfix, postscreen and SpamAssassin.

According to the SpamAssassin documentation, I have to add -o content_filter to the smtp service in master.cf. This works with the default settings for Postfix, which is to use the smtpd command:

# SpamAssassin works:
smtp      inet  n       -       y       -       -       smtpd
  -o content_filter=spamassassin
spamassassin unix -     n       n       -       -       pipe
  user=spamd argv=/usr/local/bin/spamc -f -e  
  /usr/sbin/sendmail -oi -f ${sender} ${recipient}

But I also want to use postscreen. In order to use Postscreen, the smtpd command has to be replaced with the postscreen command. When I do that, postscreen works, but SpamAssassin stops working.

# SpamAssassin does not work:
smtp      inet  n       -       y       -       -       postscreen
  -o content_filter=spamassassin
spamassassin unix -     n       n       -       -       pipe
  user=spamd argv=/usr/local/bin/spamc -f -e  
  /usr/sbin/sendmail -oi -f ${sender} ${recipient}

It appears that the postscreen command does not respect the -o flag? When I set content_filter in main.cf it works, but then I have to disable it for all other services than postscreen, that would get really messy in master.cf because i'd have to add -o to all other services.


What is the best way to use both postscreen and SpamAssassin?

jornane
  • 1,096
  • 1
  • 8
  • 25

1 Answers1

1

I don't know which documentation you use. In my case, I have in the master file :

smtp      inet  n       -       y       -       1       postscreen

In the main.cf, I have :

postscreen_greet_action = enforce 
smtpd_milters = unix:/spamass/spamass.sock

So the mail is taken by postscreen, and if it pass it, go in spammassassin by using the milter.

Dom
  • 6,628
  • 1
  • 19
  • 24
  • I hadn't found `smtpd_milters`. That could be a good solution, because then I only need to override the submission service. I'll try this, thanks! – jornane May 16 '22 at 12:45
  • After trying a lot of different things, I found that the spamassassin socket is not the same as the spamass-milter socket. With that piece of information, setting up SpamAssassin was a breeze. Thank you :) – jornane May 18 '22 at 08:08