Running Postfix on Ubuntu 22.04, I'd like to make sure all outgoing mail originating from the server (eg mail forms on websites and stuff) is filtered for spam and malware. I'm using Amavis, which is filtering inbound, but not outbound.
For example, if I try to send an EICAR test out like this:
echo "$email_message" | mailx -a "From:My name <[email protected]>" -s "EICAR test" [email protected]
I see this in the log (Gmail blocks it but not Amavis):
Oct 30 08:26:08 servername.uk postfix/pickup[1912445]: 60743BA7BC: uid=1000 from=<[email protected]>
Oct 30 08:26:08 servername.uk postfix/cleanup[1919542]: 60743BA7BC: message-id=<[email protected]>
Oct 30 08:26:08 servername.uk postfix/qmgr[1412608]: 60743BA7BC: from=<[email protected]>, size=461, nrcpt=1 (queue active)
Oct 30 08:26:09 servername.uk postfix/smtp[1919543]: 60743BA7BC: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c04::1a]:25, delay=0.64, delays=0.06/0/0.18/0.4, dsn=5.7.0, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:400c:c04::1a] said: 552-5.7.0 This message was blocked because its content presents a potential 552-5.7.0 security issue. Please visit 552-5.7.0 https://support.google.com/mail/?p=BlockedMessage to review our 552 5.7.0 message content and attachment content guidelines. v21-20020a05600c471500b0040641a9f008si5224346wmo.224 - gsmtp (in reply to end of DATA command))
I see it's using the postfix/pickup
service, whereas the Amavis service is on postfix/smtp
. Can I add an Amavis filter to pickup
? How do I do that?
EDIT: It occurs to me that "mail forms on websites and stuff" may involve some other technique (so may be a separate question), but either way I'd like to have local mail filtered.