Subversion Repositories ALCASAR

Rev

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

Rev 612 Rev 634
Line 1... Line 1...
1
#/bin/sh
1
#/bin/sh
2
# $Id: alcasar-havp.sh 612 2011-05-22 21:19:27Z richard $
2
# $Id: alcasar-havp.sh 634 2011-06-13 17:23:46Z richard $
3
 
3
 
4
# alcasar-havp.sh
4
# alcasar-havp.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
# Gestion Havp / Clamav 
8
# Gestion Havp / Clamav 
-
 
9
CONF_FILE="/usr/local/etc/alcasar.conf"
9
SED="/bin/sed -i"
10
SED="/bin/sed -i"
-
 
11
function av_disable (){
-
 
12
	$SED "s/^proxyport =.*/proxyport = 3128/g" /etc/dansguardian/dansguardian.conf
-
 
13
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
-
 
14
	service dansguardian reload
-
 
15
	service havp stop
-
 
16
}
-
 
17
function av_enable (){
-
 
18
	$SED "s/^proxyport =.*/proxyport = 8090/g" /etc/dansguardian/dansguardian.conf
-
 
19
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
-
 
20
	service dansguardian reload
-
 
21
	service havp start
-
 
22
}
10
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
23
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
11
nb_args=$#
24
nb_args=$#
12
args=$1
25
args=$1
13
if [ $nb_args -eq 0 ]
26
if [ $nb_args -eq 0 ]
14
then
27
then
-
 
28
	AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2`		# DNS and URLs filter (on/off)
-
 
29
	AV_FILTERING=${AV_FILTERING:=on}
-
 
30
	echo "Set antivirus Filtering to $AV_FILTERING"
-
 
31
	if [ $AV_FILTERING = on ]; then
15
	nb_args=1
32
		av_enable
-
 
33
	else
16
	args="-h"
34
		av_disable
-
 
35
	fi
-
 
36
	exit 0
17
fi
37
fi
18
case $args in
38
case $args in
19
	-\? | -h* | --h*)
39
	-\? | -h* | --h*)
20
		echo "$usage"
40
		echo "$usage"
21
		exit 0
41
		exit 0
22
		;;
42
		;;
23
	--on|-on)	
43
	--on|-on)	
24
		# activation havp
44
		av_enable
25
		$SED "s/^proxyport =.*/proxyport = 8090/g" /etc/dansguardian/dansguardian.conf
-
 
26
		$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
-
 
27
		service dansguardian reload
-
 
28
		service havp start
-
 
29
		;;
45
		;;
30
	--off|-off)
46
	--off|-off)
31
		# désactivation du filtrage
-
 
32
		$SED "s/^proxyport =.*/proxyport = 3128/g" /etc/dansguardian/dansguardian.conf
-
 
33
		$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
-
 
34
		service dansguardian reload
-
 
35
		service havp stop
47
		av_disable
36
		;;
48
		;;
37
	--update|-update)
49
	--update|-update)
38
		#mise à jour de la base de signature
50
		#mise à jour de la base de signature
39
		freshclam
51
		freshclam
40
		;;		
52
		;;