Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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