TL;DR
How can I fool my own sendmail into thinking an email comes from a particular ip address, so that it rejects the message due to a DNSBL match?
Details:
I run my own mail server, and most spam is blocked by the DNS black lists (DNSBL) that I've added to /etc/mail/sendmail.mc like so:
dnl FEATURE(`dnsbl',`dnsbl.sorbs.net',`"554 Rejected " $&{client_addr} " found in dnsbl.sorbs.net"')dnl
dnl FEATURE(`dnsbl',`b.barracudacentral.org',`"554 Rejected " $&{client_addr} " found in b.barracudacentral.org"')dnl
Today some spam came in (passing all tests), and after checking MX Toolbox and DNSBL Information could see that adding one of several DNSBLs would have blocked this particular spam.
So, I added another DNSBL, and now I want to test it by resubmitting this email to Sendmail, but therein lies the problem: it won't be coming from the right ip address, and the DNSBL won't see it as bad.
Here's the command I normally would have used:
formail -s /usr/sbin/sendmail -oi -t < testmail.mbox
Before I try to reinvent a wheel, I thought I'd ask here first. Possible ideas:
- Is there a CLI option to sendmail for faking the source ip?
- Maybe craft a queued message file and put it in the queue directly?
- Perhaps set up another ip address on my machine, and send to myself with it?
- Would an OpenVPN or SSH tunnel be a quick fix?
- Possibly a shared library could be loaded to intercept system calls, à la LibFakeTime?
- Dtrace looks powerful, can it alter getsockopt(2) calls like this?
Thanks!