Subversion Repositories ALCASAR

Rev

Rev 1377 | Rev 1482 | Go to most recent revision | 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 1469 2014-10-30 21:58:47Z richard $
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
9
# enable / disable the bypass of authenticate process and filtering
10
 
383 franck 11
usage="Usage: alcasar-bypass.sh {--on or -on } | {--off or -off}"
401 richard 12
SED="/bin/sed -i"
1469 richard 13
CONF_FILE="/usr/local/etc/alcasar.conf"
14
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
15
 
1 root 16
nb_args=$#
17
args=$1
18
if [ $nb_args -eq 0 ]
19
then
20
	nb_args=1
21
	args="-h"
22
fi
23
case $args in
24
	-\? | -h* | --h*)
25
		echo "$usage"
26
		exit 0
27
		;;
383 franck 28
	--on | -on)	
1 root 29
		# activation du contournement
1062 richard 30
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid 
1 root 31
		do
1469 richard 32
			if  (pgrep $i) > /dev/null ; then /usr/bin/systemctl stop $i.service ; fi
1 root 33
		done
1469 richard 34
		echo "$INTIF configuration ..."
35
		cp /etc/sysconfig/network-scripts/default-ifcfg-$INTIF /etc/sysconfig/network-scripts/ifcfg-$INTIF
36
		ifup $INTIF
1 root 37
		sh /usr/local/bin/alcasar-iptables-bypass.sh
1469 richard 38
		echo "dnsmasq Configuration ..."
1377 richard 39
		$SED "s?^conf-dir=.*?#&?g" /etc/dnsmasq-blacklist.conf
40
		$SED "s?^no-dhcp-interface=.*?#&?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
401 richard 41
		/etc/init.d/dnsmasq start
42
		echo "Le contournement des modules d'authentification de filtrage est activé"
43
		echo "les journaux de connexions continuent néanmoins d'être enregistrés"
1 root 44
		;;
383 franck 45
	--off | -off)
1 root 46
		# désactivation du contournement
348 franck 47
		if (pgrep dnsmasq) > /dev/null ; then /etc/init.d/dnsmasq stop ; fi
1469 richard 48
		echo "dnsmasq Configuration ..."
1377 richard 49
		$SED "s?^#conf-dir=.*?conf-dir=/usr/local/share/dnsmasq-bl-enabled?g" /etc/dnsmasq-blacklist.conf
1469 richard 50
		$SED "s?^#no-dhcp-interface=.*?no-dhcp-interface=$INTIF?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
51
		rm -f /etc/sysconfig/network-scripts/ifcfg-$INTIF
1062 richard 52
		for i in chilli dansguardian havp mysqld radiusd httpd freshclam dnsmasq squid	
1 root 53
		do
1469 richard 54
			if  ! (pgrep $i) > /dev/null ; then /usr/bin/systemctl start $i.service; fi
1 root 55
		done
56
		sh /usr/local/bin/alcasar-iptables.sh
401 richard 57
		echo "L'authentification et le filtrage sont de nouveau activés"
1 root 58
;;
59
	*)
60
		echo "Argument inconnu :$1";
61
		echo "$usage"
62
		exit 1
63
		;;
64
esac