I'm running a standard Postfix/Dovecot setup for email. I've got a few email addresses that I get junk from that I want to block (mailing-lists that refuse to remove me from their lists.) So I added
check_sender_access hash:/etc/postfix/sender_access to my smtpd_sender_restrictions line in my /etc/postfix/main.cf file. It is the first rule check in that line. I created a sender_access file in the postfix directory, added the email addresses I wanted to block (blah@spam.com REJECT), and created the sender_access.db file by using postmap sender_access. Restarted postfix.
Emails from these addresses are getting through. So I decided to check it using an email address that I use for graduate school. I added this email and REJECT to the sender_access file, postmap'd it, and restarted postfix. Sent an email from the school account and it gets blocked properly. Huh? Postfix is blocking my school account but not the other email addresses that I put in to the sender_access file. So I figure it must be some sort of issue with the "from" or "reply-to" addresses. Here is a partial header from an email from an address I want to block (with info changed to protect the "innocent"):
(I have added the line
idiot@live.com REJECT to my sender_access file based on the "from" info in the header)
Return-Path: <idiot@live.com>
Delivered-To:
me@myemail.com
Received: from BAY004-OMC4S6.hotmail.com (bay004-omc4s6.hotmail.com [65.54.190.208])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
(Client CN "*.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK))
by mail.myemail.com (Postfix) with ESMTPS id A009A2D0063C
for <mailbox@sallerson.com>; Tue, 29 Mar 2016 09:15:08 -0400 (EDT)
Received: from NAM02-SN1-obe.outbound.protection.outlook.com ([65.54.190.200]) by BAY004-OMC4S6.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008);
Tue, 29 Mar 2016 06:15:01 -0700
Received: from BL2NAM02FT016.eop-nam02.prod.protection.outlook.com
(10.152.76.59) by BL2NAM02HT149.eop-nam02.prod.protection.outlook.com
(10.152.77.241) with Microsoft SMTP Server (TLS) id 15.1.453.6; Tue, 29 Mar
2016 13:15:00 +0000
Received: from CY1PR18MB0662.namprd18.prod.outlook.com (10.152.76.53) by
BL2NAM02FT016.mail.protection.outlook.com (10.152.77.171) with Microsoft SMTP
Server (TLS) id 15.1.453.6 via Frontend Transport; Tue, 29 Mar 2016 13:13:30
+0000
Received: from CY1PR18MB0662.namprd18.prod.outlook.com ([10.164.217.152]) by
CY1PR18MB0662.namprd18.prod.outlook.com ([10.164.217.152]) with mapi id
15.01.0447.023; Tue, 29 Mar 2016 13:13:26 +0000
From: joe blow <idiot@live.com>
Subject: I'm Going To Keep Emailing You Forever
Thread-Topic: I'm Going To Keep Emailing You Forever
Thread-Index: AQHRibwsrq6KCOGy9kGIeGxl0HQDhZ9wZRLe
Date: Tue, 29 Mar 2016 13:13:26 +0000
Message-ID: <B8B29230F390870@CY1PR18MB0662.namprd18.prod.outlook.com>
References: <153c27ddbab-47c-5ca@webprd-m49.mail.aol.com>
In-Reply-To: <153c27ddbab-47c-5ca@webprd-m49.mail.aol.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
X-OriginatorOrg: live.com
Email is still accepted from the address. Why it blocks properly when coming from my school address while still accepting email from the bad addresses is anyone's guess.
Anyone have any ideas? I thought it may have to do with the From or Reply-To fields in the header, but they seem to match what is in the check_sender file.
Thanks,
Brian