Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1928 → Rev 1930

/alcasar.sh
1595,9 → 1595,10
##########################################################
BL ()
{
# copy and extract Toulouse university BL
# copy the Toulouse university BL in order to be adapted to ALCASAR architecture (alcasar-bl.sh -adapt)
rm -rf $DIR_DG/lists/blacklists
tar zxf $DIR_CONF/blacklists.tar.gz --directory=$DIR_DG/lists/ > /dev/null 2>&1
mkdir -p /tmp/blacklists
cp $DIR_CONF/blacklists.tar.gz /tmp/blacklists/
# creation of file for the rehabilited domains and urls
[ -e $DIR_DG/lists/exceptionsitelist.default ] || mv $DIR_DG/lists/exceptionsitelist $DIR_DG/lists/exceptionsitelist.default
[ -e $DIR_DG/lists/exceptionurllist.default ] || mv $DIR_DG/lists/exceptionurllist $DIR_DG/lists/exceptionurllist.default
1627,15 → 1628,15
$SED "s?safe=vss?safe=strict?g" $DIR_DG/lists/urlregexplist
# creation of the custom BL and WL categorie named "ossi" (for domain names & ip only)
if [ "$mode" != "update" ]; then
mkdir $DIR_DG/lists/blacklists/ossi-bl
mkdir -p $DIR_DG/lists/blacklists/ossi-bl
touch $DIR_DG/lists/blacklists/ossi-bl/domains
mkdir $DIR_DG/lists/blacklists/ossi-wl
mkdir -p $DIR_DG/lists/blacklists/ossi-wl
touch $DIR_DG/lists/blacklists/ossi-wl/domains
# add custom ALCASAR BL files
for x in $(ls $DIR_CONF/etc/ | grep "^ossi-*")
for x in $(ls $DIR_CONF | grep "^ossi-*")
do
mkdir $DIR_DG/lists/blacklists/$x
cp $DIR_CONF/etc/$x $DIR_DG/lists/blacklists/$x/domains
cp $DIR_CONF/$x $DIR_DG/lists/blacklists/$x/domains
done
chown -R dansguardian:apache $DIR_DG $DIR_DEST_SHARE
chmod -R g+rw $DIR_DG $DIR_DEST_SHARE
/scripts/alcasar-bl.sh
46,82 → 46,10
# enable/disable the BL & WL categories
function cat_choice (){
mkdir $DIR_tmp
#ip BL ENABLE
if [ -d $DIR_IP_BL_ENABLED ]
then
for file in `ls -1 $DIR_IP_BL_ENABLED | grep -v "^ossi-*"`
do
rm -f $DIR_IP_BL_ENABLED/$file
done
else
mkdir $DIR_IP_BL_ENABLED
chown root:apache $DIR_IP_BL_ENABLED
chmod 770 $DIR_IP_BL_ENABLED
fi
 
#dns BL ENABLED
if [ -d $DIR_DNS_BL_ENABLED ]
then
for file in `ls -1 $DIR_DNS_BL_ENABLED | grep -v "^ossi-*"`
do
rm -f $DIR_DNS_BL_ENABLED/$file
done
else
mkdir $DIR_DNS_BL_ENABLED
chown root:apache $DIR_DNS_BL_ENABLED
chmod 770 $DIR_DNS_BL_ENABLED
fi
#dns BL ossi.conf
if [ ! -e $DIR_DNS_BL/ossi.conf ]
then
touch $DIR_DNS_BL/ossi.conf
chown root:apache $DIR_DNS_BL/ossi.conf
chmod g+w $DIR_DNS_BL/ossi.conf
if [ ! -e $DIR_DNS_BL_ENABLED/ossi ]
then
ln -s $DIR_DNS_BL/ossi.conf $DIR_DNS_BL_ENABLED/ossi
fi
fi
 
#ip WL ENABLE
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
touch $DIR_IP_WL_ENABLED/ossi
chown -R root:apache $DIR_IP_WL_ENABLED
chmod 770 $DIR_IP_WL_ENABLED
chmod g+w $DIR_IP_WL_ENABLED/ossi
fi
 
#dns WL ENABLED
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 root:apache $DIR_DNS_WL_ENABLED
chmod 770 $DIR_DNS_WL_ENABLED
fi
#dns WL ossi.conf
if [ ! -e $DIR_DNS_WL/ossi.conf ]
then
touch $DIR_DNS_WL/ossi.conf
chown root:apache $DIR_DNS_WL/ossi.conf
chmod g+w $DIR_DNS_WL/ossi.conf
if [ ! -e $DIR_DNS_WL_ENABLED/ossi ]
then
ln -s $DIR_DNS_WL/ossi.conf $DIR_DNS_WL_ENABLED/ossi
fi
fi
 
for dir_bl in $DIR_IP_BL_ENABLED $DIR_DNS_BL_ENABLED $DIR_IP_WL_ENABLED $DIR_DNS_WL_ENABLED
do
rm -f $dir_bl/*
done
# update categories with rsync
if [ ! -e $DIR_CONF/update_cat.conf ]
then
190,32 → 118,18
# Adapt Toulouse University BL to ALCASAR architecture (dnsmasq + DG + iptables)
-adapt | --adapt)
echo -n "Adaptation process of Toulouse University blackList. Please wait : "
# keep custom files (ossi)
for x in $(ls -1 $DIR_DG_BL | grep "^ossi-*")
do
mv $DIR_DG_BL/$x $DIR_tmp
done
if [ -f $DIR_tmp/blacklists.tar.gz ] # when downloading the last version of the BL
then
# keep custom files (ossi)
for x in $(ls -1 $DIR_DG_BL | grep "^ossi-*")
do
mv $DIR_DG_BL/$x $DIR_tmp
done
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/
fi
# Retrieve custom files (ossi)
for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
do
mv $DIR_tmp/$x $DIR_DG_BL
done
rm -f $BL_CATEGORIES $WL_CATEGORIES
rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
touch $BL_CATEGORIES $WL_CATEGORIES
mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
chown -R dansguardian:apache $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
chmod -R g+w $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
# Add the two local categories (ossi-bl & ossi-wl) to the usage file
cat << EOF >> $DIR_DG_BL/global_usage
# Add the two local categories (ossi-bl & ossi-wl) to the usage file
cat << EOF >> $DIR_DG_BL/global_usage
 
NAME: ossi-bl
DEFAULT_TYPE: black
241,6 → 155,20
NAME DE: ossi-wl
NAME ES: ossi-wl
EOF
# Retrieve custom files (ossi)
for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
do
mv $DIR_tmp/$x $DIR_DG_BL
done
fi
rm -f $BL_CATEGORIES $WL_CATEGORIES
rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
touch $BL_CATEGORIES $WL_CATEGORIES
mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
chown -R dansguardian:apache $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
chmod -R g+w $DIR_DG $BL_CATEGORIES $WL_CATEGORIES $BL_CATEGORIES_ENABLED $WL_CATEGORIES_ENABLED $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
do
categorie=`echo $dir_categorie|cut -d "/" -f6`
248,8 → 176,9
if [ "$categorie_type" == "white" ]
then
echo "$dir_categorie" >> $WL_CATEGORIES
else
echo "$dir_categorie" >> $BL_CATEGORIES
fi
echo "$dir_categorie" >> $BL_CATEGORIES
done
rm -f $FILE_tmp
# Verify that the enabled categories are effectively in the BL (need after an update of the BL)