Created
March 15, 2012 11:14
-
-
Save michal-m/2043707 to your computer and use it in GitHub Desktop.
Sblam Updater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Autoupdater for SBLAM! blacklist and converter to nginx deny format | |
# Based on sblam_nginx.sh by Marcin M. (exine): | |
# https://bitbucket.org/exine/scriptlets/src/tip/sblam/sblam_nginx.sh | |
BLACKLIST="http://sblam.com/blacklisthtaccess.txt" # Adress of the source blacklist | |
HTACCESS="/usr/local/www/apache22/data/.htaccess" # Under this path blacklist will be saved. Do NOT set this to any file that needs to contain something else than blacklist, it is cleared every time this script runs | |
DATE=`date` # Do not change unless you know what you're doing | |
TMP_BLACKLIST="/tmp/spammer_blacklist.txt" | |
touch ${TMP_BLACKLIST} | |
chmod 0600 ${TMP_BLACKLIST} # /tmp race prevention | |
/usr/local/bin/wget -O- ${BLACKLIST} > ${TMP_BLACKLIST} | |
echo "# This file is updated periodically, do not edit" > ${HTACCESS} | |
echo "# Last update: ${DATE}" >> ${HTACCESS} | |
cat ${TMP_BLACKLIST} >> ${HTACCESS} | |
rm ${TMP_BLACKLIST} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment