New DansGuardian Blacklist Update Script – by Brock M. Tice

DansguardianBrock M. Tice has generously taken the time to completely rewrite a new and superior update script for use with our blacklists and DansGuardian, and we have replaced the old script with this one, as there is essentially no use for the old one as this is far superior, and here it is.

 

It is also available for download compressed here.

 

#! /bin/bash
#
# DansGuardian Blacklist Updater Script v0.2 - Squidblacklist.org
# Thoughts or suggestions can be emailed to webmaster@squidblacklist.org
# 0.1->0.2 parameterization by Brock M. Tice
#
# Use this script to download and update blacklists for squid3 proxy
# You may need to edit this for your specific environment.
# you may optionaly wish to crontab this job so it will update at regular intervals
#
# Place this script within /etc/dansguardian/ directory
# Next, chmod +x squid-update.sh .That will make the script executable.
#
# nano /etc/crontab and add the following line
# 01 0 * * * root /etc/dansguardian/squid-update.sh
#
# Available ACLs:
#
# all
# prime
# malicious
# usg
# piracy
# porn
# dating
# ads
# proxies
# gaming
# smedia
# gambling
# cp
# blasphemy
# file
# image
# video
# pharma-rx
# new-tlds
# chanology
# dyn
# freeweb
# racism

# This is the base url for the lists -- do not edit
BASEURL=http://www.squidblacklist.org/downloads/squidblacklists/dg/

# Place the names of the sub-lists you want here, syntax enabled=( list1 list2 list3 ... listN )
enabled=( prime malicious piracy porn dating ads proxies gaming gambling cp pharma-rx chanology racism )

# squidblacklist.org username
USERNAME=userhere
PASSWORD=passhere
LISTBASE=/etc/dansguardian/lists/blacklists/

# enable dansguardian blacklist include line output
DGINCLUDEFILE=/etc/dansguardian/squidblacklist-includes.list
echo > "${DGINCLUDEFILE}"

echo Beginning squidblacklist.org Dansguardian Blacklist Update procedure... ;
cd /etc/dansguardian/ ;
echo Downloading blacklists...

# This loop uses the "enabled" list and the BASEURL to download, decompress, and move the list to the proper place for each specified list
# echos are temporary for testing
for listname in ${enabled[@]}; do
BASENAME="dg-${listname}"
wget --http-user="${USERNAME}" --http-password="${PASSWORD}" --auth-no-challenge "${BASEURL}${BASENAME}.tar.gz"
tar -xvf "${BASENAME}.tar.gz"
if [ ! -d "${LISTBASE}${listname}" ] && [ ! -f "${LISTBASE}${listname}" ]; then
mkdir -p "${LISTBASE}${listname}"
elif [ -f "${LISTBASE}${listname}" ]; then
printf "WARNING: Skipping list %s, %s already exists but is not a directory\n" "${listname}" "${LISTBASE}${listname}" >&2
continue
fi
mv "${BASENAME}.acl" "${LISTBASE}${listname}/domains"

# update include file
echo ".Include<${LISTBASE}${listname}/domains>" >> "${DGINCLUDEFILE}"

rm "${BASENAME}.tar.gz"
done

echo "Reloading Dansguardian Service... "
service dansguardian restart
echo "Done."

echo "If you have not already, add .Include<${DGINCLUDEFILE}> to your /etc/dansguardian/lists/bannedsitelist>"


Subscribe Today – Paypal or Credit Card Accepted.

Flat rate subscription. Select a membership option & subscribe.



Select Payment Option



  • You will be issued a username and password.
  • You will be granted access to our member area.
  • 3 Year Membership Option now available.
  • Contact us if you would like a pre order invoice.

Disclaimer: All sales are final, we do not issue refunds. Cancel your subscription anytime.

3 Replies to “New DansGuardian Blacklist Update Script – by Brock M. Tice”

  1. Hello, this script could use a couple of updates.

    One – the name of the script seems to be dg-update.sh, but in the script the cron example uses squid-update.sh as the name.

    Two – the prime list was just discontinued, so mentions of it should be removed.

    Thanks
    Josh

    1. Thank you for bringing this to our attention, I had just updated both of the squid-update-v1.sh and squid-update-v2.sh files, and apparently I had completely overlooked the dg update scripts, I this morning however, have corrected the issues that you mentioned.

      Thank you.

  2. [* Shield plugin marked this comment as “trash”. Reason: Failed GASP Bot Filter Test (checkbox) *]
    I have learn a few excellent stuff here. Definitely worth bookmarking for revisiting.

    I wonder how a lot attempt you place to create this type of great informative web
    site.

Leave a Reply

Your email address will not be published. Required fields are marked *

*