Subversion Repositories ALCASAR

Rev

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

Rev 519 Rev 520
Line 1... Line 1...
1
#/bin/sh
1
#/bin/sh
2
# $Id: alcasar-nf.sh 519 2011-03-25 16:30:32Z stephane $
2
# $Id: alcasar-nf.sh 520 2011-03-27 20:55:05Z richard $
3
 
3
 
4
# active ou desactive le filtrage réseau
4
# active ou desactive le filtrage de protocoles réseau
-
 
5
# enable or disable the network protocols filter
5
# by rexy
6
# by rexy
-
 
7
 
6
SED="/bin/sed -i"
8
SED="/bin/sed -i"
7
FIC_SERVICES="/usr/local/etc/alcasar-services"
9
FIC_SERVICES="/usr/local/etc/alcasar-services"
8
FIC_EXCEPTIONS="/usr/local/etc/alcasar-filter-exceptions"
10
FIC_EXCEPTIONS="/usr/local/etc/alcasar-filter-exceptions"
9
 
11
 
10
usage="Usage: alcasar-nf.sh {--on or -on} | {--off | -off} "
12
usage="Usage: alcasar-nf.sh {--on or -on} | {--off | -off} "
Line 20... Line 22...
20
		echo "$usage"
22
		echo "$usage"
21
		exit 0
23
		exit 0
22
		;;
24
		;;
23
	-on|-on)	
25
	-on|-on)	
24
		# activation du filtrage réseau
26
		# activation du filtrage réseau
25
		$SED "s?^FILTERING.*?FILTERING=\"yes\"?g" /usr/local/bin/alcasar-iptables.sh
27
		$SED "s?^PROTO_FILTERING.*?PROTO_FILTERING=\"yes\"?g" /usr/local/bin/alcasar-iptables.sh
26
		# tri du fichier de services
28
		# tri du fichier de services
27
		$SED "/^$/d" $FIC_SERVICES # suppression lignes vides
29
		$SED "/^$/d" $FIC_SERVICES # suppression lignes vides
28
		sort -k2n $FIC_SERVICES > /tmp/alcasar-services-sort
30
		sort -k2n $FIC_SERVICES > /tmp/alcasar-services-sort
29
		mv -f /tmp/alcasar-services-sort $FIC_SERVICES
31
		mv -f /tmp/alcasar-services-sort $FIC_SERVICES
30
		chown root:apache $FIC_SERVICES
32
		chown root:apache $FIC_SERVICES
Line 35... Line 37...
35
		chmod 664 $FIC_EXCEPTIONS
37
		chmod 664 $FIC_EXCEPTIONS
36
		/usr/local/bin/alcasar-iptables.sh
38
		/usr/local/bin/alcasar-iptables.sh
37
		;;
39
		;;
38
	--off|-off)
40
	--off|-off)
39
		# désactivation du filtrage réseau
41
		# désactivation du filtrage réseau
40
		$SED "s?^FILTERING.*?FILTERING=\"no\"?g" /usr/local/bin/alcasar-iptables.sh
42
		$SED "s?^PROTO_FILTERING.*?PROTO_FILTERING=\"no\"?g" /usr/local/bin/alcasar-iptables.sh
41
		/usr/local/bin/alcasar-iptables.sh
43
		/usr/local/bin/alcasar-iptables.sh
42
		;;
44
		;;
43
	*)
45
	*)
44
		echo "Argument inconnu :$1";
46
		echo "Argument inconnu :$1";
45
		echo "$usage"
47
		echo "$usage"