Subversion Repositories ALCASAR

Rev

Rev 2454 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2454 Rev 2688
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-bypass.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
2
# $Id: alcasar-bypass.sh 2688 2019-01-18 23:15:49Z lucas.echard $
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 authentication process and WEB filtering
9
# enable / disable the bypass of authentication process and WEB 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"
-
 
13
CONF_FILE="/usr/local/etc/alcasar.conf"
12
CONF_FILE="/usr/local/etc/alcasar.conf"
14
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
13
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
15
 
14
 
16
nb_args=$#
15
nb_args=$#
17
args=$1
16
args=$1
Line 23... Line 22...
23
case $args in
22
case $args in
24
	-\? | -h* | --h*)
23
	-\? | -h* | --h*)
25
		echo "$usage"
24
		echo "$usage"
26
		exit 0
25
		exit 0
27
		;;
26
		;;
28
	--on | -on)	
27
	--on | -on)
29
		/usr/local/bin/alcasar-logout.sh all
28
		/usr/local/bin/alcasar-logout.sh all
30
		/usr/bin/systemctl stop chilli
29
		/usr/bin/systemctl stop chilli
31
		cp -f /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
30
		cp -f /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
32
		ifup $INTIF
31
		ifup $INTIF
33
		sh /usr/local/bin/alcasar-iptables-bypass.sh
32
		sh /usr/local/bin/alcasar-iptables-bypass.sh
34
		DHCP=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
33
		DHCP=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
35
		if [ $DHCP != off ]
34
		if [ $DHCP != off ]
36
		then
35
		then
37
			$SED "/^#dhcp-range=/s/^#//" /etc/dnsmasq.conf # dnsmasq become the DHCP server
-
 
38
			$SED "/^#dhcp-option=/s/^#//" /etc/dnsmasq.conf
-
 
39
			$SED "/^#domain=/s/^#//" /etc/dnsmasq.conf
-
 
40
			$SED "s?^no-dhcp-interface.*?#&?g" /etc/dnsmasq.conf
-
 
41
			/usr/bin/systemctl restart dnsmasq
36
			/usr/bin/systemctl start dhcpd
42
		fi
37
		fi
43
 
38
 
44
		rm -f /etc/cron.d/alcasar-daemon-watchdog # don't restart daemons (specially coova)
39
		rm -f /etc/cron.d/alcasar-daemon-watchdog # don't restart daemons (specially coova)
45
		echo "ALCASAR est en mode 'bypass'"
40
		echo "ALCASAR est en mode 'bypass'"
46
		echo "ALCASAR is in 'bypass' mode"
41
		echo "ALCASAR is in 'bypass' mode"
47
		;;
42
		;;
48
	--off | -off)
43
	--off | -off)
49
		cp -f /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
44
		cp -f /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
50
		ifup $INTIF
45
		ifup $INTIF
51
		$SED "s?^dhcp-range=.*?#&?g" /etc/dnsmasq.conf # dnsmasq is no more the DHCP server (it's coova)
-
 
52
		$SED "s?^dhcp-option=.*?#&?g" /etc/dnsmasq.conf
-
 
53
		$SED "s?^domain=.*?#&?g" /etc/dnsmasq.conf
-
 
54
		$SED "/^#no-dhcp-interface/s/^#//" /etc/dnsmasq.conf
-
 
55
		/usr/bin/systemctl restart dnsmasq
46
		/usr/bin/systemctl stop dhcpd
56
		/usr/bin/systemctl start chilli
47
		/usr/bin/systemctl start chilli
57
		sh /usr/local/bin/alcasar-iptables.sh
48
		sh /usr/local/bin/alcasar-iptables.sh
58
		# activation of the "daemon-watchdog" every 18'
49
		# activation of the "daemon-watchdog" every 18'
59
		cat << EOF > /etc/cron.d/alcasar-daemon-watchdog
50
		cat << EOF > /etc/cron.d/alcasar-daemon-watchdog
60
# activation du "chien de garde" (daemon-watchdog) toutes les 18'
51
# activation du "chien de garde" (daemon-watchdog) toutes les 18'