Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1215 2013-09-18 22:08:14Z richard $
|
2 |
# $Id: alcasar.sh 1219 2013-09-20 13:41:29Z crox53 $
|
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 18... |
Line 18... |
18 |
# Script d'installation d'ALCASAR (Application Libre pour le Contrôle d'Accès Sécurisé et Authentifié au Réseau)
|
18 |
# Script d'installation d'ALCASAR (Application Libre pour le Contrôle d'Accès Sécurisé et Authentifié au Réseau)
|
19 |
# ALCASAR est architecturé autour d'une distribution Linux Mageia minimaliste et les logiciels libres suivants :
|
19 |
# ALCASAR est architecturé autour d'une distribution Linux Mageia minimaliste et les logiciels libres suivants :
|
20 |
# Install script for ALCASAR (a secured and authenticated Internet access control captive portal)
|
20 |
# Install script for ALCASAR (a secured and authenticated Internet access control captive portal)
|
21 |
# ALCASAR is based on a stripped Mageia (LSB) with the following open source softwares :
|
21 |
# ALCASAR is based on a stripped Mageia (LSB) with the following open source softwares :
|
22 |
#
|
22 |
#
|
23 |
# Coovachilli (a fork of chillispot), freeradius, mysql, apache, netfilter, squid, dansguardian, ntpd, openssl, dnsmasq, havp, libclamav and firewalleyes
|
23 |
# Coovachilli (a fork of chillispot), freeradius, mysql, apache, netfilter, squid, dansguardian, ntpd, openssl, dnsmasq, havp, libclamav
|
24 |
|
24 |
|
25 |
# Options :
|
25 |
# Options :
|
26 |
# -i or --install
|
26 |
# -i or --install
|
27 |
# -u or --uninstall
|
27 |
# -u or --uninstall
|
28 |
|
28 |
|
Line 1208... |
Line 1208... |
1208 |
usermod -G www-data nfsen
|
1208 |
usermod -G www-data nfsen
|
1209 |
#Ajout du plugin nfsen : PortTracker
|
1209 |
#Ajout du plugin nfsen : PortTracker
|
1210 |
mkdir -p /var/www/nfsen/plugins
|
1210 |
mkdir -p /var/www/nfsen/plugins
|
1211 |
chown -R nfsen:www-data /var/www/nfsen
|
1211 |
chown -R nfsen:www-data /var/www/nfsen
|
1212 |
#Ajout du plugin PortTracker
|
1212 |
#Ajout du plugin PortTracker
|
1213 |
mkdir -p /var/log/netflow/porttracker /usr/share/nfsen/plugins
|
1213 |
mkdir -p /var/log/netflow/porttracker
|
- |
|
1214 |
mkdir -p /usr/share/nfsen/plugins
|
1214 |
chown -R apache:apache /var/log/netflow/porttracker /usr/share/nfsen
|
1215 |
chown -R apache:apache /usr/share/nfsen
|
1215 |
cp -f $DIR_CONF/nfsen/PortTracker.pm /tmp/nfsen-1.3.6p1/contrib/PortTracker/
|
1216 |
cp -f $DIR_CONF/nfsen/PortTracker.pm /tmp/nfsen-1.3.6p1/contrib/PortTracker/
|
- |
|
1217 |
chown apache /var/log/netflow/porttracker
|
1216 |
#Copie du fichier de conf modifié de nfsen
|
1218 |
#Copie du fichier de conf modifié de nfsen
|
1217 |
cp $DIR_CONF/nfsen/nfsen.conf /tmp/nfsen-1.3.6p1/etc/
|
1219 |
cp $DIR_CONF/nfsen/nfsen.conf /tmp/nfsen-1.3.6p1/etc/
|
1218 |
#Copie du script d'initialisation de nfsen
|
1220 |
#Copie du script d'initialisation de nfsen
|
1219 |
cp $DIR_CONF/nfsen/nfsen.service /lib/systemd/system/
|
1221 |
cp $DIR_CONF/nfsen/nfsen.service /lib/systemd/system/
|
- |
|
1222 |
systemctl enable nfsen.service
|
1220 |
#Installation de nfsen via le scrip Perl
|
1223 |
#Installation de nfsen via le scrip Perl
|
1221 |
DirTmp=$(pwd)
|
1224 |
DirTmp=$(pwd)
|
1222 |
cd /tmp/nfsen-1.3.6p1/
|
1225 |
cd /tmp/nfsen-1.3.6p1/
|
1223 |
/usr/bin/perl5 install.pl etc/nfsen.conf #script lancé deux fois pour corriger,
|
1226 |
/usr/bin/perl5 install.pl etc/nfsen.conf #script lancé deux fois pour corriger,
|
1224 |
/usr/bin/perl5 install.pl etc/nfsen.conf #un problème Perl : "Semaphore introuvable"
|
1227 |
/usr/bin/perl5 install.pl etc/nfsen.conf #un problème Perl : "Semaphore introuvable"
|
Line 1421... |
Line 1424... |
1421 |
# mise à jour automatique de la distribution tous les jours 3h30
|
1424 |
# mise à jour automatique de la distribution tous les jours 3h30
|
1422 |
30 3 * * * root /usr/sbin/urpmi --auto-update --auto 2>&1
|
1425 |
30 3 * * * root /usr/sbin/urpmi --auto-update --auto 2>&1
|
1423 |
EOF
|
1426 |
EOF
|
1424 |
cat << EOF > /etc/cron.d/alcasar-netflow
|
1427 |
cat << EOF > /etc/cron.d/alcasar-netflow
|
1425 |
# mise à jour automatique du délais d'expiration des log Nertflow (tous les vendredi à 0h05)
|
1428 |
# mise à jour automatique du délais d'expiration des log Nertflow (tous les vendredi à 0h05)
|
1426 |
05 0 * * 5 root $DIR_DEST_BIN/alcasar-netflow.sh
|
1429 |
15 0 * * 1 root $DIR_DEST_BIN/alcasar-netflow.sh
|
1427 |
EOF
|
1430 |
EOF
|
1428 |
|
1431 |
|
1429 |
# mise à jour des stats de connexion (accounting). Scripts provenant de "dialupadmin" (rpm freeradius-web) (cf. wiki.freeradius.org/Dialup_admin).
|
1432 |
# mise à jour des stats de connexion (accounting). Scripts provenant de "dialupadmin" (rpm freeradius-web) (cf. wiki.freeradius.org/Dialup_admin).
|
1430 |
# on écrase le crontab d'origine installé par le RPM "freeradius-web" (bug remonté à qa.mandriva.com : 46739).
|
1433 |
# on écrase le crontab d'origine installé par le RPM "freeradius-web" (bug remonté à qa.mandriva.com : 46739).
|
1431 |
# 'tot_stats' (tout les jours à 01h01) : aggrégat des connexions journalières par usager (renseigne la table 'totacct')
|
1434 |
# 'tot_stats' (tout les jours à 01h01) : aggrégat des connexions journalières par usager (renseigne la table 'totacct')
|
Line 1531... |
Line 1534... |
1531 |
do
|
1534 |
do
|
1532 |
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 {} \;
|
1535 |
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 {} \;
|
1533 |
done
|
1536 |
done
|
1534 |
# export des logs en 'retard' dans /var/Save/logs
|
1537 |
# export des logs en 'retard' dans /var/Save/logs
|
1535 |
/usr/local/bin/alcasar-log.sh --export
|
1538 |
/usr/local/bin/alcasar-log.sh --export
|
1536 |
# creation of the unit of alcasar-load_balancing
|
1539 |
# processus lancés par défaut au démarrage
|
- |
|
1540 |
for i in ntpd iptables ulogd dnsmasq squid chilli httpd radiusd netfs mysqld dansguardian havp freshclam nfsen
|
- |
|
1541 |
do
|
- |
|
1542 |
/sbin/chkconfig --add $i
|
- |
|
1543 |
done
|
- |
|
1544 |
|
1537 |
cat << EOF > /lib/systemd/system/alcasar-load_balancing.service
|
1545 |
cat << EOF > /lib/systemd/system/alcasar-load_balancing.service
|
1538 |
# This file is part of systemd.
|
1546 |
# This file is part of systemd.
|
1539 |
#
|
1547 |
#
|
1540 |
# systemd is free software; you can redistribute it and/or modify it
|
1548 |
# systemd is free software; you can redistribute it and/or modify it
|
1541 |
# under the terms of the GNU General Public License as published by
|
1549 |
# under the terms of the GNU General Public License as published by
|
Line 1556... |
Line 1564... |
1556 |
SysVStartPriority=99
|
1564 |
SysVStartPriority=99
|
1557 |
|
1565 |
|
1558 |
[Install]
|
1566 |
[Install]
|
1559 |
WantedBy=multi-user.target
|
1567 |
WantedBy=multi-user.target
|
1560 |
EOF
|
1568 |
EOF
|
1561 |
|
- |
|
1562 |
# process launch at boot time
|
- |
|
1563 |
for service in ntpd iptables ulogd dnsmasq squid chilli httpd radiusd netfs mysqld dansguardian havp freshclam
|
- |
|
1564 |
do
|
- |
|
1565 |
/sbin/chkconfig --add $service
|
- |
|
1566 |
done
|
- |
|
1567 |
for service in alcasar-load_balancing.service nfsen.service
|
1569 |
systemctl enable alcasar-load_balancing.service
|
1568 |
|
- |
|
1569 |
do
|
- |
|
1570 |
/bin/systemctl enable $service
|
- |
|
1571 |
done
|
- |
|
1572 |
|
1570 |
|
1573 |
# On applique les préconisations ANSSI
|
1571 |
# On applique les préconisations ANSSI
|
1574 |
# Apply French Security Agency rules
|
1572 |
# Apply French Security Agency rules
|
1575 |
# ignorer les broadcast ICMP. (attaque smurf)
|
1573 |
# ignorer les broadcast ICMP. (attaque smurf)
|
1576 |
sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1
|
1574 |
sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1
|
Line 1835... |
Line 1833... |
1835 |
mode="install"
|
1833 |
mode="install"
|
1836 |
fi
|
1834 |
fi
|
1837 |
for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus param_ulogd param_nfsen param_dnsmasq BL cron fail2ban post_install
|
1835 |
for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus param_ulogd param_nfsen param_dnsmasq BL cron fail2ban post_install
|
1838 |
do
|
1836 |
do
|
1839 |
$func
|
1837 |
$func
|
1840 |
# echo "*** 'debug' : end of function $func ***"; read a
|
1838 |
echo "*** 'debug' : end of function $func ***"; read a
|
1841 |
done
|
1839 |
done
|
1842 |
;;
|
1840 |
;;
|
1843 |
-u | --uninstall)
|
1841 |
-u | --uninstall)
|
1844 |
if [ ! -e $DIR_DEST_SBIN/alcasar-uninstall.sh ]
|
1842 |
if [ ! -e $DIR_DEST_SBIN/alcasar-uninstall.sh ]
|
1845 |
then
|
1843 |
then
|