#!/bin/bash
# Version 1.08a
# IMPORTANT! Edit the TRUSTED_RULESETS line to choose which RuleSets to update
TRUSTED_RULESETS="SARE_CODING SARE_HEADER SARE_SPECIFIC EVILNUMBERS SARE_ADULT SARE_BML SARE_FRAUD SARE_SPOOF SARE_OEM SARE_RANDOM SARE_GENLSUBJ SARE_REDIRECT SARE_UNSUB";
SA_DIR="/etc/mail/spamassassin"; # Change this to your SA local config
# directory, probably /etc/mail/spamassassin.
# For amavisd chrooted, this may be:
# /var/amavisd/etc/mail/spamassassin
MAIL_ADDRESS="[email protected]"; # Where do Email notifications go
SINGLE_EMAIL_ONLY="true"; # Send only one notification email per run
SA_LINT="spamassassin --lint"; # Command used to lint spamassassin
SA_RESTART="/etc/init.d/psa-spamassassin; # Command used to restart spamd
#/etc/init.d/spamassassin restart"; # Command used to restart spamd
# May be /etc/rc.d/init.d/spamassassin restart
# For amavisd, may be /etc/init.d/amavisd restart
WGET="wget -N" # Location (and flags) of the wget program
PERL="perl"; # Location of the perl program
MAILCMD="mail"; # Location of the mail program that supports the -s flag
GREP="grep"; # Location of the grep program
# (solaris users may want to point this to gnu grep)
RULES_DU_JOUR_SCRIPT="/root/bin/rules_du_jour"; # Where the full rules_du_jour script is located
DONT_CHECK_FOR_RDJ_UPDATES= # Set this to "true" to skip checking for
# updates to the Rules Du Jour script itself
#### End Local Settings ####
# These are bash Array Variables ("man bash" for more information)
declare -a CF_URLS; declare -a CF_FILES; declare -a CF_NAMES;
declare -a PARSE_NEW_VER_SCRIPTS; declare -a CF_MUNGE_SCRIPTS;
############################################
#### Begin Personal Rules File Registry ####
############################################
# If you add more RuleSets to your own registry, please contribute the settings to the [url]www.exit0.us[/url] wiki
# [url]http://www.exit0.us/index.php/RulesDuJourRuleSets[/url]
# IMPORTANT:
# To avoid conflicts between your own registry and the standard
# registry (distributed with the rules_du_jour script), I recommend that you
# start your personal registry index numbers at 1000 or greater.
#### Here is a (fictional) sample of a custom ruleset: FOOBAR. ####
FOOBAR=1000; # Index of FooBar data into the arrays is 1000
CF_URLS[1000]="http://sandgnat.com/rdj/foobar.404.cf";
CF_FILES[1000]="foobar.cf";
CF_NAMES[1000]="Foo's Bar";
PARSE_NEW_VER_SCRIPTS[1000]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | tail -1";
BARBAZ=1001; # Index of BarBaz data into the arrays is 1001
CF_URLS[1001]="http://sandgnat.com/rdj/barbaz.404.cf";
CF_FILES[1001]="barbaz.cf";
CF_NAMES[1001]="Bar's Baz";
PARSE_NEW_VER_SCRIPTS[1001]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | tail -1";
#
# RulesDuJour Personal Rule for sare_genlsubj
# add this snippet to rules_du_jour, my_rules_du_jour or /etc/rulesdujour
# to the Personal Rules section
# adjust the index numbers if they conflict with your personal ones.
#
# in case of trouble contact: [email][email protected][/email]
#### Here are settings for single sare_genlsubj* files ####
SARE_GENLSUBJ0=1113;
CF_URLS[1113]="http://www.rulesemporium.com/rules/70_sare_genlsubj0.cf"
CF_FILES[1113]="70_sare_genlsubj0.cf";
CF_NAMES[1113]="SARE General Subject Ruleset 0 for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1113]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1113]="nothing for this ruleset.";
SARE_GENLSUBJ1=1114;
CF_URLS[1114]="http://www.rulesemporium.com/rules/70_sare_genlsubj1.cf"
CF_FILES[1114]="70_sare_genlsubj1.cf";
CF_NAMES[1114]="SARE General Subject Ruleset 1 for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1114]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1114]="nothing for this ruleset.";
SARE_GENLSUBJ2=1115;
CF_URLS[1115]="http://www.rulesemporium.com/rules/70_sare_genlsubj2.cf"
CF_FILES[1115]="70_sare_genlsubj2.cf";
CF_NAMES[1115]="SARE General Subject Ruleset 2 for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1115]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1115]="nothing for this ruleset.";
SARE_GENLSUBJ3=1116;
CF_URLS[1116]="http://www.rulesemporium.com/rules/70_sare_genlsubj3.cf"
CF_FILES[1116]="70_sare_genlsubj3.cf";
CF_NAMES[1116]="SARE General Subject Ruleset 3 for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1116]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1116]="nothing for this ruleset.";
SARE_GENLSUBJ_ARC=1117;
CF_URLS[1117]="http://www.rulesemporium.com/rules/70_sare_genlsubj_arc.cf"
CF_FILES[1117]="70_sare_genlsubj_arc.cf";
CF_NAMES[1117]="SARE genlsubj arc Ruleset for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1117]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
# CF_MUNGE_SCRIPTS[1117]="nothing for this ruleset.";
SARE_GENLSUBJ_ENG=1118;
CF_URLS[1118]="http://www.rulesemporium.com/rules/70_sare_genlsubj_eng.cf"
CF_FILES[1118]="70_sare_genlsubj_eng.cf";
CF_NAMES[1118]="SARE genlsubj eng Ruleset for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1118]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
# CF_MUNGE_SCRIPTS[1118]="nothing for this ruleset.";
#### Here are settings for sare_genlsubj ####
SARE_GENLSUBJ=1119;
CF_URLS[1119]="http://www.rulesemporium.com/rules/70_sare_genlsubj.cf"
CF_FILES[1119]="70_sare_genlsubj.cf";
CF_NAMES[1119]="SARE genlsubj Ruleset for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1119]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
# CF_MUNGE_SCRIPTS[1119]="nothing for this ruleset.";
#fin
# RulesDuJour Personal Rule for sare_redirect
# add this snippet to rules_du_jour, my_rules_du_jour or /etc/rulesdujour
# to the Personal Rules section
# adjust the index numbers if they conflict with your personal ones.
#
# in case of trouble contact: [email][email protected][/email]
#### Here are settings for sare_redirect pre 3.0.0 version####
#### Enable munge to activate ham rules
SARE_REDIRECT=1101;
CF_URLS[1101]="http://www.rulesemporium.com/rules/71_sare_redirect_pre3.0.0.cf"
CF_FILES[1101]="71_sare_redirect_pre3.0.0.cf";
CF_NAMES[1101]="SARE Abused Redirect Subject Ruleset for SpamAssassin (pre3.0.0)";
PARSE_NEW_VER_SCRIPTS[1101]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1101]="sed -e s/#+#//g";
#### Here are settings for sare_redirect post 3.0.0 version ####
#### Enable munge to activate ham rules
SARE_REDIRECT_POST300=1102;
CF_URLS[1102]="http://www.rulesemporium.com/rules/72_sare_redirect_post3.0.0.cf"
CF_FILES[1102]="72_sare_redirect_post3.0.0.cf";
CF_NAMES[1102]="SARE Abused Redirect Subject Ruleset for SpamAssassin (post3.0.0)";
PARSE_NEW_VER_SCRIPTS[1102]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | sort | tail -1";
# CF_MUNGE_SCRIPTS[1102]="sed -e s/#+#//g";
#fin
#
# RulesDuJour Personal Rule for sare_unsub
# add this snippet to rules_du_jour, my_rules_du_jour or /etc/rulesdujour
# to the Personal Rules section
# adjust the index numbers if they conflict with your personal ones.
#
# in case of trouble contact: [email][email protected][/email]
#### Here are settings for sare_unsub ####
SARE_UNSUB=1121; # Index of sare_unsub data into the arrays is 1121
CF_URLS[1121]="http://www.rulesemporium.com/rules/70_sare_unsub.cf"
CF_FILES[1121]="70_sare_unsub.cf";
CF_NAMES[1121]="SARE unsub Ruleset for SpamAssassin";
PARSE_NEW_VER_SCRIPTS[1121]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
# CF_MUNGE_SCRIPTS[1121]="nothing for this ruleset.";
#fin
############################################
#### End Personal Rules File Registry ####
############################################
# This command invokes the standard rules_du_jour script
[ -f "${RULES_DU_JOUR_SCRIPT}" ] && \
. ${RULES_DU_JOUR_SCRIPT} || \
echo "ERROR: could not find rules_du_jour at configured path: ${RULES_DU_JOUR_SCRIPT}";