# File: spewhosts.rc # Description: procmail script for ISP not relayed through their # own mailservers. # Author: Sean B. Straw # Source: # Copyright: Portions copyright (c) 2000-2003, Sean B. Straw # Disclaimer: # Licensing: Free for use by the procmail community. # Support: Visit the official procmail discussion list to ask # procmail questions. If you need custom procmail # work performed (including modifications to this # rcfile), the author is available for paid consulting. # Limitations: There is no included support for reducing a # host.domain to the base domain. # Requires: egrep (external program) # # # This is a procmail filter intended to identify (using an external datafile) # messages where certain hosts used in the From: address should be paired # with a specific sending host in the Received: headers. # # DO NOT AUTO-SUBMIT MESSAGES TO SPAM DATABASES BASED SOLELY UPON THE # RESULTS OF THIS SCRIPT. # # This file is dependant upon some externally defined variables, and also # utilizes a "SPAMMISHNESS" system described elsewhere in the authors # writings. # ========================================================================== # First, skip this entire process if we're processing a recognized mailing # list. Some strip the received lines, and that renders these checks # invalid. :0 * LISTNAME ?? ^^^^ { # unset SPAMVAL (just in case) SPAMVAL # set a default spamlevel (overridden in the spewhosts.list file) SPAMLEVEL=+100 # Check the envelope first (we need to extract the domain part). :0 * ENVFROM ?? @\/.* { CL_MATCH=$\MATCH :0h WATCHEDMAIL=|egrep -i ^$CL_MATCH[[:space:]] $SPAMDIR/spewhosts.list } # Now, only if WATCHEDMAIL is non-empty :0A * WATCHEDMAIL ?? ^[-_\.a-z0-9]+[ ]+[-+=0-9]+[ ]+\/[^ ].* * 1^0 * $ -1^1 ^Received:.*\>by\>+[-_\.a-z0-9]*${MATCH} { # extract spammishness from the WATCHEDMAIL string :0 * WATCHEDMAIL ?? ^[-_\.a-z0-9]+[ ]+\/[-+=0-9]+ * 9876543210^0 MATCH ?? ^\/[-+0-9]+ * 9876543210^0 MATCH ?? ^\/ { SPAMVAL="${MATCH:-$SPAMLEVEL}" } SPAMMISHNESS="${SPAMMISHNESS}${SPAMVAL}" SPAMNOTES="${SPAMNOTES}SPAM: ${SPAMVAL} From service doesn't appear in Received lines${NL}" } # then, From: - ONLY IF DIFFERENT from the envelope # (no need to double-penalize a sender for ACTUALLY sending mail # from the same address as their From:) :0 * $ ! ENVFROM ?? ^^$\CLEANFROM^^ * ! FROM_DOMAIN ?? ^^^^ { CL_MATCH=$\FROM_DOMAIN :0h WATCHEDMAIL=|egrep -i ^$CL_MATCH[[:space:]] $SPAMDIR/spewhosts.list } # Now, only if WATCHEDMAIL is non-empty :0A * WATCHEDMAIL ?? ^[-_\.a-z0-9]+[ ]+[-+=0-9]+[ ]+\/[^ ].* * 1^0 * $ -1^1 ^Received:.*\>by\>+[-_\.a-z0-9]*${MATCH} { # extract spammishness from the WATCHEDMAIL string :0 * WATCHEDMAIL ?? ^[-_\.a-z0-9]+[ ]+\/[-+=0-9]+ * 9876543210^0 MATCH ?? ^\/[-+0-9]+ * 9876543210^0 MATCH ?? ^\/ { SPAMVAL="${MATCH:-$SPAMLEVEL}" } SPAMMISHNESS="${SPAMMISHNESS}${SPAMVAL}" SPAMNOTES="${SPAMNOTES}SPAM: ${SPAMVAL} From service doesn't appear in Received lines${NL}" } } # ========================================================================== # The module which includes this one should take action based on variables # which are set in the recipes above.