Line 1... |
Line 1... |
1 |
#/bin/bash
|
1 |
#/bin/bash
|
2 |
# $Id: alcasar-conf.sh 1057 2013-03-27 22:05:36Z richard $
|
2 |
# $Id: alcasar-conf.sh 1060 2013-03-31 18:10:30Z richard $
|
3 |
|
3 |
|
4 |
# alcasar-conf.sh
|
4 |
# alcasar-conf.sh
|
5 |
# by REXY
|
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 |
# Ce script permet la mise à jour ALCASAR
|
8 |
# Ce script permet la mise à jour ALCASAR
|
9 |
# - création et chargement de l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
9 |
# - création de l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
- |
|
10 |
# - chargement d'une archive (lors de la mise à jour d'un alcasar)
|
10 |
# - application des directives du fichier de conf central (/usr/local/etc/alcasar.conf)
|
11 |
# - application des directives du fichier de conf central "/usr/local/etc/alcasar.conf" (lors d'un changement de conf à chaud)
|
11 |
# This script allows ALCASAR update
|
12 |
# This script allows ALCASAR update
|
12 |
# - create and load the configuration files backup (/tmp/alcasar-conf.tar.gz)
|
13 |
# - create the configuration files backup (/tmp/alcasar-conf.tar.gz)
|
- |
|
14 |
# - load the bachup of configuration files (during the update process)
|
13 |
# - apply ALCASAR central configuration file (/usr/local/etc/alcasar.conf)
|
15 |
# - apply ALCASAR central configuration file "/usr/local/etc/alcasar.conf" (when hot modification are needed)
|
14 |
|
16 |
|
15 |
new="$(date +%G%m%d-%Hh%M)" # date et heure des fichiers
|
17 |
new="$(date +%G%m%d-%Hh%M)" # date et heure des fichiers
|
16 |
fichier="alcasar-conf-$new.tar.gz" # nom du fichier de sauvegarde
|
18 |
fichier="alcasar-conf-$new.tar.gz" # nom du fichier de sauvegarde
|
17 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
19 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
18 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
20 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
Line 35... |
Line 37... |
35 |
DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
|
37 |
DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
|
36 |
DOMAIN=${DOMAIN:=localdomain}
|
38 |
DOMAIN=${DOMAIN:=localdomain}
|
37 |
DATE=`date '+%d %B %Y - %Hh%M'`
|
39 |
DATE=`date '+%d %B %Y - %Hh%M'`
|
38 |
private_network_calc ()
|
40 |
private_network_calc ()
|
39 |
{
|
41 |
{
|
40 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
42 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
41 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
43 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
42 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX # @ + masque du réseau de consult (192.168.182.0/24)
|
44 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX # @ + masque du réseau de consult (192.168.182.0/24)
|
43 |
classe=$((PRIVATE_PREFIX/8)); classe_sup=`expr $classe + 1`; classe_sup_sup=`expr $classe + 2` # classes de réseau (ex.: 2=classe B, 3=classe C)
|
45 |
classe=$((PRIVATE_PREFIX/8)); classe_sup=`expr $classe + 1`; classe_sup_sup=`expr $classe + 2` # classes de réseau (ex.: 2=classe B, 3=classe C)
|
44 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
46 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
- |
|
47 |
PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2` # private network broadcast (ie.: 192.168.182.255)
|
- |
|
48 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup` # last octet of LAN address
|
- |
|
49 |
private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup` # last octet of LAN broadcast
|
- |
|
50 |
PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1` # First network address (ex.: 192.168.182.1)
|
- |
|
51 |
PRIVATE_SECOND_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2` # second network address (ex.: 192.168.182.2)
|
- |
|
52 |
PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1` # last network address (ex.: 192.168.182.254)
|
45 |
}
|
53 |
}
|
46 |
|
54 |
|
47 |
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
|
55 |
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
|
48 |
nb_args=$#
|
56 |
nb_args=$#
|
49 |
args=$1
|
57 |
args=$1
|
Line 58... |
Line 66... |
58 |
exit 0
|
66 |
exit 0
|
59 |
;;
|
67 |
;;
|
60 |
--create|-create)
|
68 |
--create|-create)
|
61 |
[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
|
69 |
[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
|
62 |
mkdir $DIR_UPDATE
|
70 |
mkdir $DIR_UPDATE
|
63 |
# Sauvegarde du fichier général de DNSMASQ ---- provisoire le temps que le bug de dnsmasq soit corrigé.
|
- |
|
64 |
if [ `grep -c "^OPTIONS=\"\$OPTIONS --server=" /etc/sysconfig/dnsmasq` -eq "1" ]
|
- |
|
65 |
then cp /etc/sysconfig/dnsmasq $DIR_UPDATE
|
- |
|
66 |
fi
|
- |
|
67 |
# Sauvegarde de la base des usagers
|
71 |
# Sauvegarde de la base des usagers
|
68 |
/usr/local/sbin/alcasar-mysql.sh -dump
|
72 |
/usr/local/sbin/alcasar-mysql.sh -dump
|
69 |
cp /var/Save/base/`ls /var/Save/base|tail -1` $DIR_UPDATE
|
73 |
cp /var/Save/base/`ls /var/Save/base|tail -1` $DIR_UPDATE
|
70 |
# Sauvegarde du logo
|
74 |
# Sauvegarde du logo
|
71 |
cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
|
75 |
cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
|
Line 232... |
Line 236... |
232 |
rm -rf $DIR_UPDATE
|
236 |
rm -rf $DIR_UPDATE
|
233 |
;;
|
237 |
;;
|
234 |
--load|-load)
|
238 |
--load|-load)
|
235 |
cd /tmp
|
239 |
cd /tmp
|
236 |
tar -xf /tmp/alcasar-conf*.tar.gz
|
240 |
tar -xf /tmp/alcasar-conf*.tar.gz
|
237 |
# récupération du fichier général de dnsmasq en attendant sa correction du bug pour les DNS externes
|
- |
|
238 |
[ -e $DIR_UPDATE/dnsmasq ] && cp -f $DIR_UPDATE/dnsmasq /etc/sysconfig/dnsmasq \
|
- |
|
239 |
&& chown root.root /etc/sysconfig/dnsmasq \
|
- |
|
240 |
&& chmod 644 /etc/sysconfig/dnsmasq
|
- |
|
241 |
# Récupération du logo
|
241 |
# Retrieve the logo
|
242 |
[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
|
242 |
[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
|
243 |
chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
|
243 |
chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
|
244 |
# Récupération des certificats (CA et serveur)
|
244 |
# Retrieve the security certificates (CA and server)
|
245 |
[ -e $DIR_UPDATE/alcasar-ca.crt ] && cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
|
245 |
[ -e $DIR_UPDATE/alcasar-ca.crt ] && cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
|
246 |
[ -e $DIR_UPDATE/alcasar-ca.key ] && cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
|
246 |
[ -e $DIR_UPDATE/alcasar-ca.key ] && cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
|
247 |
[ -e $DIR_UPDATE/alcasar.crt ] && cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
|
247 |
[ -e $DIR_UPDATE/alcasar.crt ] && cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
|
248 |
[ -e $DIR_UPDATE/alcasar.key ] && cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
|
248 |
[ -e $DIR_UPDATE/alcasar.key ] && cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
|
249 |
[ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt /etc/pki/tls/certs/
|
249 |
[ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt /etc/pki/tls/certs/
|
250 |
chown -R root:apache /etc/pki
|
250 |
chown -R root:apache /etc/pki
|
251 |
chmod -R 750 /etc/pki
|
251 |
chmod -R 750 /etc/pki
|
252 |
# Import de la dernière base usagers
|
252 |
# Import of the users database
|
253 |
mysql -u$DB_USER -p$radiuspwd < `ls $DIR_UPDATE/radius*`
|
253 |
mysql -u$DB_USER -p$radiuspwd < `ls $DIR_UPDATE/radius*`
|
254 |
# Récupération des paramêtres locaux. Suppression des fichier de la blacklist (dorénavant exploités dans /usr/local/share)
|
254 |
# Retrieve lacal parameters & Remove blacklist files (now in /usr/local/share)
|
255 |
[ -d $DIR_UPDATE/etc ] && rm -rf $DIR_UPDATE/etc/alcasar-dnsfilter* && cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
|
255 |
[ -d $DIR_UPDATE/etc ] && rm -rf $DIR_UPDATE/etc/alcasar-dnsfilter* && cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
|
256 |
# Récupération des fichiers de Dansguardian
|
256 |
# Retrieve Dansguardian files
|
257 |
[ -e $DIR_UPDATE/exceptioniplist ] && cp -f $DIR_UPDATE/exceptioniplist /etc/dansguardian/lists/
|
257 |
[ -e $DIR_UPDATE/exceptioniplist ] && cp -f $DIR_UPDATE/exceptioniplist /etc/dansguardian/lists/
|
258 |
[ -e $DIR_UPDATE/exceptionsitelist ] && cp -f $DIR_UPDATE/exceptionsitelist /etc/dansguardian/lists/
|
258 |
[ -e $DIR_UPDATE/exceptionsitelist ] && cp -f $DIR_UPDATE/exceptionsitelist /etc/dansguardian/lists/
|
259 |
[ -e $DIR_UPDATE/urlregexplist ] && cp -f $DIR_UPDATE/urlregexplist /etc/dansguardian/lists/
|
259 |
[ -e $DIR_UPDATE/urlregexplist ] && cp -f $DIR_UPDATE/urlregexplist /etc/dansguardian/lists/
|
260 |
[ -e $DIR_UPDATE/bannedsitelist ] && cp -f $DIR_UPDATE/bannedsitelist /etc/dansguardian/lists/
|
260 |
[ -e $DIR_UPDATE/bannedsitelist ] && cp -f $DIR_UPDATE/bannedsitelist /etc/dansguardian/lists/
|
261 |
[ -e $DIR_UPDATE/exceptionurllist ] && cp -f $DIR_UPDATE/exceptionurllist /etc/dansguardian/lists/
|
261 |
[ -e $DIR_UPDATE/exceptionurllist ] && cp -f $DIR_UPDATE/exceptionurllist /etc/dansguardian/lists/
|
262 |
[ -e $DIR_UPDATE/bannedurllist ] && cp -f $DIR_UPDATE/bannedurllist /etc/dansguardian/lists/
|
262 |
[ -e $DIR_UPDATE/bannedurllist ] && cp -f $DIR_UPDATE/bannedurllist /etc/dansguardian/lists/
|
263 |
[ -d $DIR_UPDATE/ossi ] && cp -rf $DIR_UPDATE/ossi /etc/dansguardian/lists/blacklists/
|
263 |
[ -d $DIR_UPDATE/ossi ] && cp -rf $DIR_UPDATE/ossi /etc/dansguardian/lists/blacklists/
|
264 |
chown -R dansguardian:apache /etc/dansguardian/lists
|
264 |
chown -R dansguardian:apache /etc/dansguardian/lists
|
265 |
chmod -R g+rw /etc/dansguardian/lists
|
265 |
chmod -R g+rw /etc/dansguardian/lists
|
266 |
# Start / Stop DNS/URL filtering
|
266 |
# Adapt DNS/URL filtering
|
267 |
PARENT_SCRIPT=$0
|
267 |
PARENT_SCRIPT=`basename $0`
|
268 |
export PARENT_SCRIPT
|
268 |
export PARENT_SCRIPT
|
269 |
$DIR_SBIN/alcasar-bl.sh -adapt
|
269 |
$DIR_SBIN/alcasar-bl.sh -adapt
|
270 |
$DIR_SBIN/alcasar-bl.sh -reload
|
270 |
$DIR_SBIN/alcasar-bl.sh -reload
|
- |
|
271 |
# retrieve dnsmasq general config file
|
271 |
[ -e $DIR_UPDATE/dnsmasq ] && cp -f $DIR_UPDATE/dnsmasq /etc/sysconfig/dnsmasq
|
272 |
[ -e $DIR_UPDATE/dnsmasq ] && cp -f $DIR_UPDATE/dnsmasq /etc/sysconfig/dnsmasq \
|
- |
|
273 |
&& chown root.root /etc/sysconfig/dnsmasq \
|
- |
|
274 |
&& chmod 644 /etc/sysconfig/dnsmasq
|
272 |
# Prise en compte des comptes de gestion (admin + manager + backup)
|
275 |
# admin profile update (admin + manager + backup)
|
273 |
$DIR_SBIN/alcasar-profil.sh --list
|
276 |
$DIR_SBIN/alcasar-profil.sh --list
|
274 |
# Start / Stop SSH Daemon
|
277 |
# Start / Stop SSH Daemon
|
275 |
ssh_active=`grep SSH $CONF_FILE|cut -d"=" -f2`
|
278 |
ssh_active=`grep SSH $CONF_FILE|cut -d"=" -f2`
|
276 |
if [ $ssh_active = "on" ]
|
279 |
if [ $ssh_active = "on" ]
|
277 |
then
|
280 |
then
|
278 |
/sbin/chkconfig --add sshd
|
281 |
/sbin/chkconfig --add sshd
|
279 |
else
|
282 |
else
|
280 |
/sbin/chkconfig --del sshd
|
283 |
/sbin/chkconfig --del sshd
|
281 |
fi
|
284 |
fi
|
282 |
# Effacement du répertoire d'update
|
285 |
# Remove the update folder
|
283 |
rm -rf $DIR_UPDATE
|
286 |
rm -rf $DIR_UPDATE
|
284 |
;;
|
287 |
;;
|
285 |
--apply|-apply)
|
288 |
--apply|-apply)
|
286 |
PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([012]?[0-9]|3[0-2])\b"
|
289 |
PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/([012]?[0-9]|3[0-2])\b"
|
287 |
PRIVATE_IP_MASK=`grep ^PRIVATE_IP $CONF_FILE|cut -d"=" -f2`
|
290 |
PRIVATE_IP_MASK=`grep ^PRIVATE_IP $CONF_FILE|cut -d"=" -f2`
|
Line 323... |
Line 326... |
323 |
PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
|
326 |
PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
|
324 |
PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
|
327 |
PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
|
325 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
|
328 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
|
326 |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
|
329 |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
|
327 |
private_network_calc
|
330 |
private_network_calc
|
328 |
VERSION=`grep VERSION $CONF_FILE|cut -d"=" -f2`
|
- |
|
329 |
INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
|
331 |
INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
|
330 |
ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
|
332 |
ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
|
331 |
DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
|
333 |
DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
|
332 |
DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
|
334 |
DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
|
333 |
if [ $DHCP_mode = "off" ]
|
335 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
334 |
then
|
336 |
then
|
- |
|
337 |
if [ $DHCP_mode = "off" ]
|
- |
|
338 |
then
|
335 |
$DIR_SBIN/alcasar-dhcp.sh --off
|
339 |
$DIR_SBIN/alcasar-dhcp.sh --off
|
336 |
fi
|
340 |
fi
|
337 |
# Logout everybody
|
341 |
# Logout everybody
|
338 |
$DIR_SBIN/alcasar-logout.sh all
|
342 |
$DIR_SBIN/alcasar-logout.sh all
|
339 |
# Services stop
|
343 |
# Services stop
|
340 |
for i in squid ntpd chilli httpd network
|
344 |
for i in squid ntpd chilli httpd network
|
341 |
do
|
345 |
do
|
342 |
[ -e /etc/init.d/$i ] && /etc/init.d/$i stop && killall $i 2>/dev/null
|
346 |
[ -e /etc/init.d/$i ] && /etc/init.d/$i stop && killall $i 2>/dev/null
|
343 |
done
|
347 |
done
|
- |
|
348 |
fi
|
344 |
|
349 |
|
345 |
# /etc/hosts
|
350 |
# /etc/hosts
|
346 |
cat <<EOF > /etc/hosts
|
351 |
cat <<EOF > /etc/hosts
|
347 |
127.0.0.1 localhost
|
352 |
127.0.0.1 localhost
|
348 |
$PRIVATE_IP $HOSTNAME $HOSTNAME.$DOMAIN
|
353 |
$PRIVATE_IP $HOSTNAME $HOSTNAME.$DOMAIN
|
Line 359... |
Line 364... |
359 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
364 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
360 |
sshd: ALL
|
365 |
sshd: ALL
|
361 |
ntpd: $PRIVATE_NETWORK_SHORT
|
366 |
ntpd: $PRIVATE_NETWORK_SHORT
|
362 |
EOF
|
367 |
EOF
|
363 |
# Alcasar Control Center
|
368 |
# Alcasar Control Center
|
364 |
echo "$VERSION du $INSTALL_DATE" > /var/www/html/VERSION; chown apache:apache /var/www/html/VERSION
|
- |
|
365 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
|
369 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
|
366 |
FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
|
370 |
FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
|
367 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" $FIC_MOD_SSL
|
371 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" $FIC_MOD_SSL
|
368 |
$SED "/127.0.0.1/!s?Allow from .*?Allow from $PRIVATE_NETWORK_MASK?g" /etc/httpd/conf/webapps.d/alcasar.conf
|
372 |
$SED "/127.0.0.1/!s?Allow from .*?Allow from $PRIVATE_NETWORK_MASK?g" /etc/httpd/conf/webapps.d/alcasar.conf
|
369 |
# Dialup_Admin
|
373 |
# Dialup_Admin
|
Line 386... |
Line 390... |
386 |
do
|
390 |
do
|
387 |
$SED "/^server=/d" $i
|
391 |
$SED "/^server=/d" $i
|
388 |
echo "server=$DNS1" >> $i
|
392 |
echo "server=$DNS1" >> $i
|
389 |
echo "server=$DNS2" >> $i
|
393 |
echo "server=$DNS2" >> $i
|
390 |
done
|
394 |
done
|
391 |
$SED "s?^dhcp-range=.*?dhcp-range=$PRIVATE_IP,192.168.182.254,$PRIVATE_NETMASK,12h?g" /etc/dnsmasq.conf
|
395 |
$SED "s?^dhcp-range=.*?dhcp-range=$PRIVATE_SECOND_IP,$PRIVATE_LAST_IP,$PRIVATE_NETMASK,12h?g" /etc/dnsmasq.conf
|
392 |
$SED "s?^dhcp-option=option:router.*?dhcp-option=option:router,$PRIVATE_IP?g" /etc/dnsmasq.conf
|
396 |
$SED "s?^dhcp-option=option:router.*?dhcp-option=option:router,$PRIVATE_IP?g" /etc/dnsmasq.conf
|
393 |
# DG + BL
|
397 |
# DG + BL
|
394 |
$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/dansguardian/dansguardian.conf
|
398 |
$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/dansguardian/dansguardian.conf
|
395 |
# Watchdog
|
399 |
# Watchdog
|
396 |
$SED "s?^PRIVATE_IP=.*?PRIVATE_IP=\"$PRIVATE_IP\"?g" $DIR_BIN/alcasar-watchdog.sh
|
400 |
$SED "s?^PRIVATE_IP=.*?PRIVATE_IP=\"$PRIVATE_IP\"?g" $DIR_BIN/alcasar-watchdog.sh
|
Line 401... |
Line 405... |
401 |
$SED "/ListenAddress $PUBLIC_IP/a\ListenAddress $PRIVATE_IP" /etc/ssh/sshd_config
|
405 |
$SED "/ListenAddress $PUBLIC_IP/a\ListenAddress $PRIVATE_IP" /etc/ssh/sshd_config
|
402 |
# Prompts
|
406 |
# Prompts
|
403 |
$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc
|
407 |
$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc
|
404 |
# sudoers
|
408 |
# sudoers
|
405 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
409 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
- |
|
410 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
- |
|
411 |
then
|
406 |
# Services start
|
412 |
# Services start
|
407 |
for i in network squid ntpd chilli httpd
|
413 |
for i in network squid ntpd chilli httpd
|
408 |
do
|
414 |
do
|
409 |
[ -e /etc/init.d/$i ] && /etc/init.d/$i start 2>/dev/null
|
415 |
[ -e /etc/init.d/$i ] && /etc/init.d/$i start
|
410 |
done
|
416 |
done
|
- |
|
417 |
# Reload BL (restart DG, dnsmasq & iptables)
|
- |
|
418 |
$DIR_SBIN/alcasar-bl.sh -reload
|
- |
|
419 |
fi
|
411 |
# Start / Stop SSH Daemon
|
420 |
# Start / Stop SSH Daemon
|
412 |
ssh_active=`grep SSH $CONF_FILE|cut -d"=" -f2`
|
421 |
ssh_active=`grep SSH $CONF_FILE|cut -d"=" -f2`
|
413 |
if [ $ssh_active = "on" ]
|
422 |
if [ $ssh_active = "on" ]
|
414 |
then
|
423 |
then
|
415 |
/sbin/chkconfig --add sshd
|
424 |
/bin/systemctl enable sshd.service
|
- |
|
425 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
- |
|
426 |
then
|
416 |
/etc/init.d/sshd start
|
427 |
/bin/systemctl start sshd.service
|
- |
|
428 |
fi
|
417 |
else
|
429 |
else
|
418 |
/sbin/chkconfig --del sshd
|
430 |
/bin/systemctl disable sshd.service
|
419 |
echo "Au redémarrage du serveur, le service SSH sera désactivé !!! ; au besoin l'activer dans l'interface de gestion."
|
431 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
420 |
sleep 2
|
432 |
then
|
- |
|
433 |
/bin/systemctl stop sshd.service
|
- |
|
434 |
fi
|
421 |
fi
|
435 |
fi
|
422 |
# Reload BL (restart DG, dnsmasq & iptables)
|
- |
|
423 |
$DIR_SBIN/alcasar-bl.sh -reload
|
- |
|
424 |
;;
|
436 |
;;
|
425 |
*)
|
437 |
*)
|
426 |
echo "Argument inconnu :$1";
|
438 |
echo "Argument inconnu :$1";
|
427 |
echo "$usage"
|
439 |
echo "$usage"
|
428 |
exit 1
|
440 |
exit 1
|