Disable SpamAssassin in Plesk Automation Postfix Mail server

jesse's picture

Using Parallels Plesk Automation 11.1 we needed to add a Postfix Mail server that would sit behind MX Force, an external mail filtering service.

We want to turn off spam scanning for performance, as inbound mail has already been scanned.

Disable SpamAssassin

Navigate to Infrastructure > Service Nodes > {hostname} > Spam Filter Settings.

Uncheck Switch on server-wide SpamAssassin spam filtering at the top and save.
plesk_automation-server_wide_spam_filtering.png
Easy, right? It seemed to be, until load testing the mail server.

Postfix Load Test

We'll use postal to test postfix delivery.

postal -c 3 -s 60 -m 100 -t 4 mail.domain.com test_addrs.txt

Just 16 messages/min.?

Give postal a few minutes to really fill the pipeline and check the delivery rate:  16 message/min. Not Good!

Fire up top and it's clear that SpamAssassin is the problem. It's apparently not quite as "switched off" as we would like it to be.

Remove SpamAssassin

After searching I found some ideas for Plesk panels, but nothing specifically for a PPA Postfix Mail server. They likely run the same software packages, but the configuration appears to be handled differently.

Using what appeared to be the simplest and often repeated advice found, I simply removed spamassassin:

rpm -e psa-spamassassin
service postfix restart

Any Problems?

Checking the maillog for errors, these started scrolling by:

Nov 21 10:59:21 mail1 postfix-local[13136]: handlers_stderr: Mail handler call failed. Error occured during execv(/usr/local/psa/handlers/hooks/spam):#012No such file or directory.
Nov 21 10:59:21 mail1 postfix-local[13137]: Error during 'spam' handler
Nov 21 10:59:21 mail1 postfix/smtpd[13131]: D760B1471C: client=out16.mx25.net[207.210.234.37]
Nov 21 10:59:21 mail1 postfix-local[13136]: PASS during call 'spam' handler
Nov 21 10:59:21 mail1 postfix-local[13136]: Unable to rename '/usr/local/psa/handlers/spool/messageZk4QzQ' file: No such file or directory
Nov 21 10:59:21 mail1 postfix-local[13136]: Unable to open message file: No such file or directory
Nov 21 10:59:21 mail1 postfix/pipe[13135]: A0837ECDF: to=<test1@domain.com>, relay=plesk_virtual, delay=0.4, delays=0.28/0.02/0/0.1, dsn=5.7.1, status=bounced (Message can't be delivered )

And mail is being discarded.

Handle the 'spam' handler

We'll delete references to that 'spam' handler:

echo "delete from handlers where name = 'spam';" | sqlite3 /var/lib/plesk/mail/handlers/handlers.db

That catches all current accounts, but as new email accounts are added they will show up, too. Lets schedule that to keep running hourly:

cat <<EOF >/etc/cron.hourly/remove-spam-handlers
#!/bin/sh
echo "delete from handlers where name = 'spam';" | sqlite3 /var/lib/plesk/mail/handlers/handlers.db
EOF

And lets fake the 'spam' handler so mail delivers until the next cronjob runs:

echo '#!/bin/sh' > /usr/local/psa/handlers/hooks/spam
echo 'exec /bin/echo "SKIP"' >> /usr/local/psa/handlers/hooks/spam
chmod +x /usr/local/psa/handlers/hooks/spam

I'll note this seemed to work on PPA 11.1, but I had problems with the fake handler on PPA 11.5.

Load Test Improved

How about 2,000 messages/min.?

maillog now has no errors, so fire up the load testing. The new delivery rate? 2000 messages/min.!

Much better, that's a number we can live with. On to the next task...

Tags: 

Services: 

Comments

jesse's picture

Fixed in PPA 11.5

I'm testing a Plesk Automation 11.5 setup and this performance issue appears to remain. It's different hardware, on PCS cloud storage, but getting over 4,200 messages/minute after deleting the 'spam' handlers!

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.