Subversion Repositories ALCASAR

Rev

Rev 2454 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
672 richard 1
#!/bin/bash
63 franck 2
# $Id: alcasar-bypass.sh 2688 2019-01-18 23:15:49Z lucas.echard $
3
 
672 richard 4
# alcasar-bypass.sh
1469 richard 5
# by 3abtux and Rexy
672 richard 6
# This script is distributed under the Gnu General Public License (GPL)
7
 
8
# activation / désactivation du contournement de l'authentification et du filtrage WEB
1962 richard 9
# enable / disable the bypass of authentication process and WEB filtering
672 richard 10
 
383 franck 11
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
1469 richard 12
CONF_FILE="/usr/local/etc/alcasar.conf"
13
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
14
 
1 root 15
nb_args=$#
16
args=$1
17
if [ $nb_args -eq 0 ]
18
then
19
	nb_args=1
20
	args="-h"
21
fi
22
case $args in
23
	-\? | -h* | --h*)
24
		echo "$usage"
25
		exit 0
26
		;;
2688 lucas.echa 27
	--on | -on)
1827 raphael.pi 28
		/usr/local/bin/alcasar-logout.sh all
1521 richard 29
		/usr/bin/systemctl stop chilli
1554 richard 30
		cp -f /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
1469 richard 31
		ifup $INTIF
1 root 32
		sh /usr/local/bin/alcasar-iptables-bypass.sh
1609 franck 33
		DHCP=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
2454 tom.houday 34
		if [ $DHCP != off ]
35
		then
2688 lucas.echa 36
			/usr/bin/systemctl start dhcpd
1693 franck 37
		fi
1609 franck 38
 
2454 tom.houday 39
		rm -f /etc/cron.d/alcasar-daemon-watchdog # don't restart daemons (specially coova)
1482 richard 40
		echo "ALCASAR est en mode 'bypass'"
41
		echo "ALCASAR is in 'bypass' mode"
1 root 42
		;;
383 franck 43
	--off | -off)
1554 richard 44
		cp -f /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
45
		ifup $INTIF
2688 lucas.echa 46
		/usr/bin/systemctl stop dhcpd
1482 richard 47
		/usr/bin/systemctl start chilli
1 root 48
		sh /usr/local/bin/alcasar-iptables.sh
1520 richard 49
		# activation of the "daemon-watchdog" every 18'
50
		cat << EOF > /etc/cron.d/alcasar-daemon-watchdog
51
# activation du "chien de garde" (daemon-watchdog) toutes les 18'
1521 richard 52
*/18 * * * * root /usr/local/bin/alcasar-daemon.sh > /dev/null 2>&1
1520 richard 53
EOF
1482 richard 54
		echo "L'authentification et le filtrage sont actifs"
1508 richard 55
		echo "Authentication and filtering system are enabled"
1 root 56
;;
57
	*)
58
		echo "Argument inconnu :$1";
59
		echo "$usage"
60
		exit 1
61
		;;
62
esac