24,7 → 24,6 |
BL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-bl-categories-enabled" # ' ' BL enabled categories |
WL_CATEGORIES_ENABLED="$DIR_CONF/alcasar-wl-categories-enabled" # ' ' WL enabled categories |
DIR_SHARE="/usr/local/share" |
FILE_IP_WL="$DIR_SHARE/ossi_wl" |
DIR_DNS_BL="$DIR_SHARE/dnsmasq-bl" # all the BL in the DNSMASQ format |
DIR_DNS_WL="$DIR_SHARE/dnsmasq-wl" # all the WL ' ' ' |
DIR_IP_BL="$DIR_SHARE/iptables-bl" # all the IP addresses of the BL |
96,15 → 95,12 |
/usr/local/bin/alcasar-iptables.sh |
fi |
} |
usage="Usage: alcasar-bl.sh { -on or --on } | { -off or --off } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload }" |
usage="Usage: alcasar-bl.sh { -cat_choice or --cat_choice } | { -download or --download } | { -adapt or --adapt } | { -reload or --reload }" |
nb_args=$# |
args=$1 |
if [ $nb_args -eq 0 ] |
then |
echo "Set BlackList Filtering to ON" |
cat_choice |
bl_enable |
exit 0 |
args="-h" |
fi |
case $args in |
-\? | -h* | --h*) |
111,18 → 107,10 |
echo "$usage" |
exit 0 |
;; |
# enable the filtering |
-on | --on) |
# Retrieve Toulouse BL |
-cat_choice | --cat_choice) |
cat_choice |
$SED "s?^DNS_FILTERING.*?DNS_FILTERING=on?g" $CONF_FILE |
bl_enable |
;; |
# disable the filtering |
-off | --off) |
$SED "s?^DNS_FILTERING.*?DNS_FILTERING=off?g" $CONF_FILE |
bl_disable |
;; |
# Retrieve Toulouse BL |
-download | --download) |
rm -rf /tmp/con_ok.html |
`/usr/bin/curl $BL_SERVER -# -o /tmp/con_ok.html` |
140,21 → 128,20 |
# Adapt Toulouse BL to ALCASAR architecture (dnsmasq + DG + iptables) |
-adapt | --adapt) |
echo -n "Toulouse BlackList migration process. Please wait : " |
# Saving whitelist ip |
if [ -e $FILE_IP_WL ] |
# Saving OSSI files (IP_WL, IP_BL, domain) |
if [ -e $DIR_SHARE/ossi-ip-wl ] |
then |
cp $FILE_IP_WL $DIR_tmp |
cp $DIR_SHARE/ossi-ip-wl $DIR_tmp/ossi-ip-wl |
else |
touch $FILE_IP_WL |
chown apache $FILE_IP_WL |
touch $DIR_SHARE/ossi-ip-wl |
chown apache $DIR_SHARE/ossi-ip-wl |
fi |
# Saving ossi category |
if [ -f $DIR_tmp/blacklists.tar.gz ] |
then |
[ -d $DIR_DG_BL/ossi ] && mv $DIR_DG_BL/ossi $DIR_tmp |
[ -e $DIR_IP_BL/ossi ] && mv $DIR_IP_BL/ossi $DIR_tmp/ossi-ip |
rm -rf $DIR_DG_BL |
mkdir $DIR_DG_BL |
[ -e $DIR_IP_BL/ossi ] && mv $DIR_IP_BL/ossi $DIR_tmp/ossi-ip-bl |
rm -rf $DIR_DG_BL $DIR_IP_BL |
mkdir $DIR_DG_BL $DIR_IP_BL |
tar zxf $DIR_tmp/blacklists.tar.gz --directory=$DIR_DG/ |
[ -d $DIR_tmp/ossi ] && mv -f $DIR_tmp/ossi $DIR_DG_BL/ |
fi |
224,9 → 211,8 |
done |
rm -f $FILE_tmp $FILE_ip_tmp |
# Restoring ossi files |
[ -e $DIR_tmp/ossi-ip ] && mv $DIR_tmp/ossi-ip $DIR_IP_BL/ossi |
[ -e $DIR_tmp/ossi_wl ] && mv $DIR_tmpi/ossi_wl $DIR_SHARE/ossi_wl |
fi |
[ -e $DIR_tmp/ossi-ip-bl ] && mv $DIR_tmp/ossi-ip-bl $DIR_IP_BL/ossi |
[ -e $DIR_tmp/ossi-ip-wl ] && mv $DIR_tmp/ossi-ip-wl $DIR_SHARE/ossi-ip-wl |
rm -rf $DIR_tmp |
echo |
;; |