Forwarding spam to nanas and FTC

WARNING: This is probably quite a bad idea for a domain that actually have some valuable/confidential mail going thru, so be careful.

Guide to forwarding spam automatically to news.admin.net-abuse.sightings (group homepage, google archive) and United States of America Federal Trade Commission with help of Postfix and SpamAssassin.

1. Install forwarding script

Following script will forward the spam. Place it to '/usr/local/bin/forward-to-nanas.sh' and remember to give execution permission on it.

#!/bin/sh

echo 'X-No-Confirm: yes' >/tmp/spam$$
cat >>/tmp/spam$$
SUBJECT=`grep -a -m1 '^Subject: ' /tmp/spam$$ | cut -d' ' -f2- | tr -d '\n'`
mail nanas@killfile.org spam@uce.gov -s "[email] $SUBJECT" </tmp/spam$$
chmod a+rw /tmp/spam$$

2. Add user

Add user account 'spam' to system. Remember to add following alias either to ~spam/.forward or aliases file. This way spammers spamming your spam account will get their spam published right away. ;-)

spam:           "|/usr/local/bin/forward-to-nanas.sh"

3. Add lines to master.cf

After this you must add following lines to the end of master.cf file.

nanas	  unix	-	n	n	-	-	pipe
	flags=Rq user=spam argv=/usr/local/bin/forward-to-nanas.sh

4. Setup main.cf

Make sure you already have this in main.cf file:

header_checks = regexp:/etc/postfix/header_checks

and '/etc/postfix/header_checks' file includes this:

/^X-Spam-Flag: YES$/i FILTER nanas:dummy

5. You are done!

Did you remember issue 'postfix reload'? Ok, your 'X-Spam-Flag: YES' header tagged spam is now forwarded to spam databases.


Petri T. Koistinen

last modified: Sunday, 07-Sep-2008 00:09:44 EEST