Subversion Repositories ALCASAR

Rev

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

Rev 1377 Rev 1469
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-bypass.sh 1377 2014-06-10 22:16:50Z richard $
2
# $Id: alcasar-bypass.sh 1469 2014-10-30 21:58:47Z richard $
3
 
3
 
4
# alcasar-bypass.sh
4
# alcasar-bypass.sh
5
# by Franck BOUIJOUX and Richard REY
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"
-
 
14
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
-
 
15
 
13
nb_args=$#
16
nb_args=$#
14
args=$1
17
args=$1
15
if [ $nb_args -eq 0 ]
18
if [ $nb_args -eq 0 ]
16
then
19
then
17
	nb_args=1
20
	nb_args=1
Line 24... Line 27...
24
		;;
27
		;;
25
	--on | -on)	
28
	--on | -on)	
26
		# activation du contournement
29
		# activation du contournement
27
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid 
30
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid 
28
		do
31
		do
29
			if  (pgrep $i) > /dev/null ; then /etc/init.d/$i stop ; fi
32
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
30
		done
33
		done
31
		echo "Configure eth1 ..."
34
		echo "$INTIF configuration ..."
32
		cp /etc/sysconfig/network-scripts/default-ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth1
35
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
33
		ifup eth1
36
		ifup $INTIF
34
		sh /usr/local/bin/alcasar-iptables-bypass.sh
37
		sh /usr/local/bin/alcasar-iptables-bypass.sh
35
		echo "Configure dnsmasq ..."
38
		echo "dnsmasq Configuration ..."
36
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq-blacklist.conf
39
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq-blacklist.conf
37
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
40
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
38
		/etc/init.d/dnsmasq start
41
		/etc/init.d/dnsmasq start
39
		echo "Le contournement des modules d'authentification de filtrage est activé"
42
		echo "Le contournement des modules d'authentification de filtrage est activé"
40
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
43
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
41
		;;
44
		;;
42
	--off | -off)
45
	--off | -off)
43
		# désactivation du contournement
46
		# désactivation du contournement
44
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
47
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
45
		echo "Configure dnsmasq ..."
48
		echo "dnsmasq Configuration ..."
46
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/share/dnsmasq-bl-enabled?g" /etc/dnsmasq-blacklist.conf
49
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/share/dnsmasq-bl-enabled?g" /etc/dnsmasq-blacklist.conf
47
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=eth1?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
50
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
48
		rm -f /etc/sysconfig/network-scripts/ifcfg-eth1
51
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
49
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid	
52
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid	
50
		do
53
		do
51
			if  ! (pgrep $i) > /dev/null ; then /etc/init.d/$i start ; fi
54
			if  ! (pgrep $i) > /dev/null ; then /usr/bin/systemctl start $i.service; fi
52
		done
55
		done
53
		sh /usr/local/bin/alcasar-iptables.sh
56
		sh /usr/local/bin/alcasar-iptables.sh
54
		echo "L'authentification et le filtrage sont de nouveau activés"
57
		echo "L'authentification et le filtrage sont de nouveau activés"
55
;;
58
;;
56
	*)
59
	*)