Subversion Repositories ALCASAR

Rev

Rev 401 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 401 Rev 519
1
#!/bin/sh
1
#!/bin/sh
2
# $Id: alcasar-bypass.sh 401 2011-01-02 22:40:57Z richard $
2
# $Id: alcasar-bypass.sh 519 2011-03-25 16:30:32Z stephane $
3
 
3
 
4
# Script portail-bypass
4
# Script portail-bypass
5
# Permet d'activer ou de désactiver le contournement de l'authentification et du filtrage WEB
5
# Permet d'activer ou de désactiver le contournement de l'authentification et du filtrage WEB
6
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
6
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
7
SED="/bin/sed -i"
7
SED="/bin/sed -i"
8
nb_args=$#
8
nb_args=$#
9
args=$1
9
args=$1
10
if [ $nb_args -eq 0 ]
10
if [ $nb_args -eq 0 ]
11
then
11
then
12
	nb_args=1
12
	nb_args=1
13
	args="-h"
13
	args="-h"
14
fi
14
fi
15
case $args in
15
case $args in
16
	-\? | -h* | --h*)
16
	-\? | -h* | --h*)
17
		echo "$usage"
17
		echo "$usage"
18
		exit 0
18
		exit 0
19
		;;
19
		;;
20
	--on | -on)	
20
	--on | -on)	
21
		# activation du contournement
21
		# activation du contournement
22
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
22
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
23
		do
23
		do
24
			if  (pgrep $i) > /dev/null ; then /etc/init.d/$i stop ; fi
24
			if  (pgrep $i) > /dev/null ; then /etc/init.d/$i stop ; fi
25
		done
25
		done
26
		echo "Configure eth1 ..."
26
		echo "Configure eth1 ..."
27
		ifup eth1
27
		ifup eth1
28
		sh /usr/local/bin/alcasar-iptables-bypass.sh
28
		sh /usr/local/bin/alcasar-iptables-bypass.sh
29
		echo "Configure dnsmasq ..."
29
		echo "Configure dnsmasq ..."
30
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
30
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
31
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
31
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
32
		/etc/init.d/dnsmasq start
32
		/etc/init.d/dnsmasq start
33
		echo "Le contournement des modules d'authentification de filtrage est activé"
33
		echo "Le contournement des modules d'authentification de filtrage est activé"
34
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
34
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
35
		;;
35
		;;
36
	--off | -off)
36
	--off | -off)
37
		# désactivation du contournement
37
		# désactivation du contournement
38
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
38
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
39
		echo "Configure dnsmasq ..."
39
		echo "Configure dnsmasq ..."
40
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
40
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
41
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=eth1?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
41
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=eth1?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
42
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
42
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
43
		do
43
		do
44
			if  ! (pgrep $i) > /dev/null ; then /etc/init.d/$i start ; fi
44
			if  ! (pgrep $i) > /dev/null ; then /etc/init.d/$i start ; fi
45
		done
45
		done
46
		sh /usr/local/bin/alcasar-iptables.sh
46
		sh /usr/local/bin/alcasar-iptables.sh
47
		echo "L'authentification et le filtrage sont de nouveau activés"
47
		echo "L'authentification et le filtrage sont de nouveau activés"
48
;;
48
;;
49
	*)
49
	*)
50
		echo "Argument inconnu :$1";
50
		echo "Argument inconnu :$1";
51
		echo "$usage"
51
		echo "$usage"
52
		exit 1
52
		exit 1
53
		;;
53
		;;
54
esac
54
esac
55
 
55