# SB2.RC # # Called by sb.rc if critical variable check succeeds and email is # not oversized. # # Set LINEBUF to high figure to accomodate large recipes. # # NOTE: This was in the variables section, but it turns out that # the "Oversized Email" recipe was crashing for some people because # of an inadequate LINEBUF. So I moved it here. # OLDLINEBUF=${LINEBUF} LINEBUF=65552 # DEBUG # # If running in Debug mode, set VERBOSE appropriately. # :0 * SBCONFIG ?? Debug { OLDVERBOSE=${VERBOSE} VERBOSE=yes } # Since some versions of Procmail limit LINEBUF to 32776, check # to see if the higher setting "took", and if it didn't, set to # 32776. # :0 * ! LINEBUF ?? 65552 { LINEBUF=32776 } # Check for and set system variables. (These should be set already, # but just in case... :0 * HOST ?? ^^^^ { HOST=`hostname` } :0 * LOGNAME ?? ^^^^ { LOGNAME=someuser } # Set other internal variables to their initial states. ADMINTAG=no ASNLOG='null' BLOCKTAG=no BLOCKTHIS=no BOUNCETHIS=no BULKTAG=no CLEANBODY='null' COMPLETEWHOISLOG='null' DANGEROUS=no LOCALBUFFER='null' LOCALBUFFER2='null' LOCALDOMAIN='example.com' LOCALERROR='no' LOCALHOST='host.example.com' LOCALIP='000.000.000.000' LOCALMIMEBDRY='null' LOCALNOBODY='no' LOCALPID='null' LOCALTAG=no LT2=no RHEADER=NULL SBIDENTIFIED=no SBSCORE=0 SBSPAMCOPHANDSHAKE='000.000.000.000' SPAMCOPQUALIFY=20 TESTLAST='00000000' TESTUPDATED='00000000' TESTCIDR='null' TESTCIDR2='null' TESTDOMAINS='null' SPAMMERID=unidentified TESTNAME='null' TESTPATTERNS='null' TESTSCORE='0' TESTTYPE=ALL SPAMTAG=no STRING='null' VIRUSTAG=no WHITELISTED=no HD1=no HD2=no HD3=no HD4=no HD5=no HD6=no HD7=no RDNSSERVER='localhost' RDNSNAME=NULL RDNSRESPONSE='000.000.000.000' RDNSSCORE='0' RDNSNAME1=NULL RDNSRESPONSE1='000.000.000.000' RDNSSCORE1='0' RDNSNAME2=NULL RDNSRESPONSE2='000.000.000.000' RDNSSCORE2='0' RDNSNAME3=NULL RDNSRESPONSE3='000.000.000.000' RDNSSCORE3='0' RDNSNAME4=NULL RDNSRESPONSE4='000.000.000.000' RDNSSCORE4='0' RDNSNAME5=NULL RDNSRESPONSE5='000.000.000.000' RDNSSCORE5='0' RDNSNAME6=NULL RDNSRESPONSE6='000.000.000.000' RDNSSCORE6='0' RDNSNAME7=NULL RDNSRESPONSE7='000.000.000.000' RDNSSCORE7='0' RDNSNAME8=NULL RDNSRESPONSE8='000.000.000.000' RDNSSCORE8='0' RDNSNAME9=NULL RDNSRESPONSE9='000.000.000.000' RDNSSCORE9='0' RDNSNAME10=NULL RDNSRESPONSE10='000.000.000.000' RDNSSCORE10='0' RDNSNAME11=NULL RDNSRESPONSE11='000.000.000.000' RDNSSCORE11='0' RDNSNAME12=NULL RDNSRESPONSE12='000.000.000.000' RDNSSCORE12='0' # Email header info extraction variables. # FIRSTEXDOMAIN='example.com' FIRSTEXHOST='host.example.com' FIRSTEXIP='000.000.000.000' FIRSTEXIPREGEXP='000.000.000.000' FIRSTEXREVIP='000.000.000.000' FIRSTEXHELO='host.example.com' FIRSTEXHELOIP='000.000.000.000' FIRSTEXHELOREVIP='000.000.000.000' FIRSTEXHELOREVIPREGEXP='000.000.000.000' FIRSTEXHELODOMAIN='example.com' FIRSTEXTODOMAIN='example.com' FIRSTEXTOHOST='host.example.com' SECONDEXDOMAIN='example.com' SECONDEXHOST='host.example.com' SECONDEXIP='000.000.000.000' SECONDEXIPREGEXP='000.000.000.000' SECONDEXREVIP='000.000.000.000' SECONDEXHELO='host.example.com' SECONDEXHELOIP='000.000.000.000' SECONDEXHELOREVIP='000.000.000.000' SECONDEXHELOREVIPREGEXP='000.000.000.000' SECONDEXHELODOMAIN='example.com' SECONDEXTODOMAIN='example.com' SECONDEXTOHOST='host.example.com' THIRDEXDOMAIN='example.com' THIRDEXHOST='host.example.com' THIRDEXIP='000.000.000.000' THIRDEXIPREGEXP='000.000.000.000' THIRDEXREVIP='000.000.000.000' THIRDEXHELO='host.example.com' THIRDEXHELOIP='000.000.000.000' THIRDEXHELOREVIP='000.000.000.000' THIRDEXHELOREVIPREGEXP='000.000.000.000' THIRDEXHELODOMAIN='example.com' THIRDEXTODOMAIN='example.com' THIRDEXTOHOST='host.example.com' FOURTHEXDOMAIN='example.com' FOURTHEXHOST='host.example.com' FOURTHEXIP='000.000.000.000' FOURTHEXIPREGEXP='000.000.000.000' FOURTHEXREVIP='000.000.000.000' FOURTHEXHELO='host.example.com' FOURTHEXHELOIP='000.000.000.000' FOURTHEXHELOREVIP='000.000.000.000' FOURTHEXHELOREVIPREGEXP='000.000.000.000' FOURTHEXHELODOMAIN='example.com' FOURTHEXTODOMAIN='example.com' FOURTHEXTOHOST='host.example.com' FROMDOMAIN='example.com' FROMEMAIL='noemail@example.com' FROMHOST='host.example.com' FROMLOGON='noemail' MAILFROMDOMAIN='example.com' MAILFROMHOST='host.example.com' ERRORDOMAIN='example.com' ERRORHOST='host.example.com' REPLYTODOMAIN='example.com' REPLYTOEMAIL='noemail@example.com' REPLYTOHOST='host.example.com' REPLYTOLOGON='noemail' TODOMAIN='example.com' TOEMAIL='noemail@example.com' TOHOST='example.com' TOLOGON='noemail' XORIGINALIP='000.000.000.000' XORIGINALIPREGEXP='000.000.000.000' XORIGINALREVIP='000.000.000.000' # Email message body info extraction variables. # FIRSTBODYDOMAIN='example.com' FIRSTBODYHOST='host.example.com' FIRSTBODYHOSTIP='000.000.000.000' FIRSTBODYHOSTIPREGEXP='000.000.000.000' FIRSTBODYHOSTREVIP='000.000.000.000' FIRSTBODYIP='000.000.000.000' FIRSTBODYIPREGEXP='000.000.000.000' FIRSTBODYREVIP='000.000.000.000' SECONDBODYDOMAIN='example.com' SECONDBODYHOST='host.example.com' SECONDBODYHOSTIP='000.000.000.000' SECONDBODYHOSTIPREGEXP='000.000.000.000' SECONDBODYHOSTREVIP='000.000.000.000' SECONDBODYIP='000.000.000.000' SECONDBODYIPREGEXP='000.000.000.000' SECONDBODYREVIP='000.000.000.000' THIRDBODYDOMAIN='example.com' THIRDBODYHOST='host.example.com' THIRDBODYHOSTIP='000.000.000.000' THIRDBODYHOSTIPREGEXP='000.000.000.000' THIRDBODYHOSTREVIP='000.000.000.000' THIRDBODYIP='000.000.000.000' THIRDBODYIPREGEXP='000.000.000.000' THIRDBODYREVIP='000.000.000.000' FOURTHBODYDOMAIN='example.com' FOURTHBODYHOST='host.example.com' FOURTHBODYHOSTIP='000.000.000.000' FOURTHBODYHOSTIPREGEXP='000.000.000.000' FOURTHBODYHOSTREVIP='000.000.000.000' FOURTHBODYIP='000.000.000.000' FOURTHBODYIPREGEXP='000.000.000.000' FOURTHBODYREVIP='000.000.000.000' FIFTHBODYDOMAIN='example.com' FIFTHBODYHOST='host.example.com' FIFTHBODYHOSTIP='000.000.000.000' FIFTHBODYHOSTIPREGEXP='000.000.000.000' FIFTHBODYHOSTREVIP='000.000.000.000' FIFTHBODYIP='000.000.000.000' FIFTHBODYIPREGEXP='000.000.000.000' FIFTHBODYREVIP='000.000.000.000' SIXTHBODYDOMAIN='example.com' SIXTHBODYHOST='host.example.com' SIXTHBODYHOSTIP='000.000.000.000' SIXTHBODYHOSTIPREGEXP='000.000.000.000' SIXTHBODYHOSTREVIP='000.000.000.000' SIXTHBODYIP='000.000.000.000' SIXTHBODYIPREGEXP='000.000.000.000' SIXTHBODYREVIP='000.000.000.000' SEVENTHBODYDOMAIN='example.com' SEVENTHBODYHOST='host.example.com' SEVENTHBODYHOSTIP='000.000.000.000' SEVENTHBODYHOSTIPREGEXP='000.000.000.000' SEVENTHBODYHOSTREVIP='000.000.000.000' SEVENTHBODYIP='000.000.000.000' SEVENTHBODYIPREGEXP='000.000.000.000' SEVENTHBODYREVIP='000.000.000.000' # METACONFIGURATION # # Test for the meta-configuration variables (variables that affect other # configuration), and set to safe defaults if not set or not set properly. # SBSYSCHECK # # Checks for the specific type of Unix your server is running. # If you've set a specific value for SBSYSCHCK, that will be # used in setting default names and locations of other programs # the SpamBouncer uses, and other system-specific settings. # You can still manually tweak everything; this metavariable # simply makes it easier to configure the SpamBouncer for # specific types of systems. # :0 * SBSYSCHECK ?? ^(FreeBSD|Linux|NetBSD|OpenBSD|OSX|Solaris|SunOS)$ { SBSYSCHECK=${SBSYSCHECK} } :0 E { SBSYSCHECK=Generic } # SBCONFIG # # Sets an appropriate default base configuration for the type of # use you specify. Valid configuration settings are: # # * Default -- The default, appropriate for general single-user # use with neither particularly careful/conservative nor # particularly aggressive settings. # # * Analyze -- Runs the SpamBouncer as an analysis tool on a # spamtrap account, intended to spot specific spam by specific # spammers. Analyze mode takes lots of CPU time, generates # complete headers (verbose -- looonngg), and is not suited # to users who are just trying to filter their mailboxes. :) # # * Debug -- Runs the SpamBouncer through every possible recipe # on all email it sees, uses verbose Procmail logs to log the # whole thing. *VERY* expensive in CPU time and disk space, # only to be used briefly to diagnose problems. (Most users # will never need this setting.) # # * Lite -- Runs the SpamBouncer with settings optimized for # low CPU/memory use and quick operation. # # * Site -- Runs the SpamBouncer with the proper settings for a # sitewide installation where it is called before email is # delivered to end users. In Site mode, the SpamBouncer filters # email, but does not try to deliver it. Certain recipes that # have a higher risk of false positives on non-whitelisted email # are turned off. Complaints and notifications are disabled. # :0 * SBCONFIG ?? ^(Analyze|Debug|Lite|Site)$ { SBCONFIG=${SBCONFIG} } :0 E { SBCONFIG=Default } # SYSTEM AND SPAMBOUNCER VARIABLE SANITY CHECKING # # Check the system and then SpamBouncer variable settings and set # the appropriate defaults if the user hasn't explicitly set them. :0 * SBSYSCHECK ?? (Solaris|SunOS) { INCLUDERC=${SBDIR}/sb-sys-default-solaris.rc } :0 E { INCLUDERC=${SBDIR}/sb-sys-default.rc } INCLUDERC=${SBDIR}/sb-config-default.rc # Get the current date. # SBTODAY=`${DATE} "+%Y%m%d"` # Initialize logging levels # see the file "docs/loglevel.txt" for more information. -GE INCLUDERC=${SBDIR}/functions/initloglevel.rc :0 * SBLOGLEVEL ?? [1-9] { SBLOGFLAGS="LOG 1" SBLOG="SpamBouncer: ${SBVERSION}" #SBLOG="L1-SpamBouncer: ${SBVERSION}" INCLUDERC=${SBDIR}/functions/loglevel.rc SBLOGFLAGS="LOG 2" SBLOG="Entering file: ${SBDIR}/sb.rc with SBLOGLEVEL=${SBLOGLEVEL} SBHEADERS=${SBHEADERS}" #SBLOG="L2-Entering file: ${SBDIR}/sb.rc with SBLOGLEVEL=${SBLOGLEVEL} SBHEADERS=${SBHEADERS}" INCLUDERC=${SBDIR}/functions/loglevel.rc SBLOGFLAGS="LOG 1" SBLOG="Processing Message-ID: ${SBMESSAGEID}" #SBLOG="L1-Processing Message-ID: ${SBMESSAGEID}" INCLUDERC=${SBDIR}/functions/loglevel.rc } # Loglevel Test for debugging -GE # Normally off. # :0 * SBLOGLEVELTEST ?? yes { INCLUDERC=${SBDIR}/tests/logleveltest.rc } # Check for LARGE messages # LEANTAG=no :0 * LEAN ?? yes * > 250000 { SBLOGFLAGS="ALWAYS 1 PASS" SBLOG="Oversize-LeanTagged" #SBLOG="A1P-Oversize-LeanTagged" INCLUDERC=${SBDIR}/functions/loglevel.rc :0 { LEANTAG=yes } } # CHECK FOR GENUINE BOUNCES, ADMINISTRATIVIA # # Nuke bounces to the SpamBouncer's own spam complaints, bounces, or block # notifications. LOCALTAG=no # Bounces to SpamBouncer Complaints :0 * ^FROM_MAILER { :0 B * $ ^X-Loop: (${NOLOOP}|MAILER-DAEMON) * ^X-SpamBouncer: { SBLOGFLAGS="ALWAYS 1 PASS" SBLOG="Bounced SpamBouncer Complaint/Notice" #SBLOG="A1P-Bounced SpamBouncer Complaint/Notice" INCLUDERC=${SBDIR}/functions/loglevel.rc :0 * NUKEBOUNCES ?? yes /dev/null :0 { ADMINTAG=yes } :0 { LOCALTAG=yes } } } # Responses that quote the SpamBouncer complaint. :0 B * $ ^[^0-9a-z]*X-Loop: (${NOLOOP}|MAILER-DAEMON) * ^[^0-9a-z]*X-SpamBouncer: { SBLOGFLAGS="ALWAYS 1 PASS" SBLOG="Response to SpamBouncer Complaint/Notice" #SBLOG="A1P-Response to SpamBouncer Complaint/Notice" INCLUDERC=${SBDIR}/functions/loglevel.rc :0 { ADMINTAG=yes } :0 { LOCALTAG=yes } } :0 * SBCONFIG ?? Debug { LOCALTAG=no } # Start of "else" wrapper so that bounces and autobot replies bypass other filters. :0 * LOCALTAG ?? no { INCLUDERC=${SBDIR}/sb3.rc } # End of :0 E wrapper around BOUNCESANDSTUFF INCLUDERC=${SBDIR}/functions/final-tagging.rc :0 * SBDELIVERY ?? ^FILE$ { INCLUDERC=${SBDIR}/functions/delivery.rc } :0 * SBDELIVERY ?? ^MH$ { INCLUDERC=${SBDIR}/functions/delivery-mh.rc } :0 * SBDELIVERY ?? ^SPAMTRAP$ { INCLUDERC=${SBDIR}/functions/delivery-spamtrap.rc } LINEBUF=${OLDLINEBUF} # If running in Debug mode, return Verbose setting # to what it used to be. # :0 * SBCONFIG ?? Debug { VERBOSE=${OLDVERBOSE} } SBLOGFLAGS="LOG 1" SBLOG="Leaving SpamBouncer: ${SBVERSION}" #SBLOG="L1-Leaving SpamBouncer: ${SBVERSION}" INCLUDERC=${SBDIR}/functions/loglevel.rc