Subversion Repositories ALCASAR

Rev

Rev 383 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
1 root 1
#!/bin/sh
63 franck 2
# $Id: alcasar-bypass.sh 401 2011-01-02 22:40:57Z richard $
3
 
1 root 4
# Script portail-bypass
5
# Permet d'activer ou de désactiver le contournement de l'authentification et du filtrage WEB
383 franck 6
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
401 richard 7
SED="/bin/sed -i"
1 root 8
nb_args=$#
9
args=$1
10
if [ $nb_args -eq 0 ]
11
then
12
	nb_args=1
13
	args="-h"
14
fi
15
case $args in
16
	-\? | -h* | --h*)
17
		echo "$usage"
18
		exit 0
19
		;;
383 franck 20
	--on | -on)	
1 root 21
		# activation du contournement
401 richard 22
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
1 root 23
		do
24
			if  (pgrep $i) > /dev/null ; then /etc/init.d/$i stop ; fi
25
		done
26
		echo "Configure eth1 ..."
27
		ifup eth1
28
		sh /usr/local/bin/alcasar-iptables-bypass.sh
401 richard 29
		echo "Configure dnsmasq ..."
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
32
		/etc/init.d/dnsmasq start
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"
1 root 35
		;;
383 franck 36
	--off | -off)
1 root 37
		# désactivation du contournement
348 franck 38
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
401 richard 39
		echo "Configure dnsmasq ..."
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
42
		for i in chilli squid dansguardian havp mysqld radiusd httpd freshclam dnsmasq
1 root 43
		do
44
			if  ! (pgrep $i) > /dev/null ; then /etc/init.d/$i start ; fi
45
		done
46
		sh /usr/local/bin/alcasar-iptables.sh
401 richard 47
		echo "L'authentification et le filtrage sont de nouveau activés"
1 root 48
;;
49
	*)
50
		echo "Argument inconnu :$1";
51
		echo "$usage"
52
		exit 1
53
		;;
54
esac