Subversion Repositories ALCASAR

Rev

Rev 1508 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1508 Rev 1520
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-bypass.sh 1508 2014-11-30 18:19:16Z richard $
2
# $Id: alcasar-bypass.sh 1520 2014-12-17 18:10:26Z 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
 
Line 24... Line 24...
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
-
 
30
		/usr/local/sbin/alcasar-logout.sh all
29
		/usr/local/sbin/alcasar-logout.sh all
31
		for i in chilli 
30
		for i in chilli 
32
		do
31
		do
33
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
32
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
34
		done
33
		done
35
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
34
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
36
		ifup $INTIF
35
		ifup $INTIF
37
		sh /usr/local/bin/alcasar-iptables-bypass.sh
36
		sh /usr/local/bin/alcasar-iptables-bypass.sh
38
		$SED "s?^no-dhcp-interface.*?#&?g" /etc/dnsmasq.conf
37
		$SED "s?^no-dhcp-interface.*?#&?g" /etc/dnsmasq.conf # dnsmasq become the DHCP server
39
		/usr/bin/systemctl restart dnsmasq
38
		/usr/bin/systemctl restart dnsmasq
-
 
39
		rm -f /etc/cron.d/alcasar-daemon-watchdog # don't restart daemons (specially coova) 
40
		echo "ALCASAR est en mode 'bypass'"
40
		echo "ALCASAR est en mode 'bypass'"
41
		echo "ALCASAR is in 'bypass' mode"
41
		echo "ALCASAR is in 'bypass' mode"
42
		;;
42
		;;
43
	--off | -off)
43
	--off | -off)
44
		# désactivation du contournement
-
 
45
		$SED "s?^#no-dhcp-interface=$INTIF?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf
44
		$SED "s?^#no-dhcp-interface=$INTIF?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf
46
		$SED "s?^#no-dhcp-interface=tun0?no-dhcp-interface=tun0?g" /etc/dnsmasq.conf
45
		$SED "s?^#no-dhcp-interface=tun0?no-dhcp-interface=tun0?g" /etc/dnsmasq.conf
47
		$SED "s?^#no-dhcp-interface=lo?no-dhcp-interface=lo?g" /etc/dnsmasq.conf
46
		$SED "s?^#no-dhcp-interface=lo?no-dhcp-interface=lo?g" /etc/dnsmasq.conf
48
		systemctl restart dnsmasq
47
		systemctl restart dnsmasq
49
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
48
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
50
		/usr/bin/systemctl start chilli
49
		/usr/bin/systemctl start chilli
51
		sh /usr/local/bin/alcasar-iptables.sh
50
		sh /usr/local/bin/alcasar-iptables.sh
-
 
51
		# activation of the "daemon-watchdog" every 18'
-
 
52
		cat << EOF > /etc/cron.d/alcasar-daemon-watchdog
-
 
53
# activation du "chien de garde" (daemon-watchdog) toutes les 18'
-
 
54
*/18 * * * * root $DIR_DEST_BIN/alcasar-daemon.sh > /dev/null 2>&1
-
 
55
EOF
52
		echo "L'authentification et le filtrage sont actifs"
56
		echo "L'authentification et le filtrage sont actifs"
53
		echo "Authentication and filtering system are enabled"
57
		echo "Authentication and filtering system are enabled"
54
;;
58
;;
55
	*)
59
	*)
56
		echo "Argument inconnu :$1";
60
		echo "Argument inconnu :$1";