Subversion Repositories ALCASAR

Rev

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

Rev 519 Rev 520
Line 1... Line 1...
1
#/bin/sh
1
#/bin/sh
2
# $Id: alcasar-bl.sh 519 2011-03-25 16:30:32Z stephane $
2
# $Id: alcasar-bl.sh 520 2011-03-27 20:55:05Z richard $
3
 
3
 
4
# Script de gestion de la BL pour le filtrage de domaine (via dnsmasq) et d'URL (via dansguardian)
4
# Script de gestion de la BL pour le filtrage de domaine (via dnsmasq) et d'URL (via dansguardian)
5
# By 3abtux & rexy
5
# By 3abtux & rexy
6
 
6
 
7
DIR_tmp="/tmp/blacklists"
7
DIR_tmp="/tmp/blacklists"
Line 13... Line 13...
13
DIR_DNS_FILTER_AVAILABLE="/usr/local/etc/alcasar-dnsfilter-available"
13
DIR_DNS_FILTER_AVAILABLE="/usr/local/etc/alcasar-dnsfilter-available"
14
DIR_DNS_FILTER_ENABLED="/usr/local/etc/alcasar-dnsfilter-enabled"
14
DIR_DNS_FILTER_ENABLED="/usr/local/etc/alcasar-dnsfilter-enabled"
15
IP_RETOUR="192.168.182.1"
15
IP_RETOUR="192.168.182.1"
16
BL_SERVER="cri.univ-tlse1.fr"
16
BL_SERVER="cri.univ-tlse1.fr"
17
SED="/bin/sed -i"
17
SED="/bin/sed -i"
18
 
-
 
19
# Récupération de l'archive de la BL Toulouse
18
# Récupération de l'archive de la BL Toulouse
20
function transfert () {
19
function transfert () {
21
	mkdir -p $DIR_tmp
20
	mkdir -p $DIR_tmp
22
	cd $DIR_tmp
21
	cd $DIR_tmp
23
	wget http://$BL_SERVER/blacklists/download/blacklists.tar.gz
22
	wget http://$BL_SERVER/blacklists/download/blacklists.tar.gz
Line 94... Line 93...
94
	# activation du filtrage
93
	# activation du filtrage
95
	-on | --on)	
94
	-on | --on)	
96
		cat_choice
95
		cat_choice
97
		$SED "s/^reportinglevel =.*/reportinglevel = 3/g" /etc/dansguardian/dansguardian.conf
96
		$SED "s/^reportinglevel =.*/reportinglevel = 3/g" /etc/dansguardian/dansguardian.conf
98
		$SED "s?^#\"?\"?g" $DIR_DG/urlregexplist # Enable 'safesearch'
97
		$SED "s?^#\"?\"?g" $DIR_DG/urlregexplist # Enable 'safesearch'
-
 
98
		$SED "s?^DNS_FILTERING.*?DNS_FILTERING=\"yes\"?g" /usr/local/bin/alcasar-iptables.sh
99
		if [ "$PARENT_SCRIPT" != "/usr/local/bin/alcasar-conf.sh" ] # on ne relance pas les processus lors d'une install
99
		if [ "$PARENT_SCRIPT" != "/usr/local/bin/alcasar-conf.sh" ] # on ne relance lors d'une install
100
		then
100
		then
101
		service dansguardian restart
101
		service dansguardian restart
102
		service dnsmasq stop
-
 
103
		sleep 1
-
 
104
		service dnsmasq start
102
		/usr/local/bin/alcasar-iptables.sh
105
		fi
103
		fi
106
		;;
104
		;;
107
	# désactivation du filtrage
105
	# désactivation du filtrage
108
	-off | --off)
106
	-off | --off)
109
		rm -rf $DIR_DNS_FILTER_ENABLED/*
107
		rm -rf $DIR_DNS_FILTER_ENABLED/*
110
		$SED "s/^reportinglevel =.*/reportinglevel = -1/g" /etc/dansguardian/dansguardian.conf
108
		$SED "s/^reportinglevel =.*/reportinglevel = -1/g" /etc/dansguardian/dansguardian.conf
111
		$SED "s?^[^#]?#&?g" $DIR_DG/urlregexplist # Disable 'safesearch'
109
		$SED "s?^[^#]?#&?g" $DIR_DG/urlregexplist # Disable 'safesearch'
-
 
110
		$SED "s?^DNS_FILTERING.*?DNS_FILTERING=\"no\"?g" /usr/local/bin/alcasar-iptables.sh
112
		if [ "$PARENT_SCRIPT" != "/usr/local/bin/alcasar-conf.sh" ] # on ne relance pas les processus lors d'une install
111
		if [ "$PARENT_SCRIPT" != "/usr/local/bin/alcasar-conf.sh" ] # on ne relance lors d'une install
113
		then
112
		then
114
		service dansguardian restart
113
		service dansguardian restart
115
		service dnsmasq stop
-
 
116
		sleep 1
-
 
117
		service dnsmasq start
114
		/usr/local/bin/alcasar-iptables.sh
118
		fi
115
		fi
119
		;;
116
		;;
120
	# Mise a jour de la blacklist 'Toulouse' et adaptation à dansguardian et dnsmasq
117
	# Mise a jour de la blacklist 'Toulouse' et adaptation à dansguardian et dnsmasq
121
	-download | --download)
118
	-download | --download)
122
		rm -rf /tmp/con_ok.html
119
		rm -rf /tmp/con_ok.html