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 (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/' and remember to give execution permission on it.


echo 'X-No-Confirm: yes' >/tmp/spam$$
cat >>/tmp/spam$$
SUBJECT=`grep -a -m1 '^Subject: ' /tmp/spam$$ | cut -d' ' -f2- | tr -d '\n'`
mail -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/"

3. Add lines to

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

nanas	  unix	-	n	n	-	-	pipe
	flags=Rq user=spam argv=/usr/local/bin/

4. Setup

Make sure you already have this in 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