#!/usr/local/bin/bash
# Version 1.29b (1.29b: fixed SARE_STOCKS url) Changed ZMI_GERMAN url to its new location
# TODO: add auto-cleanup of old rulesets
##########################
## This file is Copyright 2003-2005 Chris Thielen (cmt-spamassassin
## <at> someone.dhs.org) See the end of the file for the complete license.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##########################
## This script updates SpamAssassin RuleSet files from the internet.
##
## It is important that you *only* automatically update
## RuleSet files from sources that you trust and that you
## always *TEST* your configurations.
##
## Rules du Jour will NOTIFY you when new versions of Rules du Jour are
## released, but does NOT AUTOMATICALLY UPGRADE itself.
## Note: When running this script interactively, debug mode is enabled to allow you to view the results.
# Usage instructions:
# 1) Create a configuration file at /etc/rulesdujour/config
# 2) Choose rulesets to update (copy TRUSTED_RULESETS from below to your config file, then edit)
# 3) Configure Local settings in your config file (SA_DIR, MAIL_ADDRESS, SA_RESTART from below)
# 4) Make this script executable (chmod +x rules_du_jour)
# 5) Run this script periodically (manually or via crontab)
# 5a) To run manually, simply execute (./rules_du_jour)
# 5b) To run via cron, edit your cron (crontab -e) and add a line such as this:
# 28 1 * * * /root/bin/rules_du_jour
# The crontab line above runs /root/bin/rules_du_jour at 1:28AM every day. (choose a different time, please)
# Make sure the user who's crontab you are editing has permission to write files to the SA config dir.
# Read configuration file (my_rules_du_jour wrapper script is no longer recommended)
# /etc/rulesdujour/config is the recommended configuration file location but may
# be read from one of the following locations, including the RDJ_CONFIGFILE env variable.
for i in ${RDJ_CONFIGFILE} /usr/local/etc/rulesdujour/config /usr/local/etc/rulesdujour /usr/local/etc/mail/rulesdujour ; do
[ -f "$i" ] && source $i ;
done;
# Choose Rulesets from this list:
# IMPORTANT: In order to configure RDJ, you should make a configuration file at /etc/rulesdujour/config.
# You should copy the line that begins with " TRUSTED_RULESETS=" into the config file and modify
# the list of rulesets to taste.
[ "${TRUSTED_RULESETS}" ] || \
TRUSTED_RULESETS="TRIPWIRE SARE_EVILNUMBERS0 SARE_RANDOM";
#### Local SpamAssassin/system Settings ####
#### Modify these to match your system. ####
[ "${SA_DIR}" ] || SA_DIR="/etc/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}" ] || MAIL_ADDRESS="root"; # Where do Email notifications go
[ "${SINGLE_EMAIL_ONLY}" ] || \
SINGLE_EMAIL_ONLY=""; # Set this to "true" to send only one notification
# email per RDJ run with "interesting"
# activity. Set to "" to send a separate
# for each interesting activity.
[ "${EMAIL_RDJ_UPDATE_ONLY}" ] || \
EMAIL_RDJ_UPDATE_ONLY=""; # Set this to "true" to send notifications only
# when an update for RDJ has been retrieved. Set
# to "" (default) to send notifications whenever a ruleset
# has changed. (Has no effect unless SINGLE_EMAIL_ONLY is set)
[ "${SA_LINT}" ] || SA_LINT="spamassassin --lint"; # Command used to lint the rules
[ "${SA_RESTART}" ] || \
SA_RESTART="/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
# For minedefang, may be /etc/init.d/mimedefang restart
[ "${CURL_PROG}" ] || CURL_PROG="curl"; # Location of the curl program
[ "${CURL_OPTS}" ] || CURL_OPTS="-w %{http_code} --compressed -O -R -s -S -z"; # Parameters of the curl program
[ "${CURL}" ] || CURL="${CURL_PROG} ${CURL_OPTS}"; # Curl program with parameters
[ "${WGET_PROG}" ] || WGET_PROG="wget"; # Location of the wget program
[ "${WGET_OPTS}" ] || WGET_OPTS="-N" # Parameters of the wget program
[ "${WGET}" ] || WGET="${WGET_PROG} ${WGET_OPTS}"; # Wget program with parameters
[ "${PERL}" ] || PERL="perl"; # Location of the perl program
[ "${GREP}" ] || GREP="grep"; # Location of the grep program
# (solaris users may want to point this to gnu grep)
if [ `uname` = "SunOS" ] ; then # Solaris doesn't have POSIX head/tail in /bin.
[ "${TAIL}" ] || TAIL="tail -1"; # Use '-1' syntax instead of '-n 1'
[ "${HEAD}" ] || HEAD="head -1"; # Use '-1' syntax instead of '-n 1'
fi
[ "${TAIL}" ] || TAIL="tail -n 1"; # Location (and parameters) for 'tail -n 1'
[ "${HEAD}" ] || HEAD="head -n 1"; # Location (and parameters) for 'head -n 1'
[ "${MAILCMD}" ] || MAILCMD="mail"; # Location of the mail program
# that takes and understand the -s flag
# DEBUG="true"; # Uncomment this to force debug mode on (or use -D)
#### End Local SpamAssassin Settings ####
# Re-source config file(s). We do this so variables found in the config files (such as ${PERL}) can be expanded now that they're all set.
for i in ${RDJ_CONFIGFILE} /etc/rulesdujour/config /etc/rulesdujour /etc/mail/rulesdujour /etc/sysconfig/RulesDuJour /etc/sysconfig/rulesdujour ; do
[ -f $i ] && source $i ;
done;
[ "${TMPDIR}" ] || TMPDIR="${SA_DIR}/RulesDuJour"; # Where we store old rulesets. If you delete
# this directory, RuleSets may be detected as
# out of date the next time you run rules_du_jour.
RDJ_URL="http://sandgnat.com/rdj/rules_du_jour"; # URL to update this script
#### CF Files information ####
# These are bash Array Variables ("man bash" for more information)
[ "${CF_URLS}" ] || declare -a CF_URLS; # Array that contains URLs of the files.
[ "${CF_FILES}" ] || declare -a CF_FILES; # Local name of the CF file; eg: bigevil.cf
[ "${CF_NAMES}" ] || declare -a CF_NAMES; # Happy Name of CF file; eg: "Big Evil"
[ "${PARSE_NEW_VER_SCRIPTS}" ] || \
declare -a PARSE_NEW_VER_SCRIPTS; # Command to run on the file to retrieve new version info
[ "${CF_MUNGE_SCRIPTS}" ] || declare -a CF_MUNGE_SCRIPTS; # This (optionally) modifies the file; eg: lower scores
#########################################
#### Begin Rules File Registry ####
#########################################
# If you add more RuleSets to your own registry, please contribute the settings to the www.exit0.us wiki
# http://www.exit0.us/index.php?pagename=RulesDuJourRuleSets
RULESEMPORIUM="http://www.rulesemporium.com/rules";
TRIPWIRE=0;
CF_URLS[0]="${RULESEMPORIUM}/99_FVGT_Tripwire.cf";
CF_FILES[0]="99_FVGT_Tripwire.cf";
CF_NAMES[0]="TripWire";
PARSE_NEW_VER_SCRIPTS[0]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
### INDEX NUMBER 1 IS RESERVED. DO NOT USE.
# Bigevil is no longer updated. Please remove it from your TRUSTED_RULESETS
# BIGEVIL=1;
# CF_URLS[1]="${RULESEMPORIUM}/bigevil.cf";
# CF_FILES[1]="bigevil.cf";
# CF_NAMES[1]="Big Evil";
# PARSE_NEW_VER_SCRIPTS[1]="${HEAD}";
### INDEX NUMBERS 2-6 ARE RESERVED. DO NOT USE.
# NOTE: As of 2004-02-26, backhair, weedsk, and chickenpox updates are no longer available.
# BACKHAIR=3;
# WEEDS1=4;
# WEEDS2=5;
# CHICKENPOX=6;
ANTIDRUG=7;
CF_URLS[7]="http://mywebpages.comcast.net/mkettler/sa/antidrug.cf"
CF_FILES[7]="antidrug.cf";
CF_NAMES[7]="Matt Kettler's AntiDrug";
PARSE_NEW_VER_SCRIPTS[7]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
EVILNUMBERS=8; # Deprecated, use SARE_EVILNUMBERS0
SARE_EVILNUMBERS0=8;
CF_URLS[8]="${RULESEMPORIUM}/70_sare_evilnum0.cf";
OLD_CF_FILES[8]="evilnumbers.cf";
CF_FILES[8]="70_sare_evilnum0.cf";
CF_NAMES[8]="EvilNumber";
PARSE_NEW_VER_SCRIPTS[8]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
EVILNUMBERS1=27; # Deprecated, use SARE_EVILNUMBERS1
SARE_EVILNUMBERS1=27;
CF_URLS[27]="${RULESEMPORIUM}/70_sare_evilnum1.cf"
CF_FILES[27]="70_sare_evilnum1.cf"
CF_NAMES[27]="EvilNumbers1";
PARSE_NEW_VER_SCRIPTS[27]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
EVILNUMBERS2=28; # Deprecated, use SARE_EVILNUMBERS2
SARE_EVILNUMBERS2=28;
CF_URLS[28]="${RULESEMPORIUM}/70_sare_evilnum2.cf"
CF_FILES[28]="70_sare_evilnum2.cf"
CF_NAMES[28]="EvilNumbers2";
PARSE_NEW_VER_SCRIPTS[28]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
BLACKLIST=9;
CF_URLS[9]="http://www.sa-blacklist.stearns.org/sa-blacklist/sa-blacklist.current";
CF_FILES[9]="blacklist.cf";
CF_NAMES[9]="William Stearn's sa-blacklist";
PARSE_NEW_VER_SCRIPTS[9]="${GREP} -i '^#.*sa-blacklist: 200' | sort | ${TAIL}";
BLACKLIST_URI=10;
CF_URLS[10]="http://www.sa-blacklist.stearns.org/sa-blacklist/sa-blacklist.current.uri.cf";
CF_FILES[10]="blacklist-uri.cf";
CF_NAMES[10]="William Stearn's URI blacklist";
PARSE_NEW_VER_SCRIPTS[10]="${GREP} -i '^#.*sa-blacklist.uri: 200' | sort | ${TAIL}";
RANDOMVAL=11;
CF_URLS[11]="http://www.sa-blacklist.stearns.org/sa-blacklist/random.current.cf";
CF_FILES[11]="random.cf";
CF_NAMES[11]="William Stearn's RANDOM WORD Ruleset";
PARSE_NEW_VER_SCRIPTS[11]="${GREP} -i '^#release' | ${TAIL}";
BOGUSVIRUS=12;
CF_URLS[12]="${RULESEMPORIUM}/bogus-virus-warnings.cf";
CF_FILES[12]="bogus-virus-warnings.cf";
CF_NAMES[12]="Tim Jackson's (et al) bogus virus warnings";
PARSE_NEW_VER_SCRIPTS[12]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | sort | ${TAIL}";
### INDEX NUMBER 13 IS RESERVED. DO NOT USE.
# NOTE: As of 2004-06-XX, MrWiggly has been deprecated. Use 70_sare_specific.cf (SARE_SPECIFIC)instead
# MRWIGGLY=13;
SARE_ADULT=14;
CF_URLS[14]="${RULESEMPORIUM}/70_sare_adult.cf"
CF_FILES[14]="70_sare_adult.cf";
CF_NAMES[14]="SARE Adult Content Ruleset";
PARSE_NEW_VER_SCRIPTS[14]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_FRAUD=15;
CF_URLS[15]="${RULESEMPORIUM}/99_sare_fraud_post25x.cf"
CF_FILES[15]="99_sare_fraud_post25x.cf";
CF_NAMES[15]="SARE Fraud Detection Ruleset (for SA ver. 2.5x and greater)";
PARSE_NEW_VER_SCRIPTS[15]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_FRAUD_PRE25X=16;
CF_URLS[16]="${RULESEMPORIUM}/99_sare_fraud_pre25x.cf"
CF_FILES[16]="99_sare_fraud_pre25x.cf";
CF_NAMES[16]="SARE Fraud Detection Ruleset (for SA prior to ver. 2.5x)";
PARSE_NEW_VER_SCRIPTS[16]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_BML=17;
CF_URLS[17]="${RULESEMPORIUM}/72_sare_bml_post25x.cf"
CF_FILES[17]="72_sare_bml_post25x.cf";
CF_NAMES[17]="SARE BIZ/Marketing/Learning Ruleset (for SA ver. 2.5x and greater)";
PARSE_NEW_VER_SCRIPTS[17]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_BML_PRE25X=18;
CF_URLS[18]="${RULESEMPORIUM}/71_sare_bml_pre25x.cf"
CF_FILES[18]="71_sare_bml_pre25x.cf";
CF_NAMES[18]="SARE BIZ/Marketing/Learning Ruleset (for SA prior to ver. 2.5x)";
PARSE_NEW_VER_SCRIPTS[18]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
# RATWARE is obsoleted; the rules here have been moved to various other sets.
#SARE_RATWARE=19;
# CF_URLS[19]="${RULESEMPORIUM}/70_sare_ratware.cf"
# CF_FILES[19]="70_sare_ratware.cf";
# OLD_CF_FILES[19]="ratware.cf";
# CF_NAMES[19]="SARE Ratware Detection Ruleset";
#PARSE_NEW_VER_SCRIPTS[19]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_SPOOF=20;
CF_URLS[20]="${RULESEMPORIUM}/70_sare_spoof.cf"
CF_FILES[20]="70_sare_spoof.cf";
CF_NAMES[20]="SARE Spoof Ruleset";
PARSE_NEW_VER_SCRIPTS[20]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_BAYES_POISON_NXM=21;
CF_URLS[21]="${RULESEMPORIUM}/70_sare_bayes_poison_nxm.cf"
CF_FILES[21]="70_sare_bayes_poison_nxm.cf";
CF_NAMES[21]="SARE 70_sare_bayes_poison_nxm.cf Ruleset";
PARSE_NEW_VER_SCRIPTS[21]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_OEM=22;
CF_URLS[22]="${RULESEMPORIUM}/70_sare_oem.cf"
CF_FILES[22]="70_sare_oem.cf";
CF_NAMES[22]="SARE OEM Ruleset";
PARSE_NEW_VER_SCRIPTS[22]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_RANDOM=23;
CF_URLS[23]="${RULESEMPORIUM}/70_sare_random.cf"
CF_FILES[23]="70_sare_random.cf";
CF_NAMES[23]="SARE Random Ruleset for SpamAssassin 2.5x and higher";
PARSE_NEW_VER_SCRIPTS[23]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HEADER_ABUSE=24; # Left here for backwards compatibility. Use SARE_HEADER instead.
SARE_HEADER=24;
CF_URLS[24]="${RULESEMPORIUM}/70_sare_header.cf"
CF_FILES[24]="70_sare_header.cf";
OLD_CF_FILES[24]="header_abuse.cf 70_sare_header_abuse.cf";
CF_NAMES[24]="Ruleset for header abuse (sets 0-3)";
PARSE_NEW_VER_SCRIPTS[24]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HEADER0=43;
CF_URLS[43]="${RULESEMPORIUM}/70_sare_header0.cf";
CF_FILES[43]="70_sare_header0.cf";
CF_NAMES[43]="SARE HEADER Ruleset (set 0 -- hits mostly spam)";
PARSE_NEW_VER_SCRIPTS[43]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER1=44;
CF_URLS[44]="${RULESEMPORIUM}/70_sare_header1.cf";
CF_FILES[44]="70_sare_header1.cf";
CF_NAMES[44]="SARE HEADER Ruleset (hits occasional ham)";
PARSE_NEW_VER_SCRIPTS[44]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER2=45;
CF_URLS[45]="${RULESEMPORIUM}/70_sare_header2.cf";
CF_FILES[45]="70_sare_header2.cf";
CF_NAMES[45]="SARE HEADER Ruleset (set 2 -- future)";
PARSE_NEW_VER_SCRIPTS[45]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER3=46;
CF_URLS[46]="${RULESEMPORIUM}/70_sare_header3.cf";
CF_FILES[46]="70_sare_header3.cf";
CF_NAMES[46]="SARE HEADER Ruleset (set 3 -- hits significant ham)";
PARSE_NEW_VER_SCRIPTS[46]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER_ENG=47;
CF_URLS[47]="${RULESEMPORIUM}/70_sare_header_eng.cf";
CF_FILES[47]="70_sare_header_eng.cf";
CF_NAMES[47]="SARE HEADER Ruleset (for english language only)";
PARSE_NEW_VER_SCRIPTS[47]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER_X264_X30=48; # Only use this ruleset if you are running SpamAssassin version 2.63 and below.
CF_URLS[48]="${RULESEMPORIUM}/70_sare_header_x264_x30.cf";
CF_FILES[48]="70_sare_header_x264_x30.cf";
CF_NAMES[48]="SARE HEADER Ruleset X264_X30 (these rules merged into official SA version 2.64)";
PARSE_NEW_VER_SCRIPTS[48]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_HEADER_X30=49; # Only use this ruleset if you are using a SpamAssassin version less than 3.0
CF_URLS[49]="${RULESEMPORIUM}/70_sare_header_x30.cf";
CF_FILES[49]="70_sare_header_x30.cf";
CF_NAMES[49]="SARE HEADER Ruleset X30 (these rules merged into official SA version 3.00)";
PARSE_NEW_VER_SCRIPTS[49]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_CODING_HTML=25; # Don't use. Use SARE_HTML instead. Kept for backwards compatibility.
SARE_CODING=25; # Don't use. Use SARE_HTML instead. Kept for backwards compatibility
SARE_HTML=25;
CF_URLS[25]="${RULESEMPORIUM}/70_sare_html.cf"
CF_FILES[25]="70_sare_html.cf";
OLD_CF_FILES[25]="coding_html.cf";
CF_NAMES[25]="SARE html Ruleset (combined sets 0-3)";
PARSE_NEW_VER_SCRIPTS[25]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML0=36;
CF_URLS[36]="${RULESEMPORIUM}/70_sare_html0.cf";
CF_FILES[36]="70_sare_html0.cf";
CF_NAMES[36]="SARE html Ruleset (set 0 -- hits mostly spam)";
PARSE_NEW_VER_SCRIPTS[36]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML1=37;
CF_URLS[37]="${RULESEMPORIUM}/70_sare_html1.cf";
CF_FILES[37]="70_sare_html1.cf";
CF_NAMES[37]="SARE html Ruleset (set 1 -- hits occasional ham)";
PARSE_NEW_VER_SCRIPTS[37]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML2=38;
CF_URLS[38]="${RULESEMPORIUM}/70_sare_html2.cf";
CF_FILES[38]="70_sare_html2.cf";
CF_NAMES[38]="SARE html Ruleset (set 2 -- future)";
PARSE_NEW_VER_SCRIPTS[38]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML3=39;
CF_URLS[39]="${RULESEMPORIUM}/70_sare_html3.cf";
CF_FILES[39]="70_sare_html3.cf";
CF_NAMES[39]="SARE html Ruleset (set 3 -- hits significant ham)";
PARSE_NEW_VER_SCRIPTS[39]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML4=40;
CF_URLS[40]="${RULESEMPORIUM}/70_sare_html4.cf";
CF_FILES[40]="70_sare_html4.cf";
CF_NAMES[40]="SARE html Ruleset (set 4 -- hits lots of spam, but also hits significant ham)";
PARSE_NEW_VER_SCRIPTS[40]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML_ENG=41;
CF_URLS[41]="${RULESEMPORIUM}/70_sare_html_eng.cf";
CF_FILES[41]="70_sare_html_eng.cf";
CF_NAMES[41]="SARE html Ruleset for english language only";
PARSE_NEW_VER_SCRIPTS[41]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HTML_PRE300=42; # Use these rules on SA versions 2.6X only.
CF_URLS[42]="${RULESEMPORIUM}/70_sare_html_x30.cf";
CF_FILES[42]="70_sare_html_x30.cf";
CF_NAMES[42]="SARE html Ruleset (These rules have been integrated into SA version 3.00 and higher)";
PARSE_NEW_VER_SCRIPTS[42]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_SPECIFIC=26;
CF_URLS[26]="${RULESEMPORIUM}/70_sare_specific.cf";
CF_FILES[26]="70_sare_specific.cf";
CF_NAMES[26]="SARE Specific Ruleset";
PARSE_NEW_VER_SCRIPTS[26]="${GREP} -i '^# Version:' | ${HEAD}";
SARE_OBFU=29;
CF_URLS[29]="${RULESEMPORIUM}/70_sare_obfu.cf"
CF_FILES[29]="70_sare_obfu.cf";
CF_NAMES[29]="SARE Obfuscation catching Ruleset (both sets 0 and 1)";
PARSE_NEW_VER_SCRIPTS[29]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_OBFU0=30;
CF_URLS[30]="${RULESEMPORIUM}/70_sare_obfu0.cf"
CF_FILES[30]="70_sare_obfu0.cf";
CF_NAMES[30]="SARE Obfuscation catching Ruleset (set 0 -- hits mostly spam)";
PARSE_NEW_VER_SCRIPTS[30]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_OBFU1=31;
CF_URLS[31]="${RULESEMPORIUM}/70_sare_obfu1.cf"
CF_FILES[31]="70_sare_obfu1.cf";
CF_NAMES[31]="SARE Obfuscation catching Ruleset (set 1 -- hits occasional ham)";
PARSE_NEW_VER_SCRIPTS[31]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_OBFU2=32;
CF_URLS[32]="${RULESEMPORIUM}/70_sare_obfu2.cf"
CF_FILES[32]="70_sare_obfu2.cf";
CF_NAMES[32]="SARE Obfuscation catching Ruleset (set 2 -- future)";
PARSE_NEW_VER_SCRIPTS[32]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_OBFU3=33;
CF_URLS[33]="${RULESEMPORIUM}/70_sare_obfu3.cf"
CF_FILES[33]="70_sare_obfu3.cf";
CF_NAMES[33]="SARE Obfuscation catching Ruleset (set 3 -- hits significant ham)";
PARSE_NEW_VER_SCRIPTS[33]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
#### Enable munge to activate ham rules (do this in your config file, do not edit this script directly)
SARE_REDIRECT=34;
CF_URLS[34]="${RULESEMPORIUM}/71_sare_redirect_pre3.0.0.cf";
CF_FILES[34]="71_sare_redirect_pre3.0.0.cf";
CF_NAMES[34]="SARE Abused Redirect Subject Ruleset for SpamAssassin (pre3.0.0)";
PARSE_NEW_VER_SCRIPTS[34]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
# CF_MUNGE_SCRIPTS[34]="sed -e s/#+#//g";
#### Enable munge to activate ham rules (do this in your config file, do not edit this script directly)
SARE_REDIRECT_POST300=35;
CF_URLS[35]="${RULESEMPORIUM}/72_sare_redirect_post3.0.0.cf";
CF_FILES[35]="72_sare_redirect_post3.0.0.cf";
CF_NAMES[35]="SARE Abused Redirect Subject Ruleset for SpamAssassin (post3.0.0)";
PARSE_NEW_VER_SCRIPTS[35]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
# CF_MUNGE_SCRIPTS[35]="sed -e s/#+#//g";
SARE_SPAMCOP_TOP200=50
CF_URLS[50]="${RULESEMPORIUM}/70_sc_top200.cf";
CF_FILES[50]="70_sc_top200.cf";
CF_NAMES[50]="SARE Top 200 spamcop ip addresses Ruleset (automatically generated)";
PARSE_NEW_VER_SCRIPTS[50]="${PERL} -ne 'print if /^\s*#.*(Modified)/i;' | sort | ${TAIL}";
#### Here are settings for sare_genlsubj ####
SARE_GENLSUBJ=51
CF_URLS[51]="${RULESEMPORIUM}/70_sare_genlsubj.cf";
CF_FILES[51]="70_sare_genlsubj.cf";
CF_NAMES[51]="SARE General Subject Header Ruleset (Contains sets 0,1,2,3)";
PARSE_NEW_VER_SCRIPTS[51]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_GENLSUBJ0=52;
CF_URLS[52]="${RULESEMPORIUM}/70_sare_genlsubj0.cf";
CF_FILES[52]="70_sare_genlsubj0.cf";
CF_NAMES[52]="SARE General Subject Ruleset (set 0 -- hits mostly spam)";
PARSE_NEW_VER_SCRIPTS[52]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_GENLSUBJ1=53;
CF_URLS[53]="${RULESEMPORIUM}/70_sare_genlsubj1.cf";
CF_FILES[53]="70_sare_genlsubj1.cf";
CF_NAMES[53]="SARE General Subject Ruleset (set 1 -- hits occasional ham)";
PARSE_NEW_VER_SCRIPTS[53]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_GENLSUBJ2=54;
CF_URLS[54]="${RULESEMPORIUM}/70_sare_genlsubj2.cf";
CF_FILES[54]="70_sare_genlsubj2.cf";
CF_NAMES[54]="SARE General Subject Ruleset (set 2 -- future)";
PARSE_NEW_VER_SCRIPTS[54]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_GENLSUBJ3=55;
CF_URLS[55]="${RULESEMPORIUM}/70_sare_genlsubj3.cf";
CF_FILES[55]="70_sare_genlsubj3.cf";
CF_NAMES[55]="SARE General Subject Ruleset (set 3 -- hits significant ham)";
PARSE_NEW_VER_SCRIPTS[55]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_GENLSUBJ_X30=56; # Only use this ruleset with SA versions prior to 3.00
CF_URLS[56]="${RULESEMPORIUM}/70_sare_genlsubj_x30.cf";
CF_FILES[56]="70_sare_genlsubj_x30.cf";
CF_NAMES[56]="SARE General Subject X30 (These rules have been added to standard SA version 3.00)";
PARSE_NEW_VER_SCRIPTS[56]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_GENLSUBJ_ENG=57;
CF_URLS[57]="${RULESEMPORIUM}/70_sare_genlsubj_eng.cf";
CF_FILES[57]="70_sare_genlsubj_eng.cf";
CF_NAMES[57]="SARE General Subject Header Ruleset (for english language only)";
PARSE_NEW_VER_SCRIPTS[57]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_HIGHRISK=58;
CF_URLS[58]="${RULESEMPORIUM}/70_sare_highrisk.cf";
CF_FILES[58]="70_sare_highrisk.cf";
CF_NAMES[58]="SARE High Risk Ruleset";
PARSE_NEW_VER_SCRIPTS[58]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
SARE_UNSUB=59;
CF_URLS[59]="${RULESEMPORIUM}/70_sare_unsub.cf";
CF_FILES[59]="70_sare_unsub.cf";
CF_NAMES[59]="SARE Unsubscribe phrases Ruleset";
PARSE_NEW_VER_SCRIPTS[59]="${PERL} -ne 'print if /^\s*#.*(vers?|version|rev|revision)[:\.\s]*[0-9]/i;' | ${HEAD}";
#### Here are settings for SARE_URI* files ####
SARE_URI=60;
SARE_URI0=60;
CF_URLS[60]="${RULESEMPORIUM}/70_sare_uri0.cf";
CF_FILES[60]="70_sare_uri0.cf";
CF_NAMES[60]="SARE URI Ruleset (set 0 -- hits mostly spam)";
PARSE_NEW_VER_SCRIPTS[60]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_URI1=61;
CF_URLS[61]="${RULESEMPORIUM}/70_sare_uri1.cf";
CF_FILES[61]="70_sare_uri1.cf";
CF_NAMES[61]="SARE URI Ruleset (set 1 -- occasinally hits ham)";
PARSE_NEW_VER_SCRIPTS[61]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
# This no longer exists. Leaving it in as a placeholder.
#SARE_URI2=62;
# CF_URLS[62]="${RULESEMPORIUM}/70_sare_uri2.cf";
# CF_FILES[62]="70_sare_uri2.cf";
# CF_NAMES[62]="SARE uri Ruleset 2 for SpamAssassin";
#PARSE_NEW_VER_SCRIPTS[62]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_URI3=63;
CF_URLS[63]="${RULESEMPORIUM}/70_sare_uri3.cf";
CF_FILES[63]="70_sare_uri3.cf";
CF_NAMES[63]="SARE URI Ruleset (set 3 -- hits significant ham)";
PARSE_NEW_VER_SCRIPTS[63]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_URI_ENG=64;
CF_URLS[64]="${RULESEMPORIUM}/70_sare_uri_eng.cf";
CF_FILES[64]="70_sare_uri_eng.cf";
CF_NAMES[64]="SARE URI Ruleset (for english language only)";
PARSE_NEW_VER_SCRIPTS[64]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_WHITELIST=65;
CF_URLS[65]="${RULESEMPORIUM}/70_sare_whitelist.cf";
CF_FILES[65]="70_sare_whitelist.cf";
CF_NAMES[65]="SARE Whitelist Ruleset (for SA 3.00 and up)";
PARSE_NEW_VER_SCRIPTS[65]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_WHITELIST_PRE30=66;
CF_URLS[66]="${RULESEMPORIUM}/70_sare_whitelist_pre30.cf";
CF_FILES[66]="70_sare_whitelist_pre30.cf";
CF_NAMES[66]="SARE Whitelist Ruleset (for SA versions prior to 3.00)";
PARSE_NEW_VER_SCRIPTS[66]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_WHITELIST_RCVD=67;
CF_URLS[67]="${RULESEMPORIUM}/70_sare_whitelist_rcvd.cf";
CF_FILES[67]="70_sare_whitelist_rcvd.cf";
CF_NAMES[67]="SARE Whitelist Ruleset (for SA 3.10 and up with network tests)";
PARSE_NEW_VER_SCRIPTS[67]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_WHITELIST_SPF=68;
CF_URLS[68]="${RULESEMPORIUM}/70_sare_whitelist_spf.cf";
CF_FILES[68]="70_sare_whitelist_spf.cf";
CF_NAMES[68]="SARE Whitelist Ruleset (for SA 3.10 and up with SPF enabled)";
PARSE_NEW_VER_SCRIPTS[68]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
ZMI_GERMAN=69;
CF_URLS[69]="http://sa.zmi.at/rulesets/70_zmi_german.cf";
CF_FILES[69]="70_zmi_german.cf";
CF_NAMES[69]="Catch German language spam. Maintained by Michael Monnerie";
PARSE_NEW_VER_SCRIPTS[69]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
SARE_STOCKS=70;
CF_URLS[70]="${RULESEMPORIUM}/70_sare_stocks.cf";
CF_FILES[70]="70_sare_stocks.cf";
CF_NAMES[70]="SARE Stocks Ruleset)";
PARSE_NEW_VER_SCRIPTS[70]="${PERL} -ne 'print if /^\s*#.*(version|rev|revision)[:\.\s]*[0-9]/i ;' | ${HEAD}";
#########################################
#### End Rules File Registry ####
#########################################
# Do not update beyond this line unless you know what you are doing.
#########################################
#### Begin rules update code ####
#########################################
function CurlHttpGet() {
CURL_URL="$1";
CURL_FILE="$2";
CURL_OUTPUT=`${CURL} ${CURL_FILE} ${CURL_URL} 2>&1`;
CURL_ERROR=$?;
CURL_HTTP_CODE="${CURL_OUTPUT:0:3}";
[ "${DEBUG}" ] && echo "exec: ${CURL} ${CURL_FILE} ${CURL_URL} 2>&1";
[ "${DEBUG}" ] && echo "curl_output: ${CURL_OUTPUT}";
[ "${CURL_HTTP_CODE}" = "200" ] && DOWNLOADED="true";
[ "${CURL_HTTP_CODE}" = "404" ] && WAS404="true";
[ "${CURL_HTTP_CODE:0:1}" = "4" ] && WAS4xx5xx="true";
[ "${CURL_HTTP_CODE:0:1}" = "5" ] && WAS4xx5xx="true";
[ "${WAS4xx5xx}" ] && HTTP_ERROR="${CURL_HTTP_CODE}";
[ "${CURL_ERROR}" != "0" ] && { FAILED="true"; HTTP_ERROR="curl exit code: ${CURL_ERROR}\n${CURL_OUTPUT}"; };
}
function WgetHttpGet() {
URL=$1;
${WGET} ${URL} > ${TMPDIR}/wget.log 2>&1;
[ "${DEBUG}" ] && echo "exec: ${WGET} ${URL} > ${TMPDIR}/wget.log 2>&1";
[ "${DEBUG}" ] && echo "wget_output: `cat ${TMPDIR}/wget.log`";
${GREP} 'saved' ${TMPDIR}/wget.log > /dev/null; DOWNLOADED=$?;
${GREP} 'ERROR [45][0-9][0-9]' ${TMPDIR}/wget.log > /dev/null; WAS4xx5xx=$?;
${GREP} 'ERROR 404' ${TMPDIR}/wget.log > /dev/null; WAS404=$?;
${GREP} -i 'failed: ' ${TMPDIR}/wget.log > /dev/null; FAILED=$?;
[ ! "${DOWNLOADED}" = "0" ] && DOWNLOADED=; # Unset DOWNLOADED if the file was already current
[ ! "${WAS4xx5xx}" = "0" ] && WAS4xx5xx=; # Unset WAS4xx5xx if the file didn't return 404.
[ ! "${WAS404}" = "0" ] && WAS404=; # Unset WAS4xx5xx if the file didn't return 404.
[ ! "${FAILED}" = "0" ] && FAILED=; # Unset FAILED if wget succeded
[ "${WAS4xx5xx}" ] && HTTP_ERROR=`${GREP} 'ERROR [45][0-9][0-9]' ${TMPDIR}/wget.log`;
[ "${FAILED}" ] && HTTP_ERROR=`cat ${TMPDIR}/wget.log`;
}
function HttpGet() {
unset DOWNLOADED WAS4xx5xx WAS404 FAILED;
if [ "${CURL_AVAILABLE}" ] ; then
CurlHttpGet $*;
else
WgetHttpGet $*;
fi
}
# set -x
# if invoked with -D, enable DEBUG here.
[ "$1" = "-D" ] && DEBUG="true";
# if running interactively, enable DEBUG here.
[ -t 0 ] && DEBUG="true";
# Test if curl available (Bash feature)
command -v ${CURL_PROG} > /dev/null 2>&1 ; CURL_AVAILABLE=$?;
[ "${CURL_AVAILABLE}" = "0" ] && CURL_AVAILABLE="true" || CURL_AVAILABLE="";
if [ "${CURL_AVAILABLE}" ] ; then
# Check if the curl is 7.10 or greater (supports --compression)
CURL_VERSION=`${CURL_PROG} --version|${HEAD}|${PERL} -pe 's/curl (\d+\.\d+)[^\d].*/\1/i'`;
CURL_MAJOR_VERSION=${CURL_VERSION/.*/};
CURL_MINOR_VERSION=${CURL_VERSION/*./};
[ "${CURL_MAJOR_VERSION}" -gt 7 ] && CURL_COMPRESSION="true";
[ "${CURL_MAJOR_VERSION}" -ge 7 ] && [ "${CURL_MINOR_VERSION}" -ge 10 ] && CURL_COMPRESSION="true";
# Fall back to wget if version is less than 7.10
if [ ! "${CURL_COMPRESSION}" ] ; then
CURL_AVAILABLE=;
[ "${DEBUG}" ] && { echo "Curl version is ${CURL_VERSION} (Not 7.10 or greater). Falling back to wget."; sleep 3; };
fi
fi
# If we're not running interactively, add a random delay here. This should
# help reduce spikes on the servers hosting the rulesets (Thanks, Bob)
MAXDELAY=3600;
DELAY=0;
[ ! -t 0 ] && [ ${MAXDELAY} -gt 0 ] && let DELAY="${RANDOM} % ${MAXDELAY}";
[ "${DEBUG}" ] && [ ${DELAY} -gt 0 ] && echo "Probably running from cron... sleeping for a random interval (${DELAY} seconds)";
[ ${DELAY} -gt 0 ] && sleep ${DELAY};
# Save old working dir
OLDDIR=`pwd`;
# This variable is used to indicate if we should restart spamd. Currently empty (false).
RESTART_REQUIRED="";
# This variable is used to indicate if we should send an email notification when all is said and done.
# It is toggled on whenever an "interesting" event happens (404, rule updated, etc)
QUEUE_SINGLE_EMAIL="";
# Save the hostname of this box
HOSTNAME=`hostname`;
# The beginnings of an email and/or debug summary text
MESSAGES="RulesDuJour Run Summary on ${HOSTNAME}:";
# This variable is set when a new version of Rules Du Jour is available
MSG_RDJ_UPDATED="";
[ ! -e ${TMPDIR} ] && mkdir ${TMPDIR};
cd ${TMPDIR};
# Test if we can write to the $SA_DIR and $TMPDIR directories
if [ ! -w "${SA_DIR}" ] ; then
WARNMSG="***NOTICE***: Cannot write to ${SA_DIR}. Are you running as the correct user? No rulesets will be checked or updated.";
[ "${DEBUG}" ] && echo -e "$WARNMSG";
MESSAGES="${MESSAGES}\n\n${WARNMSG}";
RESTART_REQUIRED= ;
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e "${WARNMSG}" | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: Cannot write to ${SA_DIR}. RDJ terminated.\" ${MAIL_ADDRESS}";
TRUSTED_RULESETS=""; # clear out trusted rulesets so it doesn't process anything from here on out.
fi
if [ ! -w "${TMPDIR}" ] ; then
WARNMSG="***NOTICE***: Cannot write to ${TMPDIR}. Are you running as the correct user? No rulesets will be checked or updated.";
[ "${DEBUG}" ] && echo -e "$WARNMSG";
MESSAGES="${MESSAGES}\n\n${WARNMSG}";
RESTART_REQUIRED= ;
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e "${WARNMSG}" | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: Cannot write to ${TMPDIR}. RDJ terminated.\" ${MAIL_ADDRESS}";
TRUSTED_RULESETS=""; # clear out trusted rulesets so it doesn't process anything from here on out.
fi
if [ ! "${DONT_CHECK_FOR_RDJ_UPDATES}" ] ; then
if [ -f ${TMPDIR}/rules_du_jour ] ; then
HttpGet ${RDJ_URL} ${TMPDIR}/rules_du_jour;
if [ "${DOWNLOADED}" ] ; then
NEWVER=`${GREP} "^# Version" ${TMPDIR}/rules_du_jour`;
MSG_RDJ_UPDATED="Rules Du Jour has an update available.\nNew version of Rules Du Jour is ${NEWVER}\nNew version of Rules Du Jour was downloaded to ${TMPDIR}/rules_du_jour\n";
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || echo -e "${MSG_RDJ_UPDATED}" | \
sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: new Rules Du Jour version available.\" ${MAIL_ADDRESS}";
MESSAGES="${MESSAGES}\n${MSG_RDJ_UPDATED}";
fi
else
HttpGet ${RDJ_URL} ${TMPDIR}/rules_du_jour;
fi
fi
# Perform a lint before processing the rest of the script
[ "${DEBUG}" ] && echo "Performing preliminary lint (sanity check; does the CURRENT config lint?).";
${SA_LINT} > /dev/null 2>&1; LINTFAILED=$?;
[ "${LINTFAILED}" = "0" ] && LINTFAILED=; # Unset LINTFAILED if lint didn't fail.
# Lint failed. Send administrative notification
if [ ${LINTFAILED} ] ; then
LINTERRORS=`${SA_LINT} 2>&1`;
WARNMSG="***NOTICE***: ${SA_LINT} failed. This means that you have an error somwhere in your SpamAssassin configuration. To determine what the problem is, please run '$SA_LINT' from a shell and notice the error messages it prints. For more (debug) information, add the -D switch to the command. Usually the problem will be found in local.cf, user_prefs, or some custom rulelset found in $SA_DIR. Here are the errors that '$SA_LINT' reported:\n\n${LINTERRORS}\n";
MESSAGES="${MESSAGES}\n\n${WARNMSG}";
RESTART_REQUIRED= ;
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e "${WARNMSG}" | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: '$SA_LINT' failed. Please fix your SpamAssassin configuration.\" ${MAIL_ADDRESS}";
TRUSTED_RULESETS=""; # clear out trusted rulesets so it doesn't process anything from here on out.
fi
for RULESET_NAME in ${TRUSTED_RULESETS} ; do
# Set up some array variables
INDEX=${!RULESET_NAME};
if [ ! "${INDEX}" ] ; then
MSG_INVALID_RULENAME="\nNo index found for ruleset named ${RULESET_NAME}. Check that this ruleset is still valid.";
[ "${DEBUG}" ] && echo -e "${MSG_INVALID_RULENAME}";
MESSAGES="${MESSAGES}\n${MSG_INVALID_RULENAME}";
else
CF_URL=${CF_URLS[${INDEX}]};
CF_FILE=${CF_FILES[${INDEX}]};
OLD_CF_FILES=${OLD_CF_FILES[${INDEX}]};
CF_NAME=${CF_NAMES[${INDEX}]};
PARSE_NEW_VER_SCRIPT=${PARSE_NEW_VER_SCRIPTS[${INDEX}]};
CF_MUNGE_SCRIPT=${CF_MUNGE_SCRIPTS[${INDEX}]};
# Get the filename the author chose.
CF_BASENAME=`basename ${CF_URL}`;
DATE=`date +"%Y%m%d-%H%M"`
if [ "${DEBUG}" ] ; then
# Dump the variables to stdout
echo "";
echo "------ ${RULESET_NAME} ------";
echo "RULESET_NAME=${RULESET_NAME}";
echo "INDEX=${INDEX}";
echo "CF_URL=${CF_URL}";
echo "CF_FILE=${CF_FILE}";
echo "CF_NAME=${CF_NAME}";
echo "PARSE_NEW_VER_SCRIPT=${PARSE_NEW_VER_SCRIPT}";
echo "CF_MUNGE_SCRIPT=${CF_MUNGE_SCRIPT}";
fi
[ "${DEBUG}" ] && [ -f ${TMPDIR}/${CF_BASENAME} ] && echo "Old ${CF_BASENAME} already existed in ${TMPDIR}...";
[ "${DEBUG}" ] && [ ! -f ${TMPDIR}/${CF_BASENAME} ] && \
[ ! -f ${SA_DIR}/${CF_FILE} ] && echo "This is the first time downloading ${CF_BASENAME}...";
[ "${DEBUG}" ] && [ ! -f ${TMPDIR}/${CF_BASENAME} ] && [ -f ${SA_DIR}/${CF_FILE} ] && \
echo "Copying from ${SA_DIR}/${CF_FILE} to ${TMPDIR}/${CF_BASENAME}...";
[ ! -f ${TMPDIR}/${CF_BASENAME} ] && [ -f ${SA_DIR}/${CF_FILE} ] && \
cp ${SA_DIR}/${CF_FILE} ${TMPDIR}/${CF_BASENAME} && \
touch -r ${SA_DIR}/${CF_FILE} ${TMPDIR}/${CF_BASENAME};
[ "${DEBUG}" ] && echo "Retrieving file from ${CF_URL}...";
# send wget output to a temp file for grepping
HttpGet ${CF_URL} ${TMPDIR}/${CF_BASENAME};
# Append these errors to a variable to be mailed to the admin (later in script)
[ "${FAILED}" ] && RULES_THAT_404ED="${RULES_THAT_404ED}\n${CF_NAME} had an unknown error:\n${HTTP_ERROR}";
[ "${WAS404}" ] && RULES_THAT_404ED="${RULES_THAT_404ED}\n${CF_NAME} not found (404) at ${CF_URL}";
[ "${WAS4xx5xx}" ] && RULES_THAT_404ED="${RULES_THAT_404ED}\n${CF_NAME} was not retrieved because of: ${HTTP_ERROR} from ${CF_URL}.";
[ "${WAS4xx5xx}" ] && [ "${DEBUG}" ] && RULES_THAT_404ED="${RULES_THAT_404ED}\nAdditional Info:\n${HTTP_ERROR}";
[ "${DEBUG}" ] && [ "${WAS4xx5xx}" ] && echo "Got ${HTTP_ERROR} from ${CF_NAME} at ${CF_URL} ...";
[ "${DEBUG}" ] && [ ! "${WAS4xx5xx}" ] && [ "${WAS404}" ] && echo "Got 404 from ${CF_NAME} at ${CF_URL} ...";
[ "${DEBUG}" ] && [ ! "${WAS4xx5xx}" ] && [ "${DOWNLOADED}" ] && echo "New version downloaded...";
[ "${DEBUG}" ] && [ ! "${WAS4xx5xx}" ] && [ ! "${DOWNLOADED}" ] && echo "${CF_BASENAME} was up to date [skipped downloading of ${CF_URL} ] ...";
# If we downloaded a new version, or if we have the current version,
# but it is not installed, copy or munge to CF_FILE.2
if ([ "${DOWNLOADED}" ] || \
( [ ! -f ${SA_DIR}/${CF_FILE} ] && \
[ -f ${TMPDIR}/${CF_BASENAME} ]) ) ; then
if [ "${CF_MUNGE_SCRIPT}" ] ; then
[ "${DEBUG}" ] && echo "Munging output using command: ${CF_MUNGE_SCRIPT}";
sh -c "${CF_MUNGE_SCRIPT}" < ${TMPDIR}/${CF_BASENAME} > ${TMPDIR}/${CF_BASENAME}.2;
else
cp ${TMPDIR}/${CF_BASENAME} ${TMPDIR}/${CF_BASENAME}.2;
fi
# Set munged file to same timestamp as downloaded file...
touch -r ${TMPDIR}/${CF_BASENAME} ${TMPDIR}/${CF_BASENAME}.2;
fi
# Update SA config dir if this is the first time we've seen the ruleset, or if the ruleset has changed.
if ( [ -f ${TMPDIR}/${CF_BASENAME}.2 ] && \
( [ ! -f ${SA_DIR}/${CF_FILE} ] || \
! cmp -s ${TMPDIR}/${CF_BASENAME}.2 ${SA_DIR}/${CF_FILE} ) ); then
# If we know the source rules file has had its name changed, delete the old filename and install the new one.
for OLD_CF_FILE in ${OLD_CF_FILES} ; do
if [ -f ${SA_DIR}/${OLD_CF_FILE} ] ; then
MSG_FILENAME_CHANGED="\n*** ${CF_NAME} has changed names from ${OLD_CF_FILE} to ${CF_FILE}.\nBecause of the name change I am removing the old file and installing the new file.";
[ "${DEBUG}" ] && echo -e "${MSG_FILENAME_CHANGED}";
MESSAGES="${MESSAGES}\n${MSG_FILENAME_CHANGED}";
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e ${MSG_FILENAME_CHANGED} | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: ${CF_NAME} RuleSet's name has changed\" ${MAIL_ADDRESS}";
UNDO_COMMAND="${UNDO_COMMAND} mv -f ${TMPDIR}/${OLD_CF_FILE}.2 ${SA_DIR}/${OLD_CF_FILE};";
mv -f ${SA_DIR}/${OLD_CF_FILE} ${TMPDIR}/${OLD_CF_FILE}.2;
fi
done
[ "${DEBUG}" ] && [ ! -f ${SA_DIR}/${CF_FILE} ] && echo "Installing new ruleset from ${TMPDIR}/${CF_BASENAME}.2" ;
[ "${DEBUG}" ] && [ -f ${SA_DIR}/${CF_FILE} ] && echo "Old version ${SA_DIR}/${CF_FILE} differs from new version ${TMPDIR}/${CF_BASENAME}.2" && echo "Backing up old version...";
[ -f ${SA_DIR}/${CF_FILE} ] && mv -f ${SA_DIR}/${CF_FILE} ${TMPDIR}/${CF_FILE}.${DATE};
# Save the command that can be used to undo this change, if rules won't --lint
UNDO_COMMAND="${UNDO_COMMAND} mv -f ${SA_DIR}/${CF_FILE} ${TMPDIR}/${CF_BASENAME}.2;";
[ -f ${TMPDIR}/${CF_FILE}.${DATE} ] && \
UNDO_COMMAND="${UNDO_COMMAND} mv -f ${TMPDIR}/${CF_FILE}.${DATE} ${SA_DIR}/${CF_FILE};" || \
UNDO_COMMAND="${UNDO_COMMAND} rm -f ${SA_DIR}/${CF_FILE};";
[ "${DEBUG}" ] && [ -f ${TMPDIR}/${CF_BASENAME}.2 ] && echo "Installing new version...";
[ -f ${TMPDIR}/${CF_BASENAME}.2 ] && mv -f ${TMPDIR}/${CF_BASENAME}.2 ${SA_DIR}/${CF_FILE};
NEWVER=`sh -c "cat ${SA_DIR}/${CF_FILE} | ${PARSE_NEW_VER_SCRIPT}"`;
MSG_CHANGED="\n${CF_NAME} has changed on ${HOSTNAME}.\nVersion line: ${NEWVER}";
MESSAGES="${MESSAGES}\n${MSG_CHANGED}";
[ "${DEBUG}" ] && echo -e "${MSG_CHANGED}";
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e ${MSG_CHANGED} | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: ${CF_NAME} RuleSet has been updated\" ${MAIL_ADDRESS}";
RESTART_REQUIRED="true";
fi
fi
done
# Cleanup, lint, email admin if required, restart SA if required
[ -f ${TMPDIR}/wget.log ] && rm -f ${TMPDIR}/wget.log;
[ "${RULES_THAT_404ED}" ] && {
MSG_404S="The following rules had errors:${RULES_THAT_404ED}";
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e "${MSG_404S}" | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: 404 errors\" ${MAIL_ADDRESS}";
MESSAGES="${MESSAGES}\n\n${MSG_404S}";
}
[ "${RESTART_REQUIRED}" ] && {
[ "${DEBUG}" ] && echo "Attempting to --lint the rules.";
${SA_LINT} > /dev/null 2>&1; LINTFAILED=$?;
[ "${LINTFAILED}" = "0" ] && LINTFAILED=; # Unset LINTFAILED if lint didn't fail.
# Lint failed. Run the undo commands, send administrative notification
if [ ${LINTFAILED} ] ; then
LINTERRORS=`${SA_LINT} 2>&1`;
WARNMSG="***WARNING***: ${SA_LINT} failed.\nRolling configuration files back, not restarting SpamAssassin.\nRollback command is: ${UNDO_COMMAND}\n\nLint output: ${LINTERRORS}\n";
MESSAGES="${MESSAGES}\n\n${WARNMSG}";
sh -c "${UNDO_COMMAND}" && RESTART_REQUIRED= ;
[ "${SINGLE_EMAIL_ONLY}" ] && QUEUE_SINGLE_EMAIL="true" || \
echo -e "${WARNMSG}" | sh -c "${MAILCMD} -s \"RulesDuJour/${HOSTNAME}: lint failed. Updates rolled back.\" ${MAIL_ADDRESS}";
else
[ "${DEBUG}" ] && echo "Restarting SpamAssassin using: sh -c \"${SA_RESTART}\"";
sh -c "${SA_RESTART}" > /dev/null 2>&1;
fi
}
[ "${DEBUG}" ] && [ ! "${RESTART_REQUIRED}" ] && echo "No files updated; No restart required.";
[ "${DEBUG}" ] && echo -e "\n\n\n\n\nRules Du Jour Run Summary:${MESSAGES}";
# Send the single consolidated notification email here.
if [ "${SINGLE_EMAIL_ONLY}" ] && [ "${QUEUE_SINGLE_EMAIL}" ] ; then
[ "${EMAIL_RDJ_UPDATE_ONLY}" ] && [ "${MSG_RDJ_UPDATED}" ] && SEND_THE_EMAIL="true";
[ ! "${EMAIL_RDJ_UPDATE_ONLY}" ] && SEND_THE_EMAIL="true";
[ "${SEND_THE_EMAIL}" ] && echo -e "${MESSAGES}" | sh -c "${MAILCMD} -s \"RulesDuJour Run Summary on ${HOSTNAME}\" ${MAIL_ADDRESS}";
fi
cd ${OLDDIR};
exit;
## End of Script.
## GPL follows:
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
syntax highlighted by Code2HTML, v. 0.9.1