Subversion Repositories ALCASAR

Rev

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

Rev 634 Rev 672
1
#/bin/sh
1
#/bin/bash
2
# $Id: alcasar-havp.sh 634 2011-06-13 17:23:46Z richard $
2
# $Id: alcasar-havp.sh 672 2011-07-08 15:34:22Z richard $
3
 
3
 
4
# alcasar-havp.sh
4
# alcasar-havp.sh
5
# by Rexy
5
# by Richard REY
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 antivirus de flux WEB (Havp + LibClamav)
8
# Gestion Havp / Clamav 
9
# Enable / disable of WEB flow antivirus (HAVP + LibClamav)
-
 
10
 
9
CONF_FILE="/usr/local/etc/alcasar.conf"
11
CONF_FILE="/usr/local/etc/alcasar.conf"
10
SED="/bin/sed -i"
12
SED="/bin/sed -i"
11
function av_disable (){
13
function av_disable (){
12
	$SED "s/^proxyport =.*/proxyport = 3128/g" /etc/dansguardian/dansguardian.conf
14
	$SED "s/^proxyport =.*/proxyport = 3128/g" /etc/dansguardian/dansguardian.conf
13
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
15
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
14
	service dansguardian reload
16
	service dansguardian reload
15
	service havp stop
17
	service havp stop
16
}
18
}
17
function av_enable (){
19
function av_enable (){
18
	$SED "s/^proxyport =.*/proxyport = 8090/g" /etc/dansguardian/dansguardian.conf
20
	$SED "s/^proxyport =.*/proxyport = 8090/g" /etc/dansguardian/dansguardian.conf
19
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
21
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
20
	service dansguardian reload
22
	service dansguardian reload
21
	service havp start
23
	service havp start
22
}
24
}
23
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
25
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
24
nb_args=$#
26
nb_args=$#
25
args=$1
27
args=$1
26
if [ $nb_args -eq 0 ]
28
if [ $nb_args -eq 0 ]
27
then
29
then
28
	AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2`		# DNS and URLs filter (on/off)
30
	AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2`		# DNS and URLs filter (on/off)
29
	AV_FILTERING=${AV_FILTERING:=on}
31
	AV_FILTERING=${AV_FILTERING:=on}
30
	echo "Set antivirus Filtering to $AV_FILTERING"
32
	echo "Set antivirus Filtering to $AV_FILTERING"
31
	if [ $AV_FILTERING = on ]; then
33
	if [ $AV_FILTERING = on ]; then
32
		av_enable
34
		av_enable
33
	else
35
	else
34
		av_disable
36
		av_disable
35
	fi
37
	fi
36
	exit 0
38
	exit 0
37
fi
39
fi
38
case $args in
40
case $args in
39
	-\? | -h* | --h*)
41
	-\? | -h* | --h*)
40
		echo "$usage"
42
		echo "$usage"
41
		exit 0
43
		exit 0
42
		;;
44
		;;
43
	--on|-on)	
45
	--on|-on)	
44
		av_enable
46
		av_enable
45
		;;
47
		;;
46
	--off|-off)
48
	--off|-off)
47
		av_disable
49
		av_disable
48
		;;
50
		;;
49
	--update|-update)
51
	--update|-update)
50
		#mise à jour de la base de signature
52
		#mise à jour de la base de signature
51
		freshclam
53
		freshclam
52
		;;		
54
		;;		
53
	*)
55
	*)
54
		echo "Argument inconnu :$1";
56
		echo "Argument inconnu :$1";
55
		echo "$usage"
57
		echo "$usage"
56
		exit 1
58
		exit 1
57
		;;
59
		;;
58
esac
60
esac
59
 
61
 
60
 
62