2223 |
tom.houday |
1 |
#!/bin/bash
|
64 |
franck |
2 |
# $Id: alcasar-conf.sh 3190 2024-04-07 22:35:03Z rexy $
|
672 |
richard |
3 |
|
|
|
4 |
# alcasar-conf.sh
|
865 |
richard |
5 |
# by REXY
|
672 |
richard |
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
|
|
7 |
|
2744 |
rexy |
8 |
# Ce script permet la mise à jour d'un ALCASAR
|
|
|
9 |
# - (alcasar-conf.sh -create) : création de l'archive des fichiers de configuration (/var/tmp/alcasar-conf.tar.gz)
|
|
|
10 |
# - (alcasar-conf.sh -load) : chargement de l'archive des fichiers de configuration. Le cas échéant, c'est ici qu'on met à jour les fichiers entre versions
|
|
|
11 |
# - (alcasar-conf.sh -apply) : application des directives du fichier de conf central "/usr/local/etc/alcasar.conf". Peut aussi être exploité à chaud après avoir changé des valeurs du fichier de conf.
|
2570 |
rexy |
12 |
# This script allows ALCASAR update
|
2744 |
rexy |
13 |
# - (alcasar-conf.sh -create) : create the configuration files backup (/var/tmp/alcasar-conf.tar.gz)
|
|
|
14 |
# - (alcasar-conf.sh -load) : load the backup of configuration files. If needed, it's here we update files between versions
|
|
|
15 |
# - (alcasar-conf.sh -load) : apply ALCASAR central configuration file "/usr/local/etc/alcasar.conf". Can be use after changes of conf file values.
|
672 |
richard |
16 |
|
2585 |
tom.houday |
17 |
DIR_UPDATE="/var/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
2247 |
tom.houday |
18 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
|
|
19 |
DIR_BIN="/usr/local/bin" # scripts directory
|
|
|
20 |
DIR_ETC="/usr/local/etc" # conf directory
|
2688 |
lucas.echa |
21 |
DIR_E2G="/etc/e2guardian/lists" # Toulouse BL directory
|
|
|
22 |
DIR_BLACKLIST="$DIR_E2G/blacklists" # Toulouse BL directory
|
2878 |
rexy |
23 |
CONF_FILE="$DIR_ETC/alcasar.conf" # main alcasar conf file
|
|
|
24 |
PASSWD_FILE="/root/ALCASAR-passwords.txt"
|
|
|
25 |
DB_USER=$(grep '^db_user=' $PASSWD_FILE | cut -d'=' -f 2-)
|
|
|
26 |
DB_PASS=$(grep '^db_password=' $PASSWD_FILE | cut -d'=' -f 2-)
|
2247 |
tom.houday |
27 |
EXTIF=`grep ^EXTIF= $CONF_FILE|cut -d"=" -f2` # EXTernal InterFace
|
|
|
28 |
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2` # INTernal InterFace
|
|
|
29 |
MTU=`grep ^PUBLIC_MTU= $CONF_FILE|cut -d"=" -f2`
|
1890 |
franck |
30 |
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
|
|
|
31 |
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
|
2247 |
tom.houday |
32 |
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
|
|
|
33 |
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
|
2899 |
rexy |
34 |
DOMAIN=${DOMAIN:=localdomain}
|
|
|
35 |
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2` # To configure WL domain names
|
|
|
36 |
HTTPS_LOGIN=`grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2`
|
384 |
richard |
37 |
SED="/bin/sed -i"
|
2247 |
tom.houday |
38 |
|
628 |
richard |
39 |
private_network_calc ()
|
|
|
40 |
{
|
1060 |
richard |
41 |
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
2561 |
rexy |
42 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
|
|
43 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX # @ + masque du réseau de consult (192.168.182.0/24)
|
2688 |
lucas.echa |
44 |
classe=$((PRIVATE_PREFIX/8)); classe_sup=`expr $classe + 1`; # classes de réseau (ex.: 2=classe B, 3=classe C)
|
1060 |
richard |
45 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
|
|
46 |
PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2` # private network broadcast (ie.: 192.168.182.255)
|
2561 |
rexy |
47 |
private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup` # last octet of LAN broadcast
|
|
|
48 |
private_ip_ending=`echo $PRIVATE_IP | cut -d"." -f4` # last octet of LAN address
|
|
|
49 |
PRIVATE_SECOND_IP=`echo $PRIVATE_IP | cut -d"." -f1-3`"."`expr $private_ip_ending + 1` # second network address (ex.: 192.168.182.2)
|
1060 |
richard |
50 |
PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1` # last network address (ex.: 192.168.182.254)
|
1581 |
richard |
51 |
PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'` # MAC address of INTIF
|
628 |
richard |
52 |
}
|
8 |
franck |
53 |
|
933 |
franck |
54 |
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
|
8 |
franck |
55 |
nb_args=$#
|
|
|
56 |
args=$1
|
|
|
57 |
if [ $nb_args -eq 0 ]
|
|
|
58 |
then
|
2430 |
tom.houday |
59 |
nb_args=1
|
8 |
franck |
60 |
args="-h"
|
|
|
61 |
fi
|
|
|
62 |
case $args in
|
|
|
63 |
-\? | -h* | --h*)
|
|
|
64 |
echo "$usage"
|
|
|
65 |
exit 0
|
|
|
66 |
;;
|
2874 |
rexy |
67 |
###################################################
|
|
|
68 |
## Create an archive conf file ##
|
|
|
69 |
###################################################
|
|
|
70 |
--create|-create)
|
8 |
franck |
71 |
[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
|
|
|
72 |
mkdir $DIR_UPDATE
|
1916 |
franck |
73 |
# backup the users database (test to delete in future version)
|
2664 |
tom.houday |
74 |
$DIR_BIN/alcasar-mysql.sh --dump
|
2688 |
lucas.echa |
75 |
cp /var/Save/base/"$(ls -1t /var/Save/base|head -1)" $DIR_UPDATE
|
2824 |
rexy |
76 |
# backup organism logo
|
8 |
franck |
77 |
cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
|
1912 |
richard |
78 |
# backup BL/WL custom files
|
1914 |
richard |
79 |
mkdir $DIR_UPDATE/custom_bl
|
2541 |
rexy |
80 |
for i in exceptioniplist urlregexplist exceptionsitelist bannedsitelist exceptionurllist bannedurllist
|
|
|
81 |
do
|
2570 |
rexy |
82 |
if [ -d /etc/dansguardian ]; then
|
|
|
83 |
cp /etc/dansguardian/lists/$i $DIR_UPDATE/custom_bl/ # before V3.3
|
2661 |
lucas.echa |
84 |
cp -rf /etc/dansguardian/lists/blacklists/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
|
2541 |
rexy |
85 |
else
|
2688 |
lucas.echa |
86 |
cp $DIR_E2G/$i $DIR_UPDATE/custom_bl/ # since V3.3
|
2661 |
lucas.echa |
87 |
cp -rf $DIR_BLACKLIST/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
|
2541 |
rexy |
88 |
fi
|
|
|
89 |
done
|
2824 |
rexy |
90 |
# backup conf files (main conf file, filtering, digest, etc.)
|
8 |
franck |
91 |
mkdir $DIR_UPDATE/etc/
|
346 |
richard |
92 |
cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
|
2825 |
rexy |
93 |
cp -f /etc/hosts $DIR_UPDATE/etc/
|
1758 |
richard |
94 |
# backup of the security certificates (server & CA)
|
2561 |
rexy |
95 |
cp -f /etc/pki/tls/certs/alcasar.crt* $DIR_UPDATE
|
|
|
96 |
cp -f /etc/pki/tls/private/alcasar.key* $DIR_UPDATE
|
2570 |
rexy |
97 |
[ -e /etc/pki/tls/private/alcasar.pem ] && cp -f /etc/pki/tls/private/alcasar.pem $DIR_UPDATE # since V3.3
|
1564 |
richard |
98 |
cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
|
|
|
99 |
cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
|
2813 |
rexy |
100 |
if [ -e /etc/pki/tls/certs/server-chain.pem ]; then
|
|
|
101 |
cp -f /etc/pki/tls/certs/server-chain.pem $DIR_UPDATE # autosigned and official if exist
|
510 |
richard |
102 |
else
|
2813 |
rexy |
103 |
cp -f /etc/pki/tls/certs/alcasar.crt $DIR_UPDATE/server-chain.pem
|
510 |
richard |
104 |
fi
|
2875 |
rexy |
105 |
# backup gammu conf file (if necessary)
|
|
|
106 |
SMS=`grep ^SMS= $CONF_FILE|cut -d"=" -f2`
|
|
|
107 |
if [ "$SMS" == "on" ]
|
|
|
108 |
then
|
|
|
109 |
cp -f /etc/gammurc $DIR_UPDATE
|
|
|
110 |
cp -f /etc/gammu_smsd_conf $DIR_UPDATE
|
|
|
111 |
fi
|
1758 |
richard |
112 |
# archive file creation
|
2688 |
lucas.echa |
113 |
cd /var/tmp || { echo "Unable to find /var/tmp directory"; }
|
8 |
franck |
114 |
tar -cf alcasar-conf.tar conf/
|
|
|
115 |
gzip -f alcasar-conf.tar
|
2835 |
rexy |
116 |
cp alcasar-conf.tar.gz /var/www/html/acc/backup/alcasar-conf.tar.gz
|
|
|
117 |
chown apache:apache /var/www/html/acc/backup/alcasar-conf.tar.gz
|
8 |
franck |
118 |
rm -rf $DIR_UPDATE
|
|
|
119 |
;;
|
2560 |
rexy |
120 |
|
2874 |
rexy |
121 |
###################################################
|
|
|
122 |
## Load an archive conf file ##
|
|
|
123 |
###################################################
|
389 |
franck |
124 |
--load|-load)
|
3163 |
rexy |
125 |
if [ ! -f /var/tmp/alcasar-conf.tar.gz ]; then
|
|
|
126 |
echo "Conf file not found (/var/tmp/alcasar-conf.tar.gz) !"
|
|
|
127 |
return 1
|
|
|
128 |
fi
|
3018 |
rexy |
129 |
CURRENT_DIR=`pwd` # install folder
|
3163 |
rexy |
130 |
cd /var/tmp
|
2834 |
rexy |
131 |
tar -xf alcasar-conf.tar.gz
|
2956 |
rexy |
132 |
# update alcasar.conf parameters
|
2561 |
rexy |
133 |
PREVIOUS_VERSION=`grep ^VERSION= $DIR_UPDATE/etc/alcasar.conf|cut -d"=" -f2`
|
|
|
134 |
MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
|
|
|
135 |
MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
|
|
|
136 |
UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
|
2875 |
rexy |
137 |
for line in `cat $DIR_UPDATE/etc/alcasar.conf | grep "=" | grep -Ev "^#| |VERSION|INSTALL_DATE|PUBLIC|GW|EXTIF|INTIF"`
|
2824 |
rexy |
138 |
do
|
|
|
139 |
key=`echo $line | cut -d"=" -f1`
|
|
|
140 |
key=$key=
|
|
|
141 |
value=`echo $line|cut -d"=" -f2-`
|
|
|
142 |
if [ "$value" != "" ]
|
|
|
143 |
then
|
|
|
144 |
sed -i "s?^$key.*?$key$value?g" /usr/local/etc/alcasar.conf
|
|
|
145 |
fi
|
|
|
146 |
done
|
2874 |
rexy |
147 |
# lighttpd need a .pem certificate (aggregation with private key & server crt)
|
2665 |
tom.houday |
148 |
[ ! -f $DIR_UPDATE/alcasar.pem ] && (cat $DIR_UPDATE/alcasar.key; echo; cat $DIR_UPDATE/alcasar.crt) > $DIR_UPDATE/alcasar.pem
|
2824 |
rexy |
149 |
# Retrieve organism logo
|
510 |
richard |
150 |
[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
|
8 |
franck |
151 |
chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
|
1060 |
richard |
152 |
# Retrieve the security certificates (CA and server)
|
2571 |
rexy |
153 |
cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
|
|
|
154 |
cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
|
1758 |
richard |
155 |
cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
|
|
|
156 |
cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
|
2688 |
lucas.echa |
157 |
cp -f $DIR_UPDATE/alcasar.pem /etc/pki/tls/private/
|
2813 |
rexy |
158 |
[ -e $DIR_UPDATE/server-chain.pem ] && cp -f $DIR_UPDATE/server-chain.pem /etc/pki/tls/certs/ # autosigned and official if exist
|
2825 |
rexy |
159 |
chmod 755 /etc/pki/
|
2811 |
rexy |
160 |
chown root:apache /etc/pki/CA; chmod 750 /etc/pki/CA
|
2825 |
rexy |
161 |
chown root:apache /etc/pki/CA/alcasar-ca.crt; chmod 640 /etc/pki/CA/alcasar-ca.crt
|
2811 |
rexy |
162 |
chown root:root /etc/pki/CA/private; chmod 700 /etc/pki/CA/private
|
|
|
163 |
chmod 600 /etc/pki/CA/private/*
|
|
|
164 |
chown -R root:apache /etc/pki/tls/private; chmod 750 /etc/pki/tls/private
|
|
|
165 |
chmod 640 /etc/pki/tls/private/*
|
3170 |
rexy |
166 |
chmod 644 /etc/pki/tls/certs/*
|
1060 |
richard |
167 |
# Import of the users database
|
2688 |
lucas.echa |
168 |
$DIR_BIN/alcasar-mysql.sh --import "$(ls $DIR_UPDATE/alcasar-users-database*)"
|
1914 |
richard |
169 |
# Retrieve local parameters
|
2825 |
rexy |
170 |
[ -d $DIR_UPDATE/etc/digest ] && cp -rf $DIR_UPDATE/etc/digest $DIR_ETC/ # ACC accounts
|
|
|
171 |
[ -e $DIR_UPDATE/etc/alcasar-iptables-local.sh ] && cp -f $DIR_UPDATE/etc/alcasar-iptables-local.sh $DIR_ETC/ # local FW rules
|
|
|
172 |
[ -e $DIR_UPDATE/etc/alcasar-iptables-local-mac-filtered ] && cp -f $DIR_UPDATE/etc/alcasar-iptables-local-mac-filtered $DIR_ETC/ # blocked MAC addresses
|
3152 |
rexy |
173 |
[ -e $DIR_UPDATE/etc/alcasar-services ] && cp -f $DIR_UPDATE/etc/alcasar-services $DIR_ETC/ # protocols filtering for users (profil 3 : customized with ACC)
|
2825 |
rexy |
174 |
[ -e $DIR_UPDATE/etc/alcasar-uamdomain ] && cp -f $DIR_UPDATE/etc/alcasar-uamdomain $DIR_ETC/ # exception domain names
|
|
|
175 |
[ -e $DIR_UPDATE/etc/alcasar-uamallowed ] && cp -f $DIR_UPDATE/etc/alcasar-uamallowed $DIR_ETC/ # exception IP_addresses or network_IP_addresses
|
|
|
176 |
[ -e $DIR_UPDATE/etc/alcasar-ethers ] && cp -f $DIR_UPDATE/etc/alcasar-ethers $DIR_ETC/ # DHCP static hosts
|
|
|
177 |
[ -e $DIR_UPDATE/etc/alcasar-ethers-info ] && cp -f $DIR_UPDATE/etc/alcasar-ethers-info $DIR_ETC/ # DHCP static hosts information
|
2833 |
rexy |
178 |
[ -e $DIR_UPDATE/etc/hosts ] && cp -f $DIR_UPDATE/etc/hosts /etc/ # local host name resolution
|
2874 |
rexy |
179 |
[ -e $DIR_UPDATE/etc/alcasar-letsencrypt ] && cp -f $DIR_UPDATE/etc/alcasar-letsencrypt $DIR_ETC/ # Letsencrypt local conf
|
|
|
180 |
[ -d $DIR_UPDATE/etc/letsencrypt ] && cp -rf $DIR_UPDATE/etc/letsencrypt $DIR_ETC/ # Letsencrypt local conf files
|
2875 |
rexy |
181 |
[ -e $DIR_UPDATE/gammurc ] && cp -f $DIR_UPDATE/gammurc /etc/ # Gammu conf file
|
|
|
182 |
[ -e $DIR_UPDATE/gammu_smsd_conf ] && cp -f $DIR_UPDATE/gammu_smsd_conf /etc/ # Gammu_smsd conf file
|
1914 |
richard |
183 |
# Retrieve BL/WL custom files
|
2688 |
lucas.echa |
184 |
cp -f $DIR_UPDATE/custom_bl/exceptioniplist $DIR_E2G/
|
|
|
185 |
cp -f $DIR_UPDATE/custom_bl/exceptionsitelist $DIR_E2G/
|
|
|
186 |
cp -f $DIR_UPDATE/custom_bl/urlregexplist $DIR_E2G/
|
|
|
187 |
cp -f $DIR_UPDATE/custom_bl/bannedsitelist $DIR_E2G/
|
|
|
188 |
cp -f $DIR_UPDATE/custom_bl/exceptionurllist $DIR_E2G/
|
|
|
189 |
cp -f $DIR_UPDATE/custom_bl/bannedurllist $DIR_E2G/
|
1961 |
richard |
190 |
cp -rf $DIR_UPDATE/custom_bl/ossi-* $DIR_BLACKLIST/ 2>/dev/null
|
2688 |
lucas.echa |
191 |
chown -R e2guardian:apache $DIR_E2G
|
|
|
192 |
chmod -R g+rw $DIR_E2G
|
1060 |
richard |
193 |
# Adapt DNS/URL filtering
|
|
|
194 |
PARENT_SCRIPT=`basename $0`
|
637 |
richard |
195 |
export PARENT_SCRIPT
|
1946 |
richard |
196 |
$DIR_BIN/alcasar-bl.sh -cat_choice
|
1827 |
raphael.pi |
197 |
$DIR_BIN/alcasar-bl.sh -reload
|
1060 |
richard |
198 |
# admin profile update (admin + manager + backup)
|
1827 |
raphael.pi |
199 |
$DIR_BIN/alcasar-profil.sh --list
|
3018 |
rexy |
200 |
# Apply changes between versions
|
3103 |
rexy |
201 |
## V5.5 --> V6.0
|
|
|
202 |
## remove dnsmasq service
|
3099 |
rexy |
203 |
[ -e /etc/dnsmasq-whitelist.conf ] && rm -f /etc/dnsmasq*
|
|
|
204 |
[ -e /etc/systemd/system/dnsmasq-whitelist.service ] && rm -f /etc/systemd/system/dnsmasq* && urpme dnsmasq
|
1060 |
richard |
205 |
# Remove the update folder
|
8 |
franck |
206 |
rm -rf $DIR_UPDATE
|
|
|
207 |
;;
|
2560 |
rexy |
208 |
|
2874 |
rexy |
209 |
####################################################
|
|
|
210 |
## Configure ALCASAR according to alcasar.conf ##
|
|
|
211 |
####################################################
|
628 |
richard |
212 |
--apply|-apply)
|
994 |
franck |
213 |
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"
|
2474 |
tom.houday |
214 |
PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2`
|
3190 |
rexy |
215 |
if ! echo $PRIVATE_IP_MASK | grep -q -E $PTN
|
2688 |
lucas.echa |
216 |
then
|
628 |
richard |
217 |
echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
|
|
|
218 |
exit 0
|
|
|
219 |
fi
|
2474 |
tom.houday |
220 |
PUBLIC_IP_MASK=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2`
|
1590 |
richard |
221 |
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"
|
1585 |
richard |
222 |
if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
|
|
|
223 |
then
|
|
|
224 |
PUBLIC_GATEWAY="dhcp"
|
2947 |
rexy |
225 |
DHCP_DNS_servers=`cat /var/lib/dhclient/dhclient--$EXTIF.lease |grep domain-name-servers|sed -n "1 p"| rev|cut -d" " -f1|rev|tr -d ';'`
|
|
|
226 |
DNS1=`echo $DHCP_DNS_servers | cut -d"," -f1`
|
|
|
227 |
DNS2=`echo $DHCP_DNS_servers | cut -d"," -f2`
|
1585 |
richard |
228 |
else
|
3190 |
rexy |
229 |
if ! echo $PUBLIC_IP_MASK | grep -q -E $PTN
|
2688 |
lucas.echa |
230 |
then
|
1585 |
richard |
231 |
echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
|
|
|
232 |
exit 0
|
|
|
233 |
fi
|
1590 |
richard |
234 |
PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
|
|
|
235 |
PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
|
2474 |
tom.houday |
236 |
PUBLIC_GATEWAY=`grep ^GW= $CONF_FILE|cut -d"=" -f2`
|
3190 |
rexy |
237 |
if ! echo $PUBLIC_GATEWAY | grep -q -E $PTN
|
2688 |
lucas.echa |
238 |
then
|
1585 |
richard |
239 |
echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
|
|
|
240 |
exit 0
|
|
|
241 |
fi
|
2947 |
rexy |
242 |
DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2`
|
3190 |
rexy |
243 |
if ! echo $DNS1 | grep -q -E $PTN
|
2947 |
rexy |
244 |
then
|
|
|
245 |
echo "Syntax error for the IP address of the first DNS server ($DNS1)"
|
|
|
246 |
exit 0
|
|
|
247 |
fi
|
|
|
248 |
DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2`
|
3190 |
rexy |
249 |
if ! echo $DNS2 | grep -q -E $PTN
|
2947 |
rexy |
250 |
then
|
|
|
251 |
echo "Syntax error for the IP address of the second DNS server ($DNS2)"
|
|
|
252 |
exit 0
|
|
|
253 |
fi
|
628 |
richard |
254 |
fi
|
631 |
richard |
255 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
|
632 |
richard |
256 |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
|
628 |
richard |
257 |
private_network_calc
|
2474 |
tom.houday |
258 |
INSTALL_DATE=`grep ^INSTALL_DATE= $CONF_FILE|cut -d"=" -f2`
|
|
|
259 |
ORGANISME=`grep ^ORGANISM= $CONF_FILE|cut -d"=" -f2-`
|
2688 |
lucas.echa |
260 |
BL_SAFESEARCH=`grep ^BL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
|
|
|
261 |
WL_SAFESEARCH=`grep ^WL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
|
|
|
262 |
BL_PUREIP=`grep ^BL_PUREIP= $CONF_FILE|cut -d"=" -f2`
|
2474 |
tom.houday |
263 |
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
|
1060 |
richard |
264 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
933 |
franck |
265 |
then
|
2688 |
lucas.echa |
266 |
if [ "$DHCP_mode" = "off" ] || [ "$DHCP_mode" = "Off" ] || [ "$DHCP_mode" = "OFF" ]
|
1060 |
richard |
267 |
then
|
1827 |
raphael.pi |
268 |
$DIR_BIN/alcasar-dhcp.sh --off
|
1890 |
franck |
269 |
else
|
2569 |
lucas.echa |
270 |
$DIR_BIN/alcasar-dhcp.sh --on
|
1060 |
richard |
271 |
fi
|
2568 |
rexy |
272 |
# Set the local DNS (or not)
|
2688 |
lucas.echa |
273 |
if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ]
|
1890 |
franck |
274 |
then
|
2947 |
rexy |
275 |
$DIR_BIN/alcasar-dns-local.sh --on-without-restart
|
1890 |
franck |
276 |
else
|
2947 |
rexy |
277 |
$DIR_BIN/alcasar-dns-local.sh --off-without-restart
|
1890 |
franck |
278 |
fi
|
2688 |
lucas.echa |
279 |
# Set the pure ip option (or not)
|
|
|
280 |
if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ]
|
|
|
281 |
then
|
|
|
282 |
bl_filter_param+="--pureip_off"
|
|
|
283 |
else
|
|
|
284 |
bl_filter_param+="--pureip_on"
|
|
|
285 |
fi
|
|
|
286 |
# Set the safesearch options (or not)
|
|
|
287 |
bl_filter_param=""
|
|
|
288 |
if [ "$BL_SAFESEARCH" = "on" ] || [ "$BL_SAFESEARCH" = "On" ] || [ "$BL_SAFESEARCH" = "ON" ]
|
|
|
289 |
then
|
|
|
290 |
bl_filter_param+="--safesearch_on "
|
|
|
291 |
else
|
|
|
292 |
bl_filter_param+="--safesearch_off "
|
|
|
293 |
fi
|
|
|
294 |
$DIR_BIN/alcasar-url_filter_bl.sh $bl_filter_param
|
|
|
295 |
if [ "$WL_SAFESEARCH" = "on" ] || [ "$WL_SAFESEARCH" = "On" ] || [ "$WL_SAFESEARCH" = "ON" ]
|
|
|
296 |
then
|
|
|
297 |
$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_on
|
|
|
298 |
else
|
|
|
299 |
$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_off
|
|
|
300 |
fi
|
|
|
301 |
# Reload the local dns configuration
|
|
|
302 |
$DIR_BIN/alcasar-dns-local.sh --reload
|
1585 |
richard |
303 |
# Logout everybody
|
2688 |
lucas.echa |
304 |
$DIR_BIN/alcasar-logout.sh all
|
1585 |
richard |
305 |
# Services stop
|
1521 |
richard |
306 |
echo -n "Stop services : "
|
3099 |
rexy |
307 |
for i in ntpd e2guardian unbound unbound-whitelist unbound-blacklist unbound-blackhole chilli network lighttpd
|
1060 |
richard |
308 |
do
|
1574 |
richard |
309 |
/usr/bin/systemctl stop $i && echo -n "$i, "
|
1060 |
richard |
310 |
done
|
1521 |
richard |
311 |
echo
|
1060 |
richard |
312 |
fi
|
1518 |
richard |
313 |
# EXTIF config
|
1585 |
richard |
314 |
if [ $PUBLIC_IP_MASK == "dhcp" ]
|
|
|
315 |
then
|
|
|
316 |
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
|
|
317 |
DEVICE=$EXTIF
|
|
|
318 |
BOOTPROTO=dhcp
|
2870 |
rexy |
319 |
DNS1=127.0.0.1
|
1585 |
richard |
320 |
PEERDNS=no
|
|
|
321 |
RESOLV_MODS=yes
|
|
|
322 |
ONBOOT=yes
|
|
|
323 |
METRIC=10
|
|
|
324 |
MII_NOT_SUPPORTED=yes
|
|
|
325 |
IPV6INIT=no
|
|
|
326 |
IPV6TO4INIT=no
|
|
|
327 |
ACCOUNTING=no
|
|
|
328 |
USERCTL=no
|
|
|
329 |
MTU=$MTU
|
1850 |
franck |
330 |
NOZEROCONF=yes
|
1585 |
richard |
331 |
EOF
|
2974 |
rexy |
332 |
else # set the static configuration for EXTIF in multi-gw mode
|
|
|
333 |
$DIR_BIN/alcasar-network.sh --apply
|
1585 |
richard |
334 |
fi
|
1518 |
richard |
335 |
# INTIF config (for bypass mode only)
|
1554 |
richard |
336 |
$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
|
|
|
337 |
$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
|
628 |
richard |
338 |
# NTP server
|
632 |
richard |
339 |
$SED "/127.0.0.1/!s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap?g" /etc/ntp.conf
|
2688 |
lucas.echa |
340 |
# host.allow
|
628 |
richard |
341 |
cat <<EOF > /etc/hosts.allow
|
|
|
342 |
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
|
|
|
343 |
sshd: ALL
|
|
|
344 |
ntpd: $PRIVATE_NETWORK_SHORT
|
|
|
345 |
EOF
|
2309 |
tom.houday |
346 |
# Set hostname
|
|
|
347 |
hostnamectl set-hostname $HOSTNAME.$DOMAIN
|
2838 |
rexy |
348 |
# /etc/hosts (retriving local hostnames)
|
|
|
349 |
cp /etc/hosts /tmp/hosts
|
|
|
350 |
echo "127.0.0.1 localhost" > /etc/hosts
|
|
|
351 |
echo "$PRIVATE_IP $HOSTNAME $HOSTNAME.$DOMAIN" >> /etc/hosts
|
|
|
352 |
while read -r line
|
|
|
353 |
do
|
|
|
354 |
if ! echo $line | grep -E -q "^([0-9\.\t ]+alcasar( |$)|127\.0\.0)"
|
|
|
355 |
then
|
|
|
356 |
echo $line >> /etc/hosts
|
|
|
357 |
fi
|
|
|
358 |
done < /tmp/hosts
|
2861 |
rexy |
359 |
rm -f /tmp/hosts
|
2603 |
tom.houday |
360 |
# MOTD
|
|
|
361 |
$SED "s@'https://\(.\+\)/acc'@'https://$HOSTNAME.$DOMAIN/acc'@" /etc/mageia-release
|
2568 |
rexy |
362 |
# Lighttpd
|
2688 |
lucas.echa |
363 |
$SED "s?^server\.bind.*?server\.bind = \"$PRIVATE_IP\"?g" /etc/lighttpd/lighttpd.conf
|
2964 |
rexy |
364 |
$SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$PRIVATE_IP"':443" {/g' /etc/lighttpd/vhosts.d/alcasar-with-ssl.conf /etc/lighttpd/vhosts.d/alcasar-without-ssl.conf
|
|
|
365 |
$SED "s/^\([\t ]*\)var.server_name.*/\1var.server_name = \"$PRIVATE_IP\"/g" /etc/lighttpd/vhosts.d/alcasar-with-ssl.conf /etc/lighttpd/vhosts.d/alcasar-without-ssl.conf
|
2744 |
rexy |
366 |
# FreeRADIUS
|
634 |
richard |
367 |
$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
|
|
|
368 |
$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
|
2707 |
tom.houday |
369 |
# CoovaChilli
|
2568 |
rexy |
370 |
$SED "s/^uamallowed.*/uamallowed\t$HOSTNAME,$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
|
|
|
371 |
$SED "s/^locationname.*/locationname\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
|
2707 |
tom.houday |
372 |
$SED "s/^domain.*/domain\t\t$DOMAIN/g" /etc/chilli.conf
|
2688 |
lucas.echa |
373 |
[ "`grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2`" == "on" ] && chilli_login_protocol="https" || chilli_login_protocol="http"
|
2568 |
rexy |
374 |
$SED "s/^uamserver.*/uamserver\t$chilli_login_protocol:\/\/$HOSTNAME.$DOMAIN\/intercept.php/" /etc/chilli.conf
|
|
|
375 |
$SED "s/^radiusnasid.*/radiusnasid\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
|
634 |
richard |
376 |
$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
|
|
|
377 |
$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
|
|
|
378 |
$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
|
|
|
379 |
$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
|
3124 |
rexy |
380 |
PRIVATE_IP_HEXA=$(printf "%02x\n" "$(echo $PRIVATE_IP | cut -d'.' -f1)")$(printf "%02x\n" "$(echo $PRIVATE_IP | cut -d'.' -f2)")$(printf "%02x\n" "$(echo $PRIVATE_IP | cut -d'.' -f3)")$(printf "%02x\n" "$(echo $PRIVATE_IP | cut -d'.' -f4)")
|
|
|
381 |
$SED "s?^dhcpopt.*?dhcpopt\t\t2a04$PRIVATE_IP_HEXA?g" /etc/chilli.conf
|
1581 |
richard |
382 |
# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
|
2274 |
richard |
383 |
$SED "s?^$PRIVATE_MAC.*?$PRIVATE_MAC $PRIVATE_SECOND_IP?" $DIR_ETC/alcasar-ethers $DIR_ETC/alcasar-ethers-info
|
2688 |
lucas.echa |
384 |
# unbound
|
|
|
385 |
# removing unbound configuration files
|
|
|
386 |
rm -f /etc/unbound/conf.d/{forward,blacklist,whitelist,blackhole}/iface.*
|
|
|
387 |
rm -f /etc/unbound/conf.d/common/forward-zone.conf
|
|
|
388 |
# Configuration file for the dns servers forward-zone
|
|
|
389 |
cat << EOF > /etc/unbound/conf.d/common/forward-zone.conf
|
|
|
390 |
forward-zone:
|
|
|
391 |
name: "."
|
|
|
392 |
forward-addr: $DNS1
|
|
|
393 |
forward-addr: $DNS2
|
|
|
394 |
EOF
|
2813 |
rexy |
395 |
# Configuration file for lo of forward
|
2688 |
lucas.echa |
396 |
cat << EOF > /etc/unbound/conf.d/forward/iface.lo.conf
|
|
|
397 |
server:
|
|
|
398 |
interface: 127.0.0.1@53
|
|
|
399 |
access-control-view: 127.0.0.1/8 lo
|
|
|
400 |
view:
|
|
|
401 |
name: "lo"
|
2864 |
rexy |
402 |
local-data: "$HOSTNAME A 127.0.0.1"
|
2831 |
rexy |
403 |
local-data: "$HOSTNAME.$DOMAIN A 127.0.0.1"
|
2864 |
rexy |
404 |
local-data-ptr: "127.0.0.1 $HOSTNAME.$DOMAIN"
|
2688 |
lucas.echa |
405 |
view-first: yes
|
|
|
406 |
EOF
|
2813 |
rexy |
407 |
# Configuration file for $INTIF of forward
|
2688 |
lucas.echa |
408 |
cat << EOF > /etc/unbound/conf.d/forward/iface.${INTIF}.conf
|
|
|
409 |
server:
|
|
|
410 |
interface: ${PRIVATE_IP}@53
|
|
|
411 |
access-control-view: $PRIVATE_NETWORK_MASK $INTIF
|
|
|
412 |
view:
|
|
|
413 |
name: "$INTIF"
|
|
|
414 |
view-first: yes
|
|
|
415 |
EOF
|
2813 |
rexy |
416 |
# Configuration file for $INTIF of blacklist
|
2688 |
lucas.echa |
417 |
cat << EOF > /etc/unbound/conf.d/blacklist/iface.${INTIF}.conf
|
|
|
418 |
server:
|
|
|
419 |
interface: ${PRIVATE_IP}@54
|
|
|
420 |
access-control: $PRIVATE_IP_MASK allow
|
|
|
421 |
access-control-tag: $PRIVATE_IP_MASK "blacklist"
|
|
|
422 |
access-control-tag-action: $PRIVATE_IP_MASK "blacklist" redirect
|
|
|
423 |
access-control-tag-data: $PRIVATE_IP_MASK "blacklist" "A $PRIVATE_IP"
|
|
|
424 |
EOF
|
2813 |
rexy |
425 |
# Configuration file for $INTIF of whitelist
|
2688 |
lucas.echa |
426 |
cat << EOF > /etc/unbound/conf.d/whitelist/iface.${INTIF}.conf
|
|
|
427 |
server:
|
|
|
428 |
interface: ${PRIVATE_IP}@55
|
|
|
429 |
access-control: $PRIVATE_IP_MASK allow
|
|
|
430 |
access-control-tag: $PRIVATE_IP_MASK "whitelist"
|
|
|
431 |
access-control-tag-action: $PRIVATE_IP_MASK "whitelist" redirect
|
|
|
432 |
access-control-tag-data: $PRIVATE_IP_MASK "whitelist" "A $PRIVATE_IP"
|
|
|
433 |
EOF
|
2871 |
rexy |
434 |
# Configuration file for $INTIF of blackhole unbound
|
|
|
435 |
cat << EOF > /etc/unbound/conf.d/blackhole/iface.${INTIF}.conf
|
|
|
436 |
server:
|
|
|
437 |
interface: ${PRIVATE_IP}@56
|
|
|
438 |
access-control-view: $PRIVATE_NETWORK_MASK $INTIF
|
|
|
439 |
view:
|
|
|
440 |
name: "$INTIF"
|
|
|
441 |
local-zone: "." redirect
|
|
|
442 |
local-data: ". A $PRIVATE_IP"
|
|
|
443 |
EOF
|
|
|
444 |
|
2688 |
lucas.echa |
445 |
# dhcpd
|
|
|
446 |
cat <<EOF > /etc/dhcpd.conf
|
|
|
447 |
ddns-update-style none;
|
|
|
448 |
subnet $PRIVATE_NETWORK netmask $PRIVATE_NETMASK {
|
|
|
449 |
option routers $PRIVATE_IP;
|
|
|
450 |
option subnet-mask $PRIVATE_NETMASK;
|
|
|
451 |
option domain-name-servers $PRIVATE_IP;
|
|
|
452 |
range dynamic-bootp $PRIVATE_SECOND_IP $PRIVATE_LAST_IP;
|
|
|
453 |
default-lease-time 21600;
|
|
|
454 |
max-lease-time 43200;
|
|
|
455 |
}
|
|
|
456 |
EOF
|
2838 |
rexy |
457 |
$DIR_BIN/alcasar-dns-local.sh -hosts_to_unbound # add local name resolution to unbound (forward & blackhole)
|
2867 |
rexy |
458 |
# E2guardian
|
2521 |
armand.ito |
459 |
$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
|
2867 |
rexy |
460 |
$SED "s?\/\/[a-z.]*\/?\/\/$HOSTNAME.$DOMAIN\/?g" /usr/share/e2guardian/languages/french/alcasar-e2g.html
|
|
|
461 |
$SED "s?\/\/[a-z.]*\/?\/\/$HOSTNAME.$DOMAIN\/?g" /usr/share/e2guardian/languages/ukenglish/alcasar-e2g.html
|
634 |
richard |
462 |
# Prompts
|
|
|
463 |
$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc
|
|
|
464 |
# sudoers
|
|
|
465 |
$SED "s?^Host_Alias.*?Host_Alias LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost #réseau de l'organisme?g" /etc/sudoers
|
2878 |
rexy |
466 |
# gammu-smsd
|
|
|
467 |
$SED "s?^user =.*?user = $DB_USER?g" /etc/gammu_smsd_conf
|
|
|
468 |
$SED "s?^password =.*?password = $DB_PASS?g" /etc/gammu_smsd_conf
|
2899 |
rexy |
469 |
# HTTPS login (Y/n)
|
|
|
470 |
if [ "$HTTPS_LOGIN" = "on" ] || [ "$HTTPS_LOGIN" = "On" ] || [ "$HTTPS_LOGIN" = "ON" ]
|
|
|
471 |
then
|
|
|
472 |
$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=on?" $CONF_FILE
|
|
|
473 |
$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=on?" $CONF_FILE
|
|
|
474 |
$SED "s?^uamserver.*?uamserver\thttps://$HOSTNAME.$DOMAIN/intercept.php?" /etc/chilli.conf
|
|
|
475 |
$SED "s?^#redirssl.*?redirssl?" /etc/chilli.conf
|
|
|
476 |
$SED "s?^#uamuissl.*?uamuissl?" /etc/chilli.conf
|
|
|
477 |
rm -f /etc/lighttpd/vhosts.d/alcasar.conf
|
|
|
478 |
ln -s /etc/lighttpd/vhosts.d/alcasar-with-ssl.conf /etc/lighttpd/vhosts.d/alcasar.conf
|
|
|
479 |
else
|
|
|
480 |
$SED "s?^HTTPS_LOGIN=.*?HTTPS_LOGIN=off?" $CONF_FILE
|
|
|
481 |
$SED "s?^HTTPS_CHILLI=.*?HTTPS_CHILLI=off?" $CONF_FILE
|
|
|
482 |
$SED "s?^uamserver.*?uamserver\thttp://$HOSTNAME.$DOMAIN/intercept.php?" /etc/chilli.conf
|
|
|
483 |
$SED "s?^redirssl.*?#&?" /etc/chilli.conf
|
|
|
484 |
$SED "s?^uamuissl.*?#&?" /etc/chilli.conf
|
|
|
485 |
rm -f /etc/lighttpd/vhosts.d/alcasar.conf
|
|
|
486 |
ln -s /etc/lighttpd/vhosts.d/alcasar-without-ssl.conf /etc/lighttpd/vhosts.d/alcasar.conf
|
|
|
487 |
fi
|
2878 |
rexy |
488 |
# Services start
|
1060 |
richard |
489 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
|
|
490 |
then
|
1574 |
richard |
491 |
/usr/bin/systemctl start network && echo -n "Start service : network" && sleep 1
|
2309 |
tom.houday |
492 |
$DIR_BIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", chilli" # apply DHCP mode and start CoovaChilli
|
2840 |
rexy |
493 |
for i in unbound unbound-blackhole ntpd
|
2309 |
tom.houday |
494 |
do
|
|
|
495 |
sleep 1
|
|
|
496 |
/usr/bin/systemctl start $i && echo -n ", $i"
|
|
|
497 |
done
|
3099 |
rexy |
498 |
$DIR_BIN/alcasar-bl.sh -reload && echo -n ", unbound-blacklist, unbound-whitelist, e2guardian, iptables"
|
2488 |
lucas.echa |
499 |
/usr/bin/systemctl restart lighttpd && echo -n ", lighttpd"
|
1060 |
richard |
500 |
fi
|
3018 |
rexy |
501 |
# Email user registration
|
|
|
502 |
$DIR_BIN/alcasar-mail-install.sh
|
2568 |
rexy |
503 |
# Start / Stop LDAP authentification
|
2875 |
rexy |
504 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
2568 |
rexy |
505 |
then
|
2875 |
rexy |
506 |
LDAP_mode=`grep ^LDAP= $CONF_FILE|cut -d"=" -f2`
|
|
|
507 |
if [ $LDAP_mode = "on" ]
|
|
|
508 |
then
|
|
|
509 |
$DIR_BIN/alcasar-ldap.sh --on
|
|
|
510 |
else
|
|
|
511 |
$DIR_BIN/alcasar-ldap.sh --off
|
|
|
512 |
fi
|
2568 |
rexy |
513 |
fi
|
2875 |
rexy |
514 |
# Start / Stop Gammu-smsd (SMS)
|
|
|
515 |
if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
|
|
|
516 |
then
|
|
|
517 |
SMS_mode=`grep ^SMS= $CONF_FILE|cut -d"=" -f2`
|
|
|
518 |
if [ $SMS_mode = "on" ]
|
|
|
519 |
then
|
|
|
520 |
$DIR_BIN/alcasar-sms.sh --start
|
|
|
521 |
fi
|
|
|
522 |
fi
|
2568 |
rexy |
523 |
echo
|
628 |
richard |
524 |
;;
|
8 |
franck |
525 |
*)
|
2688 |
lucas.echa |
526 |
echo "Argument inconnu : $1";
|
8 |
franck |
527 |
echo "$usage"
|
|
|
528 |
exit 1
|
|
|
529 |
;;
|
|
|
530 |
esac
|