Only allow mail to subdomains
As a form of spam-blocking, a friend and i came up with a solution for my box. Basically, there are two rules.
1) Block all external mail from reaching my domain. E.G. anything sent to *@example.com is rejected.
2) Reroute all mail to subdomains to the local user of the same name:
All local mail still routes properly, with no need for the sub-domain. And, this has removed all the spam i used to get, as thankfully, spambots that check random hosts do not seem to check subdomains.
To accomplish this, MX records were added for the sub-domain, and exim-4 was installed. The following two modifications were made:
file: /etc/exim4/conf.d/acl/30exim4-configcheck_rcpt
Added:
deny
domains = example.com
This rules blocked all external incoming mail to the domain.
Then we created the following file:
/etc/exim4/conf.d/ rewrite/99exim4-configexample_rewriting
And added the rule:
\N^.*@([^.]+).example.com\N $
This works beautifully.
This now allows me to give any email address to anybody i want. Should i get spammed to a specific address, just blacklist it. If i get random spam, i may need to switch to a whitelist. I sure hope that doesn't happen.
To finish my setup, i'm using cyrus and squirellmail.
I would like to make a modification somewhere, if possible. I want to have to "To:" header to be the incoming address. That is, if John Doe emails me, i may give him the address
3 Replies
A number of ISPs allow this sort of thing. It doesn't stop spamming, and indeed can act as a spam magnet. All it needs is for "bob.example.invalid" to get into a spam list (eg you've signed up to a service and they sell your address; a usenet post; a reference on a web site; something!) and for a wildcard spammer to try
Panix Internet (new york's oldest independent ISP) does something similar and they do see wildcard spam for these domains. Not so much as on their primary domain, but some.
A nice side effect of this sort of configuration is that you can give out different addresses to different people (eg
I have been doing this for just over a year now, and it looks like a good setup.
I am worried about wildcard spamming, but i am assuming i can switch to a white-list at that point.
We just started looking at adding a new header like X-Original-To or X-Envelope-To to refer to the envelope's "To" header.
The problem is, as he explained after looking at it, since the "To" header has been rewritten, the filters don't seem to be able to grab the original. And the rewrites themselves don't have the ability to add the header.
The question is, is there a way in exim to rewrite to envelope's TO and store the original TO in a header in the message?