Subversion Repositories ALCASAR

Rev

Rev 1931 | Rev 1936 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1931 Rev 1933
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 1931 2016-06-09 21:09:15Z richard $
3
# $Id: alcasar-bl.sh 1933 2016-06-10 08:50:46Z richard $
4
 
4
 
5
# alcasar-bl.sh
5
# alcasar-bl.sh
6
# by Franck BOUIJOUX and Richard REY
6
# by Franck BOUIJOUX and Richard REY
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
8
 
8
 
Line 40... Line 40...
40
# enable/disable the BL & WL categories
40
# enable/disable the BL & WL categories
41
function cat_choice (){
41
function cat_choice (){
42
	mkdir -p $DIR_tmp
42
	mkdir -p $DIR_tmp
43
	for LIST in $DIR_IP_BL_ENABLED $DIR_DNS_BL_ENABLED $DIR_IP_WL_ENABLED $DIR_DNS_WL_ENABLED
43
	for LIST in $DIR_IP_BL_ENABLED $DIR_DNS_BL_ENABLED $DIR_IP_WL_ENABLED $DIR_DNS_WL_ENABLED
44
	do
44
	do
-
 
45
		if [ ! -e $LIST ] # installation of ALCASAR
-
 
46
		then
-
 
47
			mkdir $LIST
-
 
48
		else
45
		rm -rf $LIST/*
49
			rm -rf $LIST/*
-
 
50
		fi
-
 
51
		chown root:apache $LIST
-
 
52
		chmod 770 $LIST
46
	done
53
	done
47
	# update categories with rsync
54
	# update categories with rsync
48
	if [ ! -e $DIR_CONF/update_cat.conf ]
55
	if [ ! -e $DIR_CONF/update_cat.conf ]
49
	then
56
	then
50
		touch $DIR_CONF/update_cat.conf
57
		touch $DIR_CONF/update_cat.conf
Line 176... Line 183...
176
		fi
183
		fi
177
		rm -f $BL_CATEGORIES $WL_CATEGORIES
184
		rm -f $BL_CATEGORIES $WL_CATEGORIES
178
		rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
185
		rm -rf $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
179
		touch $BL_CATEGORIES $WL_CATEGORIES
186
		touch $BL_CATEGORIES $WL_CATEGORIES
180
		mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
187
		mkdir $DIR_DNS_BL $DIR_DNS_WL $DIR_IP_BL $DIR_IP_WL
181
		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
188
		chown -R root: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
182
		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
189
		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
183
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
190
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
184
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
191
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
185
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
192
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
186
		do
193
		do