Setup script to automatically update Dansguardian blacklists

Dansguardian website does not provide updates to the blacklists that were originally shipped in the Dansguardian package.  You have two options to download blacklists for your Dansguardian install: and Unfortunately requires a comercial subscription if you wish to regularly download their blacklist. I would think you can download once and give it a try.

An alternative is to download it from  Shalla lists can be downloaded for free if your are not using for comercial purposes.  As long as you do not download from their website too often you will probably not be blocked from downloading their lists.
As any third party list that you add to Dansguardian, you need to manually edit Dansguardian config files so that it is aware of the new lists.
Let's first download the list manually and configure Dansguardian files manually to include all Shalla listings.
1) Download shalla list called shallalist.tar.gz and extract all the listing directories to /etc/dansguardian/lists/BL
       cd /etc/dansguardian/lists
       tar -xvzf shallalist.tar.gz
       chown -R root/root /etc/dansguardian/lists/BL
2) Download  bigblacklist.tar.gz and extract all the listing directories to /etc/dansguardian/lists/blacklists
       cd /etc/dansguardian/lists
       tar -xvzf bigblacklist.tar.gz
       chown -R root/root /etc/dansguardian/lists/blacklists
3) Create two files under /etc/dansguardian/lists/BL.  One file will be called bannedurllist_shalla and will contain includes for all urls files and the other will be called bannedsitelist_shalla and will have includes for all the domains files.
      .i.e. vim /etc/dansguardian/lists/BL/bannedurllist_shalla
            vim /etc/dansguardian/lists/BL/bannedsitelist_shalla
4) Create three files under /ect/dansguardian/lists/blacklists. The files will be called bannedurllist_urlblacklist, bannedsitelist_urlblacklist, and bannedregexpurllist_urlblacklist.  Like the previous step these file will contain includes for urls, domains, and regular expressions from
        .i.e. vim /etc/dansguardian/blacklists/bannedregexpurllist_urlblacklist
               vim /etc/dansguardian/blacklists/bannedurllist_urlblacklist
                vim /etc/dansguardian/blacklists/bannedsitelist_urlblacklist
5) Edit existing dansguardian conf files to include these two new files you created.  This should increase the list of urls and domains being blocked.
      Add the following include at the end /etc/dansguardian/lists/bannedurllist file
      Add the following include at the end of /etc/dansguardian/lists/bannedsitelist file
       Add the following include at the end of /etc/dansguardian/lists/bannedregexpurllist
4) Restart dansguardian so that it becomes aware of the new lists by running the following in a terminal window
            dansguardian -r
Now that we have manually added new lists to dansguardian let's setup a process that automatically downloads and updates the list of banned urls and sites by following the steps below:
1) Download a helper called updshalla.tgz from Remigio Conti at This is the only script available for Dansguardian. 
2) Install the helper in /etc/dansguardian/updshalla
    cd /etc/dansguardian
    tar -xzvf updshalla.tgz
3) Create an empty log file for updshalla script at /var/log/updshalla.log
    touch /var/log/updshalla.log
4) updshalla uses mailsend binary to send emails when errors happen.  This is an unsupported app that has not been updated since 2007 so we will replace with mutt
          pacman -S mutt
          vim ~/.muttrc
                set my_pass='mysecretpass'
                set my_user='myusername'
                set smtp_url=smtps://$my_user:$
                set ssl_force_tls = yes
                set realname="Your Name"
                set from=$
          Test mutt from the command line
               mutt -s "Test Subject" <<< "This is a test email"
5) Fix updshalla script to use mutt  
          cd  /etc/dansguardian/updshalla
          vim updshalla
             change MAILSEND='/usr/local/bin/mailsend'  to MAILSEND='/usr/bin/mutt'
             change CUT='/usr/bin/cut' to CUT='/bin/cut'
             change AWK='/usr/bin/awk' to AWK='/bin/awk'
                    $MAILSEND -d $DOMAIN -smtp $SMTPHOST -p $SMTPPORT -t $DESTMAIL +cc +bc -f $SENDER -sub "$SUBJECT" -a "$LOGFILE,text/plain" -M "$BODY" 1>/dev/null 2>&1
                      $MAILSEND -s "$SUBJECT" -a "$LOGFILE" -- $DESTMAIL <<< "$BODY" 
                     MATCHRES=`$DIFF -qr BL $LISTBASE|$AWK '/Only/ && !/COPYRIGHT/ && !/global_usage/ && !/processed/ && !/diff/'`
                     MATCHRES=`$DIFF -qr BL $LISTBASE|$AWK '/Only/ && !/COPYRIGHT/ && !/global_usage/ && !/processed/ && !/diff/ && !/bannedurllist_shalla/ && !/bannedsitelist_shalla/ && !/bannedregexpurllist_shalla/ && !/exceptionurllist_shalla/ && !/exceptionsitelist_shalla/'`
            change chown -R dansguardian:dansguardian * to chown -R root:root *
           Note:Attach a file to your message using MIME.  When attaching single or multiple files, separating filenames and recipient  addresses with  "--" is mandatory, e.g. mutt -a image.jpg -- addr1 or mutt -a img.jpg *.png -- addr1 addr2.  The -a option must  be  placed at the end of command line options.
6) Edit updshalla.conf to update the location of shalla black list in the local server
         vim updshalla.conf
             change LISTBASE='/etc/dansguardian/lists/blacklists/shalla'  to LISTBASE='/etc/dansguardian/lists/BL'
             change DESTMAIL='' to DESTMAIL=''
             delete the following lines
                  # SMTP SERVER
                   # SMTP PORT
                   # SENDER DOMAIN 
                   # SENDER MAIL
7)  Run updshalla every Sunday at midnight via crontab. crontab headers are minute,  hour, day, month, dayofweek, and command.
          crontab -e
          0 0 * * 0 ./etc/dansguardian/updshalla/updshalla
Additional documentation:



No votes yet