Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1484 2014-11-11 23:14:36Z richard $
|
2 |
# $Id: alcasar.sh 1485 2014-11-12 08:12:40Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
|
5 |
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
Line 36... |
Line 36... |
36 |
# radius : FreeRadius initialisation
|
36 |
# radius : FreeRadius initialisation
|
37 |
# radius_web : copy ans modifiy original "freeradius web" in ACC
|
37 |
# radius_web : copy ans modifiy original "freeradius web" in ACC
|
38 |
# chilli : coovachilli initialisation (+authentication page)
|
38 |
# chilli : coovachilli initialisation (+authentication page)
|
39 |
# dansguardian : DansGuardian filtering HTTP proxy configuration
|
39 |
# dansguardian : DansGuardian filtering HTTP proxy configuration
|
40 |
# antivirus : HAVP + libclamav configuration
|
40 |
# antivirus : HAVP + libclamav configuration
|
- |
|
41 |
# tinyproxy : little proxy for user filtered with "WL + antivirus" and "antivirus"
|
41 |
# ulogd : log system in userland (match NFLOG target of iptables)
|
42 |
# ulogd : log system in userland (match NFLOG target of iptables)
|
42 |
# nfsen : : Configuration du grapheur nfsen pour apache
|
43 |
# nfsen : : Configuration du grapheur nfsen pour apache
|
43 |
# dnsmasq : Name server configuration
|
44 |
# dnsmasq : Name server configuration
|
44 |
# BL : BlackList of Toulouse configuration : split into 3 BL (for Dnsmasq, for dansguardian and for Netfilter)
|
45 |
# BL : BlackList of Toulouse configuration : split into 3 BL (for Dnsmasq, for dansguardian and for Netfilter)
|
45 |
# cron : Logs export + watchdog + connexion statistics
|
46 |
# cron : Logs export + watchdog + connexion statistics
|
Line 1221... |
Line 1222... |
1221 |
groupdel havp 2>/dev/null
|
1222 |
groupdel havp 2>/dev/null
|
1222 |
fi
|
1223 |
fi
|
1223 |
groupadd -f havp
|
1224 |
groupadd -f havp
|
1224 |
useradd -r -g havp -s /bin/false -c "system user for havp" havp
|
1225 |
useradd -r -g havp -s /bin/false -c "system user for havp" havp
|
1225 |
mkdir -p /var/tmp/havp /var/log/havp /var/run/havp
|
1226 |
mkdir -p /var/tmp/havp /var/log/havp /var/run/havp
|
1226 |
mkdir -p /var/tmp/havp2 /var/log/havp2 /var/run/havp2
|
- |
|
1227 |
chown -R havp:havp /var/tmp/havp /var/log/havp /var/run/havp
|
1227 |
chown -R havp:havp /var/tmp/havp /var/log/havp /var/run/havp
|
1228 |
chown -R havp:havp /var/tmp/havp2 /var/log/havp2 /var/run/havp2
|
- |
|
1229 |
[ -e /etc/havp/havp.config.default ] || cp /etc/havp/havp.config /etc/havp/havp.config.default
|
1228 |
[ -e /etc/havp/havp.config.default ] || cp /etc/havp/havp.config /etc/havp/havp.config.default
|
1230 |
$SED "/^REMOVETHISLINE/d" /etc/havp/havp.config
|
1229 |
$SED "/^REMOVETHISLINE/d" /etc/havp/havp.config
|
1231 |
$SED "s?^# PIDFILE.*?PIDFILE /var/run/havp/havp.pid?g" /etc/havp/havp.config # pidfile
|
1230 |
$SED "s?^# PIDFILE.*?PIDFILE /var/run/havp/havp.pid?g" /etc/havp/havp.config # pidfile
|
1232 |
$SED "s?^# TRANSPARENT.*?TRANSPARENT false?g" /etc/havp/havp.config # transparent mode
|
1231 |
$SED "s?^# TRANSPARENT.*?TRANSPARENT false?g" /etc/havp/havp.config # transparent mode
|
1233 |
$SED "s?^# BIND_ADDRESS.*?BIND_ADDRESS 127.0.0.1?g" /etc/havp/havp.config # we listen only on loopback
|
1232 |
$SED "s?^# BIND_ADDRESS.*?BIND_ADDRESS 127.0.0.1?g" /etc/havp/havp.config # we listen only on loopback
|
1234 |
$SED "s?^# PORT.*?PORT 8090?g" /etc/havp/havp.config # datas come on 8090 (on loopback)
|
1233 |
$SED "s?^# PORT.*?PORT 8090?g" /etc/havp/havp.config # datas come on port 8090 (on loopback)
|
1235 |
$SED "s?^# TIMEFORMAT.*?TIMEFORMAT %Y %b %d %H:%M:%S?g" /etc/havp/havp.config # Log format
|
1234 |
$SED "s?^# TIMEFORMAT.*?TIMEFORMAT %Y %b %d %H:%M:%S?g" /etc/havp/havp.config # Log format
|
1236 |
$SED "s?^ENABLECLAMLIB.*?ENABLECLAMLIB true?g" /etc/havp/havp.config # active libclamav AV
|
1235 |
$SED "s?^ENABLECLAMLIB.*?ENABLECLAMLIB true?g" /etc/havp/havp.config # active libclamav AV
|
1237 |
$SED "s?^# LOG_OKS.*?LOG_OKS false?g" /etc/havp/havp.config # log only when malware matches
|
1236 |
$SED "s?^# LOG_OKS.*?LOG_OKS false?g" /etc/havp/havp.config # log only when malware matches
|
1238 |
$SED "s?^# SERVERNUMBER.*?SERVERNUMBER 10?g" /etc/havp/havp.config # 10 daemons are started simultaneously
|
1237 |
$SED "s?^# SERVERNUMBER.*?SERVERNUMBER 10?g" /etc/havp/havp.config # 10 daemons are started simultaneously
|
1239 |
$SED "s?^# SCANIMAGES.*?SCANIMAGES false?g" /etc/havp/havp.config # doesn't scan image files
|
1238 |
$SED "s?^# SCANIMAGES.*?SCANIMAGES false?g" /etc/havp/havp.config # doesn't scan image files
|
1240 |
$SED "s?^# SKIPMIME.*?SKIPMIME image\/\* video\/\* audio\/\*?g" /etc/havp/havp.config # doesn't scan some multimedia files
|
1239 |
$SED "s?^# SKIPMIME.*?SKIPMIME image\/\* video\/\* audio\/\*?g" /etc/havp/havp.config # doesn't scan some multimedia files
|
1241 |
cp /etc/havp/havp.config /etc/havp/havp2.config
|
- |
|
1242 |
$SED "s?^PIDFILE.*?PIDFILE /var/run/havp/havp2.pid?g" /etc/havp/havp2.config # pidfile
|
- |
|
1243 |
$SED "s?^TRANSPARENT.*?TRANSPARENT true?g" /etc/havp/havp2.config # transparent mode
|
- |
|
1244 |
$SED "s?^BIND_ADDRESS.*?BIND_ADDRESS $PRIVATE_IP?g" /etc/havp/havp2.config # we listen only on tun0
|
- |
|
1245 |
$SED "s?^PORT.*?PORT 8090?g" /etc/havp/havp2.config # datas come on 8091
|
- |
|
1246 |
# skip checking of youtube flow (too heavy load / risk too low)
|
1240 |
# skip checking of youtube flow (too heavy load / risk too low)
|
1247 |
[ -e /etc/havp/whitelist.default ] || cp /etc/havp/whitelist /etc/havp/whitelist.default
|
1241 |
[ -e /etc/havp/whitelist.default ] || cp /etc/havp/whitelist /etc/havp/whitelist.default
|
1248 |
echo "# Whitelist youtube flow" >> /etc/havp/whitelist
|
1242 |
echo "# Whitelist youtube flow" >> /etc/havp/whitelist
|
1249 |
echo "*.youtube.com/*" >> /etc/havp/whitelist
|
1243 |
echo "*.youtube.com/*" >> /etc/havp/whitelist
|
1250 |
# replacement of init script
|
1244 |
# replacement of init script
|
1251 |
[ -e /etc/init.d/havp.default ] || cp /etc/init.d/havp /etc/init.d/havp.default
|
1245 |
[ -e /etc/init.d/havp.default ] || cp /etc/init.d/havp /etc/init.d/havp.default
|
1252 |
cp -f $DIR_CONF/havp-init /etc/init.d/havp
|
1246 |
cp -f $DIR_CONF/havp-init /etc/init.d/havp
|
1253 |
cp /etc/init.d/havp /etc/init.d/havp2
|
- |
|
1254 |
$SED "s?^# description.*?# description: starts HAVP2 the High Availability Antivirus Proxy?g" /etc/init.d/havp2 # description
|
- |
|
1255 |
$SED "s?^HAVP_CONFIG.*?HAVP_CONFIG=/etc/havp/havp2.config?g" /etc/init.d/havp2 # config file
|
- |
|
1256 |
$SED "s?^PIDFILE.*?PIDFILE=/var/run/havp2/havp.pid?g" /etc/init.d/havp2 # pidfile
|
- |
|
1257 |
$SED "s?^NAME.*?NAME=havp2?g" /etc/init.d/havp2 # name
|
- |
|
1258 |
$SED "s?^DESC.*?DESC=havp2?g" /etc/init.d/havp2 # desc
|
- |
|
1259 |
$SED "s?^havp_mountpoint.*?havp_mountpoint=/var/tmp/havp2?g" /etc/init.d/havp2 # mountpoint
|
- |
|
1260 |
$SED "s?echo \"Reloading HAVP ...\".*?echo \"Reloading HAVP2 ...\"?g" /etc/init.d/havp2 # reloading havp
|
- |
|
1261 |
$SED "s?echo \"Error: HAVP not running\".*?echo \"Error : HAVP2 not running\"?g" /etc/init.d/havp2 # error havp
|
- |
|
1262 |
$SED "s?echo \"Error: HAVP not running or PIDFILE not readable\".*?echo \"Error : HAVP2 not running or PIDFILE not readable\"?g" /etc/init.d/havp2 # error havp
|
- |
|
1263 |
$SED "s?echo \"Error: HAVP not running or PIDFILE unreadable\".*?echo \"Error : HAVP2 not running or PIDFILE unreadable\"?g" /etc/init.d/havp2 # error havp
|
- |
|
1264 |
$SED "s?echo \"Shutting down HAVP ...\".*?echo \"Shutting down HAVP2 ...\"?g" /etc/init.d/havp2 # shutting down havp
|
- |
|
1265 |
$SED "s?status havp.*?status havp2?g" /etc/init.d/havp2 # status havp
|
- |
|
1266 |
# replace of the intercept page (template)
|
1247 |
# replace of the intercept page (template)
|
1267 |
cp -f $DIR_CONF/virus-fr.html /etc/havp/templates/fr/virus.html
|
1248 |
cp -f $DIR_CONF/virus-fr.html /etc/havp/templates/fr/virus.html
|
1268 |
cp -f $DIR_CONF/virus-en.html /etc/havp/templates/en/virus.html
|
1249 |
cp -f $DIR_CONF/virus-en.html /etc/havp/templates/en/virus.html
|
1269 |
# update virus database every 4 hours (24h/6)
|
1250 |
# update virus database every 4 hours (24h/6)
|
1270 |
[ -e /etc/freshclam.conf.default ] || cp /etc/freshclam.conf /etc/freshclam.conf.default
|
1251 |
[ -e /etc/freshclam.conf.default ] || cp /etc/freshclam.conf /etc/freshclam.conf.default
|
Line 1275... |
Line 1256... |
1275 |
$SED "s?MaxAttempts.*?MaxAttempts 3?g" /etc/freshclam.conf
|
1256 |
$SED "s?MaxAttempts.*?MaxAttempts 3?g" /etc/freshclam.conf
|
1276 |
# update now
|
1257 |
# update now
|
1277 |
/usr/bin/freshclam --no-warnings
|
1258 |
/usr/bin/freshclam --no-warnings
|
1278 |
} # End of antivirus ()
|
1259 |
} # End of antivirus ()
|
1279 |
|
1260 |
|
- |
|
1261 |
##################################################################
|
- |
|
1262 |
## Fonction "antivirus" ##
|
- |
|
1263 |
## - configuration of havp, libclamav and freshclam ##
|
- |
|
1264 |
##################################################################
|
- |
|
1265 |
tinyproxy ()
|
- |
|
1266 |
{
|
- |
|
1267 |
|
- |
|
1268 |
} # end of tinyproxy
|
1280 |
##################################################################################
|
1269 |
##################################################################################
|
1281 |
## function "ulogd" ##
|
1270 |
## function "ulogd" ##
|
1282 |
## - Ulog config for multi-log files ##
|
1271 |
## - Ulog config for multi-log files ##
|
1283 |
##################################################################################
|
1272 |
##################################################################################
|
1284 |
ulogd ()
|
1273 |
ulogd ()
|