Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 793 2012-01-16 22:31:32Z richard $
|
2 |
# $Id: alcasar.sh 796 2012-01-20 13:38:57Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
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 |
|
Line 808... |
Line 808... |
808 |
##########################################################################################
|
808 |
##########################################################################################
|
809 |
param_chilli ()
|
809 |
param_chilli ()
|
810 |
{
|
810 |
{
|
811 |
# modification du fichier d'initialisation
|
811 |
# modification du fichier d'initialisation
|
812 |
[ -e /etc/init.d/chilli.default ] || cp /etc/init.d/chilli /etc/init.d/chilli.default
|
812 |
[ -e /etc/init.d/chilli.default ] || cp /etc/init.d/chilli /etc/init.d/chilli.default
|
813 |
# configuration d'eth1 (utile pour dnsmasq))
|
- |
|
814 |
$SED "s?ifconfig.*?ifconfig \$HS_LANIF $PRIVATE_IP?g" /etc/init.d/chilli
|
- |
|
815 |
# ajout de la fonction 'status' (utile pour la gestion du process)
|
813 |
# ajout de la fonction 'status' (utile pour la gestion du process)
|
816 |
$SED "/^.*functions/i. /etc/init.d/functions" /etc/init.d/chilli
|
814 |
$SED "/^.*functions/i. /etc/init.d/functions" /etc/init.d/chilli
|
817 |
$SED "/^[\t ]*stop)/i\ status)\n status chilli\n RETVAL=$?\n ;;\n" /etc/init.d/chilli
|
815 |
$SED "/^[\t ]*stop)/i\ status)\n status chilli\n RETVAL=$?\n ;;\n" /etc/init.d/chilli
|
818 |
# insertion d'une tempo sur le 'restart' pour permettre à tun0 d'être libérée
|
816 |
# insertion d'une tempo sur le 'restart' pour permettre à tun0 d'être libérée
|
819 |
$SED "/^[\t ]*\$0 start/i\ sleep 2" /etc/init.d/chilli
|
817 |
$SED "/^[\t ]*\$0 start/i\ sleep 2" /etc/init.d/chilli
|
Line 864... |
Line 862... |
864 |
chmod 660 $DIR_DEST_ETC/alcasar-*
|
862 |
chmod 660 $DIR_DEST_ETC/alcasar-*
|
865 |
# Configuration des fichier WEB d'interception (secret partagé avec coova-chilli et nom d'organisme)
|
863 |
# Configuration des fichier WEB d'interception (secret partagé avec coova-chilli et nom d'organisme)
|
866 |
$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
|
864 |
$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
|
867 |
$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
|
865 |
$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
|
868 |
$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php $DIR_WEB/status.php
|
866 |
$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php $DIR_WEB/status.php
|
- |
|
867 |
# user 'chilli' creation (in order to run conup/off and up/down scripts
|
- |
|
868 |
chilli_exist=`grep chilli /etc/passwd|wc -l`
|
- |
|
869 |
if [ "$chilli_exist" == "1" ]
|
- |
|
870 |
then
|
- |
|
871 |
userdel -r chilli 2>/dev/null
|
- |
|
872 |
fi
|
- |
|
873 |
groupadd -f chilli
|
- |
|
874 |
useradd -r -g chilli -s /bin/false -c "system user for coova-chilli" chilli
|
869 |
} # End of param_chilli ()
|
875 |
} # End of param_chilli ()
|
870 |
|
876 |
|
871 |
##########################################################
|
877 |
##########################################################
|
872 |
## Fonction param_squid ##
|
878 |
## Fonction param_squid ##
|
873 |
## - Paramètrage du proxy 'squid' en mode 'cache' ##
|
879 |
## - Paramètrage du proxy 'squid' en mode 'cache' ##
|
Line 968... |
Line 974... |
968 |
if [ "$havp_exist" == "1" ]
|
974 |
if [ "$havp_exist" == "1" ]
|
969 |
then
|
975 |
then
|
970 |
userdel -r havp 2>/dev/null
|
976 |
userdel -r havp 2>/dev/null
|
971 |
fi
|
977 |
fi
|
972 |
groupadd -f havp
|
978 |
groupadd -f havp
|
973 |
useradd -M -g havp havp
|
979 |
useradd -r -g havp -s /bin/false -c "system user for havp" havp
|
974 |
mkdir -p /var/tmp/havp /var/log/havp
|
980 |
mkdir -p /var/tmp/havp /var/log/havp
|
975 |
chown -R havp /var/tmp/havp /var/log/havp /var/run/havp
|
981 |
chown -R havp /var/tmp/havp /var/log/havp /var/run/havp
|
976 |
$SED "/$HAVP_BIN -c $HAVP_CONFIG/i chown -R havp:havp \/var\/tmp\/havp" /etc/init.d/havp
|
982 |
$SED "/$HAVP_BIN -c $HAVP_CONFIG/i chown -R havp:havp \/var\/tmp\/havp" /etc/init.d/havp
|
977 |
# configuration d'HAVP
|
983 |
# configuration d'HAVP
|
978 |
[ -e /etc/havp/havp.config.default ] || cp /etc/havp/havp.config /etc/havp/havp.config.default
|
984 |
[ -e /etc/havp/havp.config.default ] || cp /etc/havp/havp.config /etc/havp/havp.config.default
|
Line 1334... |
Line 1340... |
1334 |
find /var/log/$dir -type f -name *.log-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -exec gzip {} \;
|
1340 |
find /var/log/$dir -type f -name *.log-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -exec gzip {} \;
|
1335 |
done
|
1341 |
done
|
1336 |
# export des logs en 'retard' dans /var/Save/logs
|
1342 |
# export des logs en 'retard' dans /var/Save/logs
|
1337 |
/usr/local/bin/alcasar-log-export.sh
|
1343 |
/usr/local/bin/alcasar-log-export.sh
|
1338 |
# processus lancés par défaut au démarrage
|
1344 |
# processus lancés par défaut au démarrage
|
1339 |
for i in ntpd iptables ulogd dnsmasq squid chilli httpd radiusd mysqld dansguardian havp freshclam
|
1345 |
for i in ntpd iptables ulogd dnsmasq squid chilli httpd radiusd netfs mysqld dansguardian havp freshclam
|
1340 |
do
|
1346 |
do
|
1341 |
/sbin/chkconfig --add $i
|
1347 |
/sbin/chkconfig --add $i
|
1342 |
done
|
1348 |
done
|
1343 |
# pour éviter les alertes de dépendance entre service.
|
1349 |
# pour éviter les alertes de dépendance entre service.
|
1344 |
$SED "s?^# Required-Start.*?# Required-Start: \$local_fs \$network?g" /etc/init.d/mysqld
|
1350 |
$SED "s?^# Required-Start.*?# Required-Start: \$local_fs \$network?g" /etc/init.d/mysqld
|