On Wed, 2016-12-28 at 11:01 +0100, Lukas Erlacher wrote: > I haven't found any documentation that specifies this for > spamc/spamd. > I don't think that passing an email to SA via spamc makes any attempt to strip pre-existing SA headers, but there's an easy way to check:
Find any message that has already been scanned by SA and has the SA headers in place. Use spamc to process it through SA again and examine the message text returned by SA: spamc <test_message | less will do nicely. If the pre-existing SA headers were stripped, you'll see just the expected set of SA headers in the output. If the pre- existing headers were NOT stripped, then at least some[*] of the SA header types will appear twice. The latter is my experience, so long ago I wrote a bash script that cleans out existing SA headers from spam that I'm writing rules against: #!/bin/bash # #Syntax: cleaner [file...] #Function: Remove SA headers from example message(s) # If a list of files is present they are processed. # If no list is supplied, all files in data/* are processed. #Options: none # function clean() { echo "Cleaning $1" gawk ' BEGIN { act = "copy"; body = "no"; } /^[A-Za-z]/ { act = "copy" } /^X-Spam/ { act = "skip" } /^$/ { body = "yes"; } { if (act == "copy" || body == "yes") { print } } ' <$1 >temp.txt mv temp.txt $1 } if [ $# -gt 0 ] then for f in $* do clean $f done else for f in data/*.txt do clean $f done fi Some recent Linuxes have dropped 'gawk' from their command list. If yours is one of them, replace 'gawk' with 'awk' in the script. Awk is a very fast text processing tool, so this script is pretty rapid too. [*] 'at least some' because if the configuration is different between the first and subsequent scans then different sets of SA headers will have been included each time. Martin