EFW Support

Development => Contribute Your Customisations & Modifications => Topic started by: JHickman on Thursday 24 May 2012, 03:31:00 pm



Title: Greater Blacklist for 2.5.1
Post by: JHickman on Thursday 24 May 2012, 03:31:00 pm
After some fidling with the original blacklist updater from jaebird, g.vecchi and portucale I have updated the script as below for 2.5.1 since the file locations changed.

I only later saw RHickman's python aproach but since I don't know python I don't know how its error handling works.

The below script will error out if the downloaded file is corrupt. The original script would continue and Dansgaurdian will fail to start again and/or you will only have a few categories in your dansgaurdian config opening your proxy to all those sites you think you blocked posibly.

I have also added the following line to force curl to use an upstream proxy without a username or password since my box does not have direct internet access and the profile.d workaround did not work for me.

Save this file as /etc/cron.weekly/update_blacklist.sh and execute it

Code:

export http_proxy=Proxy_Server


Due to restrictions on this site you will need to edit the following lines:

export http_proxy=Proxy_Server
curl -C - -O URL_to_Shallalist

Here is my code modification:
Save this file as /etc/cron.weekly/update_blacklist.sh and execute it.

Code:

#!/bin/sh -e

cd /tmp

if [ -a /tmp/shallalist.tar.gz ]
  then
    rm -r /tmp/shallalist.tar.gz
fi
export http_proxy=Proxy_Server
curl -C - -O URL_to_Shallalist

if [ -a /tmp/BL ]
  then
    rm -r /tmp/BL
fi

tar -xvzf shallalist.tar.gz

if [ -a /var/signatures/dansguardian/blacklists.bak ]
  then
    rm -r /var/signatures/dansguardian/blacklists.bak
fi

if [ -a /tmp/shallalist.tar.gz ]
  then


mv /var/signatures/dansguardian/blacklists /var/signatures/dansguardian/blacklists.bak

mkdir /var/signatures/dansguardian/blacklists/

cp -r /tmp/BL/* /var/signatures/dansguardian/blacklists/

rm -r /var/signatures/dansguardian/blacklists/COPYRIGHT

rm -r /var/signatures/dansguardian/blacklists/global_usage

date > /var/signatures/dansguardian/blacklists/updated



# Create categories file
for i in `ls /var/signatures/dansguardian/blacklists/`; do
  if [ "$i" != "categories" ]; then
    echo "$i"="$i" >> /var/signatures/dansguardian/blacklists/categories;
  fi
done

/etc/init.d/dansguardian restart

fi

if [ -a /tmp/shallalist.tar.gz ]
  then
    rm -r /tmp/shallalist.tar.gz
fi

if [ -a /tmp/BL ]
  then
    rm -r /tmp/BL
fi

exit 0