Subversion Repositories ALCASAR

Rev

Rev 859 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 859 Rev 958
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-nf.sh 859 2012-04-19 22:21:31Z richard $
2
# $Id: alcasar-nf.sh 958 2012-07-19 09:01:30Z franck $
3
 
3
 
4
# alcasar-nf.sh
4
# alcasar-nf.sh
5
# by Rexy
5
# by 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
# active ou desactive le filtrage de protocoles réseau
8
# active ou desactive le filtrage de protocoles réseau
9
# enable or disable the network protocols filter
9
# enable or disable the network protocols filter
10
 
10
 
11
SED="/bin/sed -i"
11
SED="/bin/sed -i"
12
FIC_CONF="/usr/local/etc/alcasar.conf"
12
FIC_CONF="/usr/local/etc/alcasar.conf"
13
 
13
 
14
usage="Usage: alcasar-nf.sh {--on | -on} | {--off | -off}"
14
usage="Usage: alcasar-nf.sh {--on | -on} | {--off | -off}"
15
nb_args=$#
15
nb_args=$#
16
args=$1
16
args=$1
17
if [ $nb_args -eq 0 ]
17
if [ $nb_args -eq 0 ]
18
then
18
then
19
	echo $usage
19
	echo $usage
20
	exit 1
20
	exit 1
21
fi
21
fi
22
case $args in
22
case $args in
23
	-\? | -h* | --h*)
23
	-\? | -h* | --h*)
24
		echo "$usage"
24
		echo "$usage"
25
		exit 0
25
		exit 0
26
		;;
26
		;;
27
	-on|-on) # enable protocols filter
27
	-on|-on) # enable protocols filter
28
		$SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=on?g" $FIC_CONF
28
		$SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=on?g" $FIC_CONF
29
		/usr/local/bin/alcasar-iptables.sh
29
		/usr/local/bin/alcasar-iptables.sh
30
		;;
30
		;;
31
	--off|-off) # disable protocols filter
31
	--off|-off) # disable protocols filter
32
		$SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=off?g" $FIC_CONF
32
		$SED "s?^PROTOCOLS_FILTERING.*?PROTOCOLS_FILTERING=off?g" $FIC_CONF
33
		/usr/local/bin/alcasar-iptables.sh
33
		/usr/local/bin/alcasar-iptables.sh
34
		;;
34
		;;
35
	*)
35
	*)
36
		echo "Argument inconnu :$1";
36
		echo "Argument inconnu :$1";
37
		echo "$usage"
37
		echo "$usage"
38
		exit 1
38
		exit 1
39
		;;
39
		;;
40
esac
40
esac
41
 
41
 
42
 
42