15,6 → 15,7 |
private_ip_mask=${private_ip_mask:=192.168.182.1/24} |
PRIVATE_IP=`echo $private_ip_mask | cut -d"/" -f1` # ALCASAR LAN IP address |
DIR_tmp="/tmp/blacklists" |
DIR_WL_tmp="/tmp/whitelists" |
FILE_tmp="/tmp/filesfilter.txt" |
FILE_ip_tmp="/tmp/filesipfilter.txt" |
DIR_DG="/etc/dansguardian/lists" |
31,6 → 32,8 |
DIR_DNS_BL_ENABLED="$DIR_SHARE/dnsmasq-bl-enabled" # symbolic link to the domains BL (only enabled categories) |
DIR_DNS_WL_ENABLED="$DIR_SHARE/dnsmasq-wl-enabled" # ' ' ' WL ' ' ' |
DIR_IP_BL_ENABLED="$DIR_SHARE/iptables-bl-enabled" # ' ' ip BL (only enabled categories) |
DIR_IP_WL_ENABLED="$DIR_SHARE/iptables-wl-enabled" # ' ' ip WL (ossi and ossi-* imported from ACC) |
DIR_IP_WL="$DIR_SHARE/iptables-wl-enabled" # ' ' ip WL (ossi and ossi-* imported from ACC) |
DNSMASQ_BL_CONF="/etc/dnsmasq-blacklist.conf" # conf file of dnsmasq-blacklist |
DNS1=`grep "DNS1" $CONF_FILE | cut -d '=' -f 2` # server DNS1 (for WL domain names) |
BL_SERVER="dsi.ut-capitole.fr" |
41,6 → 44,7 |
# saving ossi category |
mkdir $DIR_tmp |
cp $DIR_IP_BL/ossi $DIR_tmp |
|
if [ -d $DIR_IP_BL_ENABLED ] |
then |
for file in `ls -1 $DIR_IP_BL_ENABLED | grep -v "^ossi-*"` |
51,6 → 55,18 |
mkdir $DIR_IP_BL_ENABLED |
chown apache $DIR_IP_BL_ENABLED |
fi |
|
if [ -d $DIR_IP_WL_ENABLED ] |
then |
for file in `ls -1 $DIR_IP_WL_ENABLED | grep -v "^ossi-*"` |
do |
rm -f $DIR_IP_WL_ENABLED/$file |
done |
else |
mkdir $DIR_IP_WL_ENABLED |
chown apache $DIR_IP_WL_ENABLED |
fi |
|
if [ -d $DIR_DNS_BL_ENABLED ] |
then |
for file in `ls -1 $DIR_DNS_BL_ENABLED | grep -v "^ossi-*"` |
61,10 → 77,18 |
mkdir $DIR_DNS_BL_ENABLED |
chown apache $DIR_DNS_BL_ENABLED |
fi |
rm -rf $DIR_DNS_WL_ENABLED # cleaning for dnsmasq and iptables |
if [ -d $DIR_DNS_WL_ENABLED ] |
then |
for file in `ls -1 $DIR_DNS_WL_ENABLED | grep -v "^ossi-*"` |
do |
rm -f $DIR_DNS_WL_ENABLED/$file |
done |
else |
mkdir $DIR_DNS_WL_ENABLED |
chown apache $DIR_DNS_WL_ENABLED |
fi |
$SED "/\.Include/d" $DIR_DG/bannedsitelist $DIR_DG/bannedurllist # cleaning for DG |
$SED "s?^[^#]?#&?g" $BL_CATEGORIES $WL_CATEGORIES # cleaning BL & WL categories file (comment all lines) |
mkdir $DIR_DNS_WL_ENABLED |
# process the file $BL_CATEGORIES with the choice of categories |
for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED` |
do |
86,10 → 110,12 |
done |
sort +0.0 -0.2 $WL_CATEGORIES -o $FILE_tmp |
mv $FILE_tmp $WL_CATEGORIES |
# restoring ip files and ossi category |
|
# restoring ip files and ossi category BL/WL |
mv $DIR_tmp/ossi $DIR_IP_BL |
chown apache $DIR_IP_BL/ossi |
rm -rf $DIR_tmp |
|
} |
|
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload }" |
126,10 → 152,10 |
# Adapt Toulouse BL to ALCASAR architecture (dnsmasq + DG + iptables) |
-adapt | --adapt) |
echo -n "Toulouse BlackList migration process. Please wait : " |
if [ ! -e $DIR_SHARE/ossi-ip-wl ] |
if [ ! -e $DIR_IP_WL_ENABLED/ossi ] |
then |
touch $DIR_SHARE/ossi-ip-wl |
chown apache $DIR_SHARE/ossi-ip-wl |
touch $DIR_IP_WL_ENABLED/ossi |
chown apache $DIR_IP_WL_ENABLED/ossi |
fi |
if [ -f $DIR_tmp/blacklists.tar.gz ] # when downloading the last version of the BL |
then |