I have an Ubuntu 22.04 cloud VM with Postfix 3.6.4-1ubuntu1.3 installed that I largely use for receiving e-mails sent to addresses at my personal domain that I provide when signing up for less-important website accounts. In the past few months, one of these addresses has been receiving too many unsolicited e-mails from the same domain that are managing to get through the server's basic spam defenses. I would like to block these e-mails at the Postfix level, and I thought I set things up properly, but the e-mails are still coming through.
The "From" addresses for the spam e-mails all share the same domain — here stupidspammers.example
— and they are all sent (per both the "Received:" headers and the mail logs) from a subdomain of spamgateway.nil
.
I tried to block the e-mails as follows:
I created
/etc/postfix/access
with the following contents:stupidspammers.example REJECT
I ran
sudo postmap hash:/etc/postfix/access
I added the line
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access
to/etc/postfix/main.cf
I restarted Postfix with
sudo systemctl restart postfix
When this setup proved insufficient, I changed the contents of /etc/postfix/access
to spamgateway.nil REJECT
and repeated steps 2 & 4, but the e-mails are still coming through, and I can't figure out what I'm doing wrong.