Subversion Repositories ALCASAR

Rev

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

Rev 1469 Rev 1482
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-bypass.sh 1469 2014-10-30 21:58:47Z richard $
2
# $Id: alcasar-bypass.sh 1482 2014-11-07 22:11:06Z richard $
3
 
3
 
4
# alcasar-bypass.sh
4
# alcasar-bypass.sh
5
# by 3abtux and Rexy
5
# by 3abtux and Rexy
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
8
# activation / désactivation du contournement de l'authentification et du filtrage WEB
8
# activation / désactivation du contournement de l'authentification et du filtrage WEB
9
# enable / disable the bypass of authenticate process and filtering
9
# enable / disable the bypass of authenticate process and filtering
10
 
10
 
11
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
11
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
12
SED="/bin/sed -i"
12
SED="/bin/sed -i"
13
CONF_FILE="/usr/local/etc/alcasar.conf"
13
CONF_FILE="/usr/local/etc/alcasar.conf"
14
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
14
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
15
 
15
 
16
nb_args=$#
16
nb_args=$#
17
args=$1
17
args=$1
18
if [ $nb_args -eq 0 ]
18
if [ $nb_args -eq 0 ]
19
then
19
then
20
	nb_args=1
20
	nb_args=1
21
	args="-h"
21
	args="-h"
22
fi
22
fi
23
case $args in
23
case $args in
24
	-\? | -h* | --h*)
24
	-\? | -h* | --h*)
25
		echo "$usage"
25
		echo "$usage"
26
		exit 0
26
		exit 0
27
		;;
27
		;;
28
	--on | -on)	
28
	--on | -on)	
29
		# activation du contournement
29
		# activation du contournement
30
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid 
30
		/usr/local/sbin/alcasar-logout.sh all
-
 
31
		for i in chilli 
31
		do
32
		do
32
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
33
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
33
		done
34
		done
34
		echo "$INTIF configuration ..."
-
 
35
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
35
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
36
		ifup $INTIF
36
		ifup $INTIF
37
		sh /usr/local/bin/alcasar-iptables-bypass.sh
37
		sh /usr/local/bin/alcasar-iptables-bypass.sh
38
		echo "dnsmasq Configuration ..."
-
 
39
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq-blacklist.conf
-
 
40
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
38
		$SED "s?^no-dhcp-interface.*?#&?g" /etc/dnsmasq.conf
41
		/etc/init.d/dnsmasq start
39
		/usr/bin/systemctl restart dnsmasq
42
		echo "Le contournement des modules d'authentification de filtrage est activé"
40
		echo "ALCASAR est en mode 'bypass'"
43
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
41
		echo "ALCASAR is in 'bypass' mode"
44
		;;
42
		;;
45
	--off | -off)
43
	--off | -off)
46
		# désactivation du contournement
44
		# désactivation du contournement
47
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
45
		$SED "s?^#no-dhcp-interface=$INTIF?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf
48
		echo "dnsmasq Configuration ..."
-
 
49
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/share/dnsmasq-bl-enabled?g" /etc/dnsmasq-blacklist.conf
46
		$SED "s?^#no-dhcp-interface=tun0?no-dhcp-interface=tun0?g" /etc/dnsmasq.conf
50
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
47
		$SED "s?^#no-dhcp-interface=lo?no-dhcp-interface=lo?g" /etc/dnsmasq.conf
-
 
48
		systemctl restart dnsmasq
51
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
49
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
52
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid	
-
 
53
		do
-
 
54
			if  ! (pgrep $i) > /dev/null ; then /usr/bin/systemctl start $i.service; fi
50
		/usr/bin/systemctl start chilli
55
		done
-
 
56
		sh /usr/local/bin/alcasar-iptables.sh
51
		sh /usr/local/bin/alcasar-iptables.sh
57
		echo "L'authentification et le filtrage sont de nouveau activés"
52
		echo "L'authentification et le filtrage sont actifs"
-
 
53
		echo "Authentication ans filterig system are enabled"
58
;;
54
;;
59
	*)
55
	*)
60
		echo "Argument inconnu :$1";
56
		echo "Argument inconnu :$1";
61
		echo "$usage"
57
		echo "$usage"
62
		exit 1
58
		exit 1
63
		;;
59
		;;
64
esac
60
esac
65
 
61