8 |
franck |
1 |
#/bin/sh
|
64 |
franck |
2 |
# $Id: alcasar-conf.sh 631 2011-06-12 10:34:00Z richard $
|
|
|
3 |
# $Author: richard $
|
8 |
franck |
4 |
# by rexy
|
|
|
5 |
# Ce script permet de créer ou de charger l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
|
|
6 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
|
|
7 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
478 |
richard |
8 |
DIR_BIN="/usr/local/bin" # répertoire des scripts d'admin
|
346 |
richard |
9 |
DIR_SBIN="/usr/local/sbin" # répertoire des scripts d'admin
|
|
|
10 |
DIR_ETC="/usr/local/etc" # répertoire des fichiers de conf
|
628 |
richard |
11 |
CONF_FILE="$DIR_ETC/alcasar.conf" # main alcasar conf file
|
510 |
richard |
12 |
VERSION="/var/www/html/VERSION" # contient la version en cours
|
628 |
richard |
13 |
EXTIF="eth0" # ETH0 est l'interface connectée à Internet (Box FAI)
|
|
|
14 |
INTIF="eth1" # ETH1 est l'interface connectée au réseau local de consultation
|
|
|
15 |
HOSTNAME="alcasar"
|
369 |
richard |
16 |
DB_USER="radius"
|
504 |
richard |
17 |
radiuspwd=""
|
384 |
richard |
18 |
SED="/bin/sed -i"
|
510 |
richard |
19 |
RUNNING_VERSION=`cat $VERSION|cut -d" " -f1`
|
|
|
20 |
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
|
|
|
21 |
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
|
|
|
22 |
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
|
628 |
richard |
23 |
DATE=`date '+%d %B %Y - %Hh%M'`
|
|
|
24 |
private_network_calc ()
|
|
|
25 |
{
|
|
|
26 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
|
|
27 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
|
|
28 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX # @ + masque du réseau de consult (192.168.182.0/24)
|
|
|
29 |
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)
|
|
|
30 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
|
|
31 |
PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2` # @ broadcast réseau de consultation (ex.: 192.168.182.255)
|
|
|
32 |
tmp_mask=`echo $PRIVATE_NETWORK_MASK|cut -d"/" -f2`; half_mask=`expr $tmp_mask + 1` # masque du 1/2 réseau de consultation (ex.: 25)
|
|
|
33 |
PRIVATE_STAT_IP=$PRIVATE_NETWORK/$half_mask # plage des adresses statiques (ex.: 192.168.182.0/25)
|
|
|
34 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup` # dernier octet de l'@ de réseau
|
|
|
35 |
private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup` # dernier octet de l'@ de broadcast
|
|
|
36 |
private_plage=`expr $private_broadcast_ending - $private_network_ending + 1`
|
|
|
37 |
private_half_plage=`expr $private_plage / 2`
|
|
|
38 |
private_dyn=`expr $private_half_plage + $private_network_ending`
|
|
|
39 |
private_dyn_ip_network=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`"."$private_dyn"."`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup_sup-5`
|
|
|
40 |
PRIVATE_DYN_IP=`echo $private_dyn_ip_network | cut -d"." -f1-4`/$half_mask # @ réseau (CIDR) de la plage des adresses dynamiques (ex.: 192.168.182.128/25)
|
|
|
41 |
private_dyn_ip_ending=`echo $private_dyn_ip_network | cut -d"." -f4`
|
|
|
42 |
PRIVATE_DYN_FIRST_IP=`echo $private_dyn_ip_network | cut -d"." -f1-3`"."`expr $private_dyn_ip_ending + 1` # 1ère adresse de la plage dynamique (ex.: 192.168.182.129)
|
|
|
43 |
PRIVATE_DYN_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1` # dernière adresse de la plage dynamique (ex.: 192.168.182.254)
|
|
|
44 |
}
|
8 |
franck |
45 |
|
628 |
richard |
46 |
usage="Usage: alcasar-conf.sh --create | --load | --apply"
|
8 |
franck |
47 |
nb_args=$#
|
|
|
48 |
args=$1
|
|
|
49 |
if [ $nb_args -eq 0 ]
|
|
|
50 |
then
|
|
|
51 |
nb_args=1
|
|
|
52 |
args="-h"
|
|
|
53 |
fi
|
|
|
54 |
case $args in
|
|
|
55 |
-\? | -h* | --h*)
|
|
|
56 |
echo "$usage"
|
|
|
57 |
exit 0
|
|
|
58 |
;;
|
389 |
franck |
59 |
--create|-create)
|
8 |
franck |
60 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
|
|
61 |
[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
|
|
|
62 |
mkdir $DIR_UPDATE
|
|
|
63 |
# Sauvegarde de la base des usagers
|
411 |
richard |
64 |
/usr/local/sbin/alcasar-mysql.sh -dump
|
8 |
franck |
65 |
cp /var/Save/base/`ls /var/Save/base|tail -1` $DIR_UPDATE
|
|
|
66 |
# Sauvegarde du nom d'organisme
|
604 |
richard |
67 |
echo `cat /root/ALCASAR-parameters.txt|grep Organism|cut -d":" -f2|tr -d " "` > $DIR_UPDATE/organisme
|
8 |
franck |
68 |
# Sauvegarde du logo
|
|
|
69 |
cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
|
310 |
richard |
70 |
# Sauvegarde des fichiers exploités par dansguardian
|
|
|
71 |
cp -f /etc/dansguardian/lists/exceptioniplist $DIR_UPDATE
|
|
|
72 |
cp -f /etc/dansguardian/lists/exceptionsitelist $DIR_UPDATE
|
|
|
73 |
cp -f /etc/dansguardian/lists/bannedsitelist $DIR_UPDATE
|
|
|
74 |
cp -f /etc/dansguardian/lists/exceptionurllist $DIR_UPDATE
|
|
|
75 |
cp -f /etc/dansguardian/lists/bannedurllist $DIR_UPDATE
|
|
|
76 |
cp -rf /etc/dansguardian/lists/blacklists/ossi $DIR_UPDATE
|
612 |
richard |
77 |
# sauvegarde des fichiers : de conf, de filtrage, d'exception, digest, etc.
|
8 |
franck |
78 |
mkdir $DIR_UPDATE/etc/
|
346 |
richard |
79 |
cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
|
510 |
richard |
80 |
# particularité des versions
|
605 |
richard |
81 |
# si version < 2.1
|
510 |
richard |
82 |
if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 1 ]))
|
|
|
83 |
then
|
|
|
84 |
rm -f $DIR_UPDATE/etc/alcasar-dns-name # changement de format
|
|
|
85 |
rm -f $DIR_UPDATE/etc/alcasar-macallowed # ajout d'un commentaire par @MAC
|
|
|
86 |
rm -rf $DIR_UPDATE/etc/digest # hostname=alcasar
|
618 |
richard |
87 |
uamallowed = `cat $DIR_UPDATE/etc/alcasar-uamallowed`
|
|
|
88 |
if [ $uamallowed == "uamallowed=\"\"" ]
|
|
|
89 |
then rm -f $DIR_UPDATE/etc/alcasar-uamallowed # un uamallowed 'vide' perturbe coova
|
|
|
90 |
fi
|
|
|
91 |
uamdomain = `cat $DIR_UPDATE/etc/alcasar-uamdomain`
|
|
|
92 |
if [ $uamdomain == "uamdomain=\"\"" ]
|
|
|
93 |
then rm -f $DIR_UPDATE/etc/alcasar-uamdomain # un uamdomain 'vide' perturbe coova
|
|
|
94 |
fi
|
510 |
richard |
95 |
else
|
605 |
richard |
96 |
# si version >= 2.1 : sauvegarde des certificats (serveur et CA)
|
510 |
richard |
97 |
mkdir $DIR_UPDATE/pki/
|
|
|
98 |
cert_date=`/usr/bin/openssl x509 -noout -in /etc/pki/tls/certs/alcasar.crt -dates|grep After|cut -d"=" -f2`
|
|
|
99 |
cp -f /etc/pki/tls/certs/alcasar.crt $DIR_UPDATE
|
|
|
100 |
cp -f /etc/pki/tls/private/alcasar.key $DIR_UPDATE
|
|
|
101 |
cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
|
|
|
102 |
cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
|
|
|
103 |
fi
|
605 |
richard |
104 |
# si version < 2.2
|
|
|
105 |
if ([ $MAJ_RUNNING_VERSION -lt 2 ] || ([ $MAJ_RUNNING_VERSION -eq 2 ] && [ $MIN_RUNNING_VERSION -lt 2 ]))
|
|
|
106 |
then
|
628 |
richard |
107 |
rm -f $DIR_UPDATE/etc/alcasar-ethers # This file doesn't contain comments
|
|
|
108 |
# Create the initial conf file (doesn't exist in earlier versions)
|
|
|
109 |
cat <<EOF > $CONF_FILE
|
|
|
110 |
##########################################
|
|
|
111 |
## ##
|
|
|
112 |
## ALCASAR Parameters ##
|
|
|
113 |
## ##
|
|
|
114 |
##########################################
|
|
|
115 |
|
|
|
116 |
INSTALL_DATE=$DATE
|
|
|
117 |
VERSION=$RUNNING_VERSION
|
|
|
118 |
ORGANISM=
|
|
|
119 |
EOF
|
|
|
120 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` # @ip du portail (côté Internet)
|
|
|
121 |
PUBLIC_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
|
|
122 |
PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
|
|
123 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
|
|
124 |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS
|
|
|
125 |
DNS2=`grep DNS2 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 2ème DNS
|
|
|
126 |
DNS1=${DNS1:=208.67.220.220}
|
|
|
127 |
DNS2=${DNS2:=208.67.222.222}
|
|
|
128 |
PRIVATE_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2` # @ip du portail (côté LAN)
|
|
|
129 |
PRIVATE_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$INTIF|cut -d"=" -f2`
|
|
|
130 |
private_network_calc
|
|
|
131 |
echo "PUBLIC_IP=$PUBLIC_IP/$PUBLIC_PREFIX" >> $CONF_FILE
|
|
|
132 |
echo "GW=$PUBLIC_GATEWAY" >> $CONF_FILE
|
|
|
133 |
echo "DNS1=$DNS1" >> $CONF_FILE
|
|
|
134 |
echo "DNS2=$DNS2" >> $CONF_FILE
|
|
|
135 |
echo "PRIVATE_IP=$PRIVATE_IP/$PRIVATE_PREFIX" >> $CONF_FILE
|
|
|
136 |
echo "DHCP=on" >> $CONF_FILE
|
|
|
137 |
echo "DHCP_FIRST=$PRIVATE_DYN_FIRST_IP" >> $CONF_FILE
|
|
|
138 |
echo "DHCP_LAST=$PRIVATE_DYN_LAST_IP" >> $CONF_FILE
|
|
|
139 |
if [ -r /var/run/sshd.pid ]; then
|
|
|
140 |
echo "SSH=on" >> $CONF_FILE
|
|
|
141 |
else
|
|
|
142 |
echo "SSH=off" >> $CONF_FILE
|
605 |
richard |
143 |
fi
|
628 |
richard |
144 |
echo "QOS=off" >> $CONF_FILE
|
|
|
145 |
if [ `grep ^ldap /etc/raddb/sites-available/alcasar | wc -l` -eq "0" ]; then
|
|
|
146 |
echo "LDAP=off" >> $CONF_FILE
|
|
|
147 |
else
|
|
|
148 |
echo "LDAP=on" >> $CONF_FILE
|
|
|
149 |
fi
|
|
|
150 |
echo "PROTOCOLS_FILTERING=off" >> $CONF_FILE
|
|
|
151 |
echo "DNS_FILTERING=off" >> $CONF_FILE
|
|
|
152 |
echo "WEB_ANTIVIRUS=on" >> $CONF_FILE
|
|
|
153 |
fi
|
|
|
154 |
cp $CONF_FILE $DIR_UPDATE/etc/
|
8 |
franck |
155 |
# création de l'archive
|
|
|
156 |
cd /tmp
|
|
|
157 |
tar -cf alcasar-conf.tar conf/
|
|
|
158 |
gzip -f alcasar-conf.tar
|
|
|
159 |
rm -rf $DIR_UPDATE
|
|
|
160 |
;;
|
389 |
franck |
161 |
--load|-load)
|
8 |
franck |
162 |
cd /tmp
|
30 |
richard |
163 |
tar -xf /tmp/alcasar-conf.tar.gz
|
8 |
franck |
164 |
# Récupération du logo
|
510 |
richard |
165 |
[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
|
8 |
franck |
166 |
chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
|
|
|
167 |
# Récupération des certificats (CA et serveur)
|
510 |
richard |
168 |
[ -e $DIR_UPDATE/alcasar-ca.crt ] && cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
|
|
|
169 |
[ -e $DIR_UPDATE/alcasar-ca.key ] && cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
|
|
|
170 |
[ -e $DIR_UPDATE/alcasar.crt ] && cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
|
|
|
171 |
[ -e $DIR_UPDATE/alcasar.key ] && cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
|
8 |
franck |
172 |
chown -R root:apache /etc/pki
|
|
|
173 |
chmod -R 750 /etc/pki
|
|
|
174 |
# Import de la dernière base usagers
|
|
|
175 |
mysql -u$DB_USER -p$radiuspwd < `ls $DIR_UPDATE/radius*`
|
612 |
richard |
176 |
# Récupération des paramêtres locaux (fichier de conf, règles de filtrage, fichiers d'exception, comptes de gestion, etc.)
|
|
|
177 |
[ -d $DIR_UPDATE/etc ] && cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
|
310 |
richard |
178 |
# Récupération des fichiers de Dansguardian
|
510 |
richard |
179 |
[ -e $DIR_UPDATE/exceptioniplist ] && cp -f $DIR_UPDATE/exceptioniplist /etc/dansguardian/lists/
|
|
|
180 |
[ -e $DIR_UPDATE/exceptionsitelist ] && cp -f $DIR_UPDATE/exceptionsitelist /etc/dansguardian/lists/
|
|
|
181 |
[ -e $DIR_UPDATE/bannedsitelist ] && cp -f $DIR_UPDATE/bannedsitelist /etc/dansguardian/lists/
|
|
|
182 |
[ -e $DIR_UPDATE/exceptionurllist ] && cp -f $DIR_UPDATE/exceptionurllist /etc/dansguardian/lists/
|
|
|
183 |
[ -e $DIR_UPDATE/bannedurllist ] && cp -f $DIR_UPDATE/bannedurllist /etc/dansguardian/lists/
|
|
|
184 |
[ -d $DIR_UPDATE/ossi ] && cp -rf $DIR_UPDATE/ossi /etc/dansguardian/lists/blacklists/
|
8 |
franck |
185 |
chown -R dansguardian:apache /etc/dansguardian/lists
|
|
|
186 |
chmod -R g+rw /etc/dansguardian/lists
|
478 |
richard |
187 |
# On active/désactive la BL
|
618 |
richard |
188 |
$DIR_SBIN/alcasar-bl.sh -conf
|
434 |
richard |
189 |
# Prise en compte des comptes de gestion (admin + manager + backup)
|
395 |
franck |
190 |
$DIR_SBIN/alcasar-profil.sh --list
|
226 |
franck |
191 |
# Effacement du répertoire d'update
|
8 |
franck |
192 |
rm -rf $DIR_UPDATE
|
|
|
193 |
;;
|
628 |
richard |
194 |
--apply|-apply)
|
|
|
195 |
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]\b"
|
|
|
196 |
PRIVATE_IP_MASK=`grep PRIVATE_IP $CONF_FILE|cut -d"=" -f2`
|
|
|
197 |
check=$(echo $PRIVATE_IP_MASK | egrep $PTN)
|
|
|
198 |
if [[ "$?" -ne 0 ]]
|
|
|
199 |
then
|
|
|
200 |
echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
|
|
|
201 |
exit 0
|
|
|
202 |
fi
|
|
|
203 |
PUBLIC_IP_MASK=`grep PUBLIC_IP $CONF_FILE|cut -d"=" -f2`
|
|
|
204 |
check=$(echo $PUBLIC_IP_MASK | egrep $PTN)
|
|
|
205 |
if [[ "$?" -ne 0 ]]
|
|
|
206 |
then
|
|
|
207 |
echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
|
|
|
208 |
exit 0
|
|
|
209 |
fi
|
|
|
210 |
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]?)\b"
|
|
|
211 |
PUBLIC_GATEWAY=`grep GW $CONF_FILE|cut -d"=" -f2`
|
|
|
212 |
check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
|
|
|
213 |
if [[ "$?" -ne 0 ]]
|
|
|
214 |
then
|
|
|
215 |
echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
|
|
|
216 |
exit 0
|
|
|
217 |
fi
|
|
|
218 |
DNS1=`grep DNS1 $CONF_FILE|cut -d"=" -f2`
|
|
|
219 |
check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
|
|
|
220 |
if [[ "$?" -ne 0 ]]
|
|
|
221 |
then
|
|
|
222 |
echo "Syntax error for the IP address of the first DNS server ($DNS1)"
|
|
|
223 |
exit 0
|
|
|
224 |
fi
|
|
|
225 |
DNS2=`grep DNS2 $CONF_FILE|cut -d"=" -f2`
|
|
|
226 |
check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
|
|
|
227 |
if [[ "$?" -ne 0 ]]
|
|
|
228 |
then
|
|
|
229 |
echo "Syntax error for the IP address of the second DNS server ($DNS2)"
|
|
|
230 |
exit 0
|
|
|
231 |
fi
|
631 |
richard |
232 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
|
|
|
233 |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2` # @ masque du réseau de consult (255.255.255.0)
|
628 |
richard |
234 |
private_network_calc
|
|
|
235 |
|
|
|
236 |
# /etc/hosts
|
|
|
237 |
cat <<EOF > /etc/hosts
|
|
|
238 |
127.0.0.1 localhost
|
|
|
239 |
$PRIVATE_IP $HOSTNAME
|
|
|
240 |
EOF
|
|
|
241 |
|
|
|
242 |
# Networt Cards config
|
|
|
243 |
$SED "s?^IPADDR=.*?IPADDR=$PUBLIC_IP?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
|
|
244 |
$SED "s?^NETMASK=.*?NETMASK=$PUBLIC_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
|
|
245 |
$SED "s?^GATEWAY=.*?GATEWAY=$PUBLIC_GATEWAY?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
|
|
246 |
$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
|
|
247 |
$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
|
|
248 |
|
631 |
richard |
249 |
echo "NIC ok"
|
628 |
richard |
250 |
# NTP server
|
|
|
251 |
$SED "s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap\nrestrict 127.0.0.1?" /etc/ntp.conf
|
|
|
252 |
|
|
|
253 |
# host.allow
|
|
|
254 |
cat <<EOF > /etc/hosts.allow
|
|
|
255 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
|
|
256 |
sshd: ALL
|
|
|
257 |
ntpd: $PRIVATE_NETWORK_SHORT
|
|
|
258 |
EOF
|
|
|
259 |
|
|
|
260 |
# Alcasar control center
|
|
|
261 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
|
|
|
262 |
FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
|
|
|
263 |
$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" $FIC_MOD_SSL
|
629 |
richard |
264 |
$SED '/127.0.0.1/!s?Allow from .*?Allow from $PRIVATE_NETWORK_MASK?g'
|
628 |
richard |
265 |
|
|
|
266 |
|
629 |
richard |
267 |
|
628 |
richard |
268 |
# Start / Stop SSH Daemon
|
|
|
269 |
ssh_active=`grep SSH $CONF_FILE|cut -d"=" -f2`
|
|
|
270 |
if [ $ssh_active = "on" ]
|
|
|
271 |
then
|
|
|
272 |
/sbin/chkconfig --add sshd
|
|
|
273 |
else
|
|
|
274 |
/sbin/chkconfig --del sshd
|
|
|
275 |
fi
|
|
|
276 |
|
|
|
277 |
|
|
|
278 |
$DIR_DEST_BIN/alcasar-iptables.sh
|
|
|
279 |
;;
|
8 |
franck |
280 |
*)
|
|
|
281 |
echo "Argument inconnu :$1";
|
|
|
282 |
echo "$usage"
|
|
|
283 |
exit 1
|
|
|
284 |
;;
|
|
|
285 |
esac
|
|
|
286 |
|