Subversion Repositories ALCASAR

Rev

Rev 612 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
71 richard 1
#/bin/sh
393 franck 2
# $Id: alcasar-havp.sh 634 2011-06-13 17:23:46Z richard $
3
 
4
# alcasar-havp.sh
5
# by Rexy
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
71 richard 8
# Gestion Havp / Clamav 
634 richard 9
CONF_FILE="/usr/local/etc/alcasar.conf"
71 richard 10
SED="/bin/sed -i"
634 richard 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
}
393 franck 23
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
71 richard 24
nb_args=$#
25
args=$1
26
if [ $nb_args -eq 0 ]
27
then
634 richard 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
32
		av_enable
33
	else
34
		av_disable
35
	fi
36
	exit 0
71 richard 37
fi
38
case $args in
39
	-\? | -h* | --h*)
40
		echo "$usage"
41
		exit 0
42
		;;
393 franck 43
	--on|-on)	
634 richard 44
		av_enable
71 richard 45
		;;
393 franck 46
	--off|-off)
634 richard 47
		av_disable
71 richard 48
		;;
393 franck 49
	--update|-update)
71 richard 50
		#mise à jour de la base de signature
51
		freshclam
52
		;;		
53
	*)
54
		echo "Argument inconnu :$1";
55
		echo "$usage"
56
		exit 1
57
		;;
58
esac
59