Line 1... |
Line 1... |
1 |
#/bin/bash
|
1 |
#/bin/bash
|
2 |
# $Id: alcasar-havp.sh 672 2011-07-08 15:34:22Z richard $
|
2 |
# $Id: alcasar-havp.sh 835 2012-03-11 22:21:27Z richard $
|
3 |
|
3 |
|
4 |
# alcasar-havp.sh
|
4 |
# alcasar-havp.sh
|
5 |
# by Richard REY
|
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 |
# Activation / désactivation antivirus de flux WEB (Havp + LibClamav)
|
8 |
# Activation / désactivation antivirus de flux WEB (Havp + LibClamav)
|
9 |
# Enable / disable of WEB flow antivirus (HAVP + LibClamav)
|
9 |
# Enable / disable of WEB flow antivirus (HAVP + LibClamav)
|
10 |
|
10 |
|
11 |
CONF_FILE="/usr/local/etc/alcasar.conf"
|
11 |
CONF_FILE="/usr/local/etc/alcasar.conf"
|
12 |
SED="/bin/sed -i"
|
12 |
SED="/bin/sed -i"
|
13 |
function av_disable (){
|
13 |
function av_disable (){
|
- |
|
14 |
$SED "s/^cache_peer.*/#cache_peer 127\.0\.0\.1 parent 8090 0 no-query default/g" /etc/squid/squid.conf
|
14 |
$SED "s/^proxyport =.*/proxyport = 3128/g" /etc/dansguardian/dansguardian.conf
|
15 |
$SED "s/^never_direct.*/#never_direct allow all/g" /etc/squid/squid.conf
|
15 |
$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
|
16 |
$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=off/g" /usr/local/etc/alcasar.conf
|
16 |
service dansguardian reload
|
17 |
service squid reload
|
17 |
service havp stop
|
18 |
service havp stop
|
18 |
}
|
19 |
}
|
19 |
function av_enable (){
|
20 |
function av_enable (){
|
- |
|
21 |
$SED "s/^#cache_peer.*/cache_peer 127\.0\.0\.1 parent 8090 0 no-query default/g" /etc/squid/squid.conf
|
20 |
$SED "s/^proxyport =.*/proxyport = 8090/g" /etc/dansguardian/dansguardian.conf
|
22 |
$SED "s/^#never_direct.*/never_direct allow all/g" /etc/squid/squid.conf
|
21 |
$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
|
23 |
$SED "s/^WEB_ANTIVIRUS=.*/WEB_ANTIVIRUS=on/g" /usr/local/etc/alcasar.conf
|
22 |
service dansguardian reload
|
24 |
service squid reload
|
23 |
service havp start
|
25 |
service havp start
|
24 |
}
|
26 |
}
|
25 |
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
|
27 |
usage="Usage: alcasar-havp.sh {--on or -on} | {--off or -off} | {--update or -update}"
|
26 |
nb_args=$#
|
28 |
nb_args=$#
|
27 |
args=$1
|
29 |
args=$1
|
28 |
if [ $nb_args -eq 0 ]
|
30 |
if [ $nb_args -eq 0 ]
|
29 |
then
|
31 |
then
|
30 |
AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2` # DNS and URLs filter (on/off)
|
32 |
AV_FILTERING=`grep WEB_ANTIVIRUS $CONF_FILE|cut -d"=" -f2` # WEB-antivir (on/off)
|
31 |
AV_FILTERING=${AV_FILTERING:=on}
|
33 |
AV_FILTERING=${AV_FILTERING:=on}
|
32 |
echo "Set antivirus Filtering to $AV_FILTERING"
|
34 |
echo "Set antivirus Filtering to $AV_FILTERING"
|
33 |
if [ $AV_FILTERING = on ]; then
|
35 |
if [ $AV_FILTERING = on ]; then
|
34 |
av_enable
|
36 |
av_enable
|
35 |
else
|
37 |
else
|