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 1056 2013-03-26 21:46:36Z stephane $
3
 
4
# alcasar-havp.sh
835 richard 5
# by Rexy
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 (){
835 richard 14
	$SED "s/^cache_peer.*/#cache_peer 127\.0\.0\.1 parent 8090 0 no-query default/g" /etc/squid/squid.conf
15
	$SED "s/^never_direct.*/#never_direct allow all/g" /etc/squid/squid.conf
634 richard 16
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
835 richard 17
	service squid reload
634 richard 18
	service havp stop
19
}
20
function av_enable (){
835 richard 21
	$SED "s/^#cache_peer.*/cache_peer 127\.0\.0\.1 parent 8090 0 no-query default/g" /etc/squid/squid.conf
22
	$SED "s/^#never_direct.*/never_direct allow all/g" /etc/squid/squid.conf
634 richard 23
	$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
835 richard 24
	service squid reload
634 richard 25
	service havp start
26
}
393 franck 27
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
71 richard 28
nb_args=$#
29
args=$1
30
if [ $nb_args -eq 0 ]
31
then
835 richard 32
	AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2`		# WEB-antivir  (on/off)
634 richard 33
	AV_FILTERING=${AV_FILTERING:=on}
34
	echo "Set antivirus Filtering to $AV_FILTERING"
35
	if [ $AV_FILTERING = on ]; then
36
		av_enable
37
	else
38
		av_disable
39
	fi
40
	exit 0
71 richard 41
fi
42
case $args in
43
	-\? | -h* | --h*)
44
		echo "$usage"
45
		exit 0
46
		;;
393 franck 47
	--on|-on)	
634 richard 48
		av_enable
71 richard 49
		;;
393 franck 50
	--off|-off)
634 richard 51
		av_disable
71 richard 52
		;;
393 franck 53
	--update|-update)
71 richard 54
		#mise à jour de la base de signature
55
		freshclam
56
		;;		
57
	*)
58
		echo "Argument inconnu :$1";
59
		echo "$usage"
60
		exit 1
61
		;;
62
esac
63