Subversion Repositories ALCASAR

Rev

Rev 2705 | Rev 2744 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2705 Rev 2707
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2705 2019-03-05 22:30:50Z tom.houdayer $
2
# $Id: alcasar-conf.sh 2707 2019-03-05 22:54:17Z tom.houdayer $
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 de mettre à jour d'ALCASAR
8
# Ce script permet de mettre à jour d'ALCASAR
9
#	- création de l'archive des fichiers de configuration "/var/tmp/alcasar-conf.tar.gz" (alcasar-conf.sh -create)
9
#	- création de l'archive des fichiers de configuration "/var/tmp/alcasar-conf.tar.gz" (alcasar-conf.sh -create)
10
#	- chargement de l'archive de fichiers de configuration lors de la mise à jour d'un alcasar (alcasar-conf -load). Le cas échéant, c'est ici qu'on met à jour les fichiers entre versions
10
#	- chargement de l'archive de fichiers de configuration lors de la mise à jour d'un alcasar (alcasar-conf -load). Le cas échéant, c'est ici qu'on met à jour les fichiers entre versions
11
#	- application des directives du fichier de conf central "/usr/local/etc/alcasar.conf" à chaud (alcasar-conf -apply)
11
#	- application des directives du fichier de conf central "/usr/local/etc/alcasar.conf" à chaud (alcasar-conf -apply)
12
# This script allows ALCASAR update
12
# This script allows ALCASAR update
13
#	- create the configuration files backup "/var/tmp/alcasar-conf.tar.gz" (alcasar-conf.sh -create)
13
#	- create the configuration files backup "/var/tmp/alcasar-conf.tar.gz" (alcasar-conf.sh -create)
14
#	- load the backup of configuration files during the update process (alcasar-conf -load). If needed, it's here we update files between versions
14
#	- load the backup of configuration files during the update process (alcasar-conf -load). If needed, it's here we update files between versions
15
#	- apply ALCASAR central configuration file "/usr/local/etc/alcasar.conf" when hot modification are needed (alcasar-conf -apply)
15
#	- apply ALCASAR central configuration file "/usr/local/etc/alcasar.conf" when hot modification are needed (alcasar-conf -apply)
16
 
16
 
17
DIR_UPDATE="/var/tmp/conf"				# répertoire de stockage des fichier de conf pour une mise à jour
17
DIR_UPDATE="/var/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
18
DIR_WEB="/var/www/html"					# répertoire du centre de gestion
19
DIR_BIN="/usr/local/bin"				# scripts directory
19
DIR_BIN="/usr/local/bin"				# scripts directory
20
DIR_ETC="/usr/local/etc"				# conf directory
20
DIR_ETC="/usr/local/etc"				# conf directory
21
DIR_E2G="/etc/e2guardian/lists"			# Toulouse BL directory
21
DIR_E2G="/etc/e2guardian/lists"			# Toulouse BL directory
22
DIR_BLACKLIST="$DIR_E2G/blacklists"		# Toulouse BL directory
22
DIR_BLACKLIST="$DIR_E2G/blacklists"		# Toulouse BL directory
23
CONF_FILE="$DIR_ETC/alcasar.conf"			# main alcasar conf file
23
CONF_FILE="$DIR_ETC/alcasar.conf"			# main alcasar conf file
24
EXTIF=`grep ^EXTIF= $CONF_FILE|cut -d"=" -f2`		# EXTernal InterFace
24
EXTIF=`grep ^EXTIF= $CONF_FILE|cut -d"=" -f2`		# EXTernal InterFace
25
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`		# INTernal InterFace
25
INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`		# INTernal InterFace
26
MTU=`grep ^PUBLIC_MTU= $CONF_FILE|cut -d"=" -f2`
26
MTU=`grep ^PUBLIC_MTU= $CONF_FILE|cut -d"=" -f2`
27
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
27
DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
28
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
28
INT_DNS_mode=`grep ^INT_DNS_ACTIVE= $CONF_FILE|cut -d"=" -f2`
29
LDAP_mode=`grep ^LDAP= $CONF_FILE|cut -d"=" -f2`
29
LDAP_mode=`grep ^LDAP= $CONF_FILE|cut -d"=" -f2`
30
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
30
HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2`
31
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
31
DOMAIN=`grep ^DOMAIN= $CONF_FILE|cut -d"=" -f2`
32
SED="/bin/sed -i"
32
SED="/bin/sed -i"
33
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2` 			# server DNS1 (for WL domain names)
33
DNS1=`grep ^DNS1= $CONF_FILE | cut -d'=' -f2` 			# server DNS1 (for WL domain names)
34
DOMAIN=${DOMAIN:=localdomain}
34
DOMAIN=${DOMAIN:=localdomain}
35
 
35
 
36
private_network_calc ()
36
private_network_calc ()
37
{
37
{
38
	PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2`				# prefixe du réseau (ex. 24)
38
	PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP $PRIVATE_NETMASK |cut -d"=" -f2`				# prefixe du réseau (ex. 24)
39
	PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2`			# @ réseau de consultation (ex.: 192.168.182.0)
39
	PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP $PRIVATE_NETMASK| cut -d"=" -f2`			# @ réseau de consultation (ex.: 192.168.182.0)
40
	PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX									# @ + masque du réseau de consult (192.168.182.0/24)
40
	PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX									# @ + masque du réseau de consult (192.168.182.0/24)
41
	classe=$((PRIVATE_PREFIX/8)); classe_sup=`expr $classe + 1`;							# classes de réseau (ex.: 2=classe B, 3=classe C)
41
	classe=$((PRIVATE_PREFIX/8)); classe_sup=`expr $classe + 1`;							# classes de réseau (ex.: 2=classe B, 3=classe C)
42
	PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`.					# @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
42
	PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`.					# @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
43
	PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2`				# private network broadcast (ie.: 192.168.182.255)
43
	PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2`				# private network broadcast (ie.: 192.168.182.255)
44
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`			# last octet of LAN broadcast
44
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`			# last octet of LAN broadcast
45
	private_ip_ending=`echo $PRIVATE_IP | cut -d"." -f4`									# last octet of LAN address
45
	private_ip_ending=`echo $PRIVATE_IP | cut -d"." -f4`									# last octet of LAN address
46
	PRIVATE_SECOND_IP=`echo $PRIVATE_IP | cut -d"." -f1-3`"."`expr $private_ip_ending + 1`	# second network address (ex.: 192.168.182.2)
46
	PRIVATE_SECOND_IP=`echo $PRIVATE_IP | cut -d"." -f1-3`"."`expr $private_ip_ending + 1`	# second network address (ex.: 192.168.182.2)
47
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
47
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
48
	PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'`	# MAC address of INTIF
48
	PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'`	# MAC address of INTIF
49
}
49
}
50
 
50
 
51
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
51
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
52
nb_args=$#
52
nb_args=$#
53
args=$1
53
args=$1
54
if [ $nb_args -eq 0 ]
54
if [ $nb_args -eq 0 ]
55
then
55
then
56
	nb_args=1
56
	nb_args=1
57
	args="-h"
57
	args="-h"
58
fi
58
fi
59
case $args in
59
case $args in
60
	-\? | -h* | --h*)
60
	-\? | -h* | --h*)
61
		echo "$usage"
61
		echo "$usage"
62
		exit 0
62
		exit 0
63
		;;
63
		;;
64
	--create|-create)
64
	--create|-create)
65
		[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
65
		[ -d $DIR_UPDATE ] && rm -rf $DIR_UPDATE
66
		mkdir $DIR_UPDATE
66
		mkdir $DIR_UPDATE
67
# backup the users database  (test to delete in future version)
67
# backup the users database  (test to delete in future version)
68
		$DIR_BIN/alcasar-mysql.sh --dump
68
		$DIR_BIN/alcasar-mysql.sh --dump
69
		cp /var/Save/base/"$(ls -1t /var/Save/base|head -1)" $DIR_UPDATE
69
		cp /var/Save/base/"$(ls -1t /var/Save/base|head -1)" $DIR_UPDATE
70
# backup the logo
70
# backup the logo
71
		cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
71
		cp -f $DIR_WEB/images/organisme.png $DIR_UPDATE
72
# backup BL/WL custom files
72
# backup BL/WL custom files
73
		mkdir $DIR_UPDATE/custom_bl
73
		mkdir $DIR_UPDATE/custom_bl
74
		for i in exceptioniplist urlregexplist exceptionsitelist bannedsitelist exceptionurllist bannedurllist
74
		for i in exceptioniplist urlregexplist exceptionsitelist bannedsitelist exceptionurllist bannedurllist
75
		do
75
		do
76
			if [ -d /etc/dansguardian ]; then
76
			if [ -d /etc/dansguardian ]; then
77
				cp /etc/dansguardian/lists/$i $DIR_UPDATE/custom_bl/ # before V3.3
77
				cp /etc/dansguardian/lists/$i $DIR_UPDATE/custom_bl/ # before V3.3
78
				cp -rf /etc/dansguardian/lists/blacklists/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
78
				cp -rf /etc/dansguardian/lists/blacklists/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
79
			else
79
			else
80
				cp $DIR_E2G/$i $DIR_UPDATE/custom_bl/ # since V3.3
80
				cp $DIR_E2G/$i $DIR_UPDATE/custom_bl/ # since V3.3
81
				cp -rf $DIR_BLACKLIST/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
81
				cp -rf $DIR_BLACKLIST/ossi-* $DIR_UPDATE/custom_bl/ 2>/dev/null
82
			fi
82
			fi
83
		done
83
		done
84
# backup of different conf files (main conf file, filtering, digest, /etc/hosts, etc.)
84
# backup of different conf files (main conf file, filtering, digest, /etc/hosts, etc.)
85
		mkdir $DIR_UPDATE/etc/
85
		mkdir $DIR_UPDATE/etc/
86
		cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
86
		cp -rf $DIR_ETC/* $DIR_UPDATE/etc/
87
		cp /etc/hosts $DIR_UPDATE/etc/
87
		cp /etc/hosts $DIR_UPDATE/etc/
88
# backup of the security certificates (server & CA)
88
# backup of the security certificates (server & CA)
89
		cp -f /etc/pki/tls/certs/alcasar.crt* $DIR_UPDATE
89
		cp -f /etc/pki/tls/certs/alcasar.crt* $DIR_UPDATE
90
		cp -f /etc/pki/tls/private/alcasar.key* $DIR_UPDATE
90
		cp -f /etc/pki/tls/private/alcasar.key* $DIR_UPDATE
91
		[ -e /etc/pki/tls/private/alcasar.pem ] && cp -f /etc/pki/tls/private/alcasar.pem $DIR_UPDATE # since V3.3
91
		[ -e /etc/pki/tls/private/alcasar.pem ] && cp -f /etc/pki/tls/private/alcasar.pem $DIR_UPDATE # since V3.3
92
		cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
92
		cp -f /etc/pki/CA/alcasar-ca.crt $DIR_UPDATE
93
		cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
93
		cp -f /etc/pki/CA/private/alcasar-ca.key $DIR_UPDATE
94
		if [ -e /etc/pki/tls/certs/server-chain.crt ]; then
94
		if [ -e /etc/pki/tls/certs/server-chain.crt ]; then
95
			cp -f /etc/pki/tls/certs/server-chain.crt* $DIR_UPDATE # autosigned and official if exist
95
			cp -f /etc/pki/tls/certs/server-chain.crt* $DIR_UPDATE # autosigned and official if exist
96
		else
96
		else
97
			cp -f /etc/pki/tls/certs/alcasar.crt $DIR_UPDATE/server-chain.crt
97
			cp -f /etc/pki/tls/certs/alcasar.crt $DIR_UPDATE/server-chain.crt
98
		fi
98
		fi
99
# pureip & safesearch status
99
# pureip & safesearch status
100
		[ -d /etc/dansguardian ] && dg_path=/etc/dansguardian || dg_path=/etc/e2guardian
100
		[ -d /etc/dansguardian ] && dg_path=/etc/dansguardian || dg_path=/etc/e2guardian
101
 
101
 
102
		if ! grep -Eq '^WL_SAFESEARCH=' $DIR_UPDATE/etc/alcasar.conf; then
102
		if ! grep -Eq '^WL_SAFESEARCH=' $DIR_UPDATE/etc/alcasar.conf; then
103
			if [ -f /etc/dnsmasq-whitelist.conf ] && grep -iq "SafeSearch" /etc/dnsmasq-whitelist.conf; then
103
			if [ -f /etc/dnsmasq-whitelist.conf ] && grep -iq "SafeSearch" /etc/dnsmasq-whitelist.conf; then
104
				echo 'WL_SAFESEARCH=on' >> $DIR_UPDATE/etc/alcasar.conf
104
				echo 'WL_SAFESEARCH=on' >> $DIR_UPDATE/etc/alcasar.conf
105
			else
105
			else
106
				echo 'WL_SAFESEARCH=off' >> $DIR_UPDATE/etc/alcasar.conf
106
				echo 'WL_SAFESEARCH=off' >> $DIR_UPDATE/etc/alcasar.conf
107
			fi
107
			fi
108
		fi
108
		fi
109
 
109
 
110
		if ! grep -Eq '^BL_SAFESEARCH=' $DIR_UPDATE/etc/alcasar.conf; then
110
		if ! grep -Eq '^BL_SAFESEARCH=' $DIR_UPDATE/etc/alcasar.conf; then
111
			if [ -f /etc/dnsmasq-blacklist.conf ] && grep -iq "SafeSearch" /etc/dnsmasq-blacklist.conf; then
111
			if [ -f /etc/dnsmasq-blacklist.conf ] && grep -iq "SafeSearch" /etc/dnsmasq-blacklist.conf; then
112
				echo 'BL_SAFESEARCH=on' >> $DIR_UPDATE/etc/alcasar.conf
112
				echo 'BL_SAFESEARCH=on' >> $DIR_UPDATE/etc/alcasar.conf
113
			else
113
			else
114
				echo 'BL_SAFESEARCH=off' >> $DIR_UPDATE/etc/alcasar.conf
114
				echo 'BL_SAFESEARCH=off' >> $DIR_UPDATE/etc/alcasar.conf
115
			fi
115
			fi
116
		fi
116
		fi
117
 
117
 
118
		if ! grep -Eq '^BL_PUREIP=' $DIR_UPDATE/etc/alcasar.conf; then
118
		if ! grep -Eq '^BL_PUREIP=' $DIR_UPDATE/etc/alcasar.conf; then
119
			if grep -Eq "^\*ip" $dg_path/lists/bannedsitelist; then
119
			if grep -Eq "^\*ip" $dg_path/lists/bannedsitelist; then
120
				echo 'BL_PUREIP=on' >> $DIR_UPDATE/etc/alcasar.conf
120
				echo 'BL_PUREIP=on' >> $DIR_UPDATE/etc/alcasar.conf
121
			else
121
			else
122
				echo 'BL_PUREIP=off' >> $DIR_UPDATE/etc/alcasar.conf
122
				echo 'BL_PUREIP=off' >> $DIR_UPDATE/etc/alcasar.conf
123
			fi
123
			fi
124
		fi
124
		fi
125
 
125
 
126
# archive file creation
126
# archive file creation
127
		cd /var/tmp || { echo "Unable to find /var/tmp directory"; }
127
		cd /var/tmp || { echo "Unable to find /var/tmp directory"; }
128
		tar -cf alcasar-conf.tar conf/
128
		tar -cf alcasar-conf.tar conf/
129
		gzip -f alcasar-conf.tar
129
		gzip -f alcasar-conf.tar
130
		rm -rf $DIR_UPDATE
130
		rm -rf $DIR_UPDATE
131
		;;
131
		;;
132
 
132
 
133
	--load|-load)
133
	--load|-load)
134
		cd /var/tmp || { echo "Unable to find /var/tmp directory"; }
134
		cd /var/tmp || { echo "Unable to find /var/tmp directory"; }
135
		tar -xf alcasar-conf*.tar.gz
135
		tar -xf alcasar-conf*.tar.gz
136
#########################   modifications between versions  #######################
136
#########################   modifications between versions  #######################
137
# Retrieve the previous version
137
# Retrieve the previous version
138
		PREVIOUS_VERSION=`grep ^VERSION= $DIR_UPDATE/etc/alcasar.conf|cut -d"=" -f2`
138
		PREVIOUS_VERSION=`grep ^VERSION= $DIR_UPDATE/etc/alcasar.conf|cut -d"=" -f2`
139
		MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
139
		MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
140
		MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
140
		MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
141
		UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
141
		UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
142
##  From 3.2.0 & 3.2.1  ##
142
##  From 3.2.0 & 3.2.1  ##
143
	## rewrite /etc/hosts file managing hostname resolution
143
	## rewrite /etc/hosts file managing hostname resolution
144
		PRIVATE_IP=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2|cut -d"/" -f1`
144
		PRIVATE_IP=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2|cut -d"/" -f1`
145
		HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2-`
145
		HOSTNAME=`grep ^HOSTNAME= $CONF_FILE|cut -d"=" -f2-`
146
		domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
146
		domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
147
		[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
147
		[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
148
		if [ "$(grep -c "$PRIVATE_IP\s$domainNames" $DIR_UPDATE/etc/hosts )" -eq 0 ]; then
148
		if [ "$(grep -c "$PRIVATE_IP\s$domainNames" $DIR_UPDATE/etc/hosts )" -eq 0 ]; then
149
			cat << EOF > $DIR_UPDATE/etc/hosts
149
			cat << EOF > $DIR_UPDATE/etc/hosts
150
127.0.0.1	localhost
150
127.0.0.1	localhost
151
$PRIVATE_IP	$domainNames
151
$PRIVATE_IP	$domainNames
152
EOF
152
EOF
153
		fi
153
		fi
154
	## apache & dansguardian are replaced with lighttpd & E²guardian
154
	## apache & dansguardian are replaced with lighttpd & E²guardian
155
		if [ "$(rpm -qa | grep '^\(apache\|apache-mod_php\|apache-mod_ssl\|dansguardian\)-' | wc -l)" -ne 0 ]; then
155
		if [ "$(rpm -qa | grep '^\(apache\|apache-mod_php\|apache-mod_ssl\|dansguardian\)-' | wc -l)" -ne 0 ]; then
156
			rm_rpm="apache apache-mod_php apache-mod_ssl dansguardian"
156
			rm_rpm="apache apache-mod_php apache-mod_ssl dansguardian"
157
			/usr/sbin/urpme --auto -a $rm_rpm 2>/dev/null
157
			/usr/sbin/urpme --auto -a $rm_rpm 2>/dev/null
158
			/usr/sbin/urpme --auto --auto-orphans
158
			/usr/sbin/urpme --auto --auto-orphans
159
			rm -rf /etc/httpd/ /var/log/httpd/ /var/dansguardian/ /etc/dansguardian/
159
			rm -rf /etc/httpd/ /var/log/httpd/ /var/dansguardian/ /etc/dansguardian/
160
		fi
160
		fi
161
	## lighttpd need a .pem certificate (aggregation with private key & server crt)
161
	## lighttpd need a .pem certificate (aggregation with private key & server crt)
162
		[ ! -f $DIR_UPDATE/alcasar.pem ] && (cat $DIR_UPDATE/alcasar.key; echo; cat $DIR_UPDATE/alcasar.crt) > $DIR_UPDATE/alcasar.pem
162
		[ ! -f $DIR_UPDATE/alcasar.pem ] && (cat $DIR_UPDATE/alcasar.key; echo; cat $DIR_UPDATE/alcasar.crt) > $DIR_UPDATE/alcasar.pem
163
##  From 3.3.0  ##
163
##  From 3.3.0  ##
164
	# add "SMS=off" in conf file
164
	# add "SMS=off" in conf file
165
		if [ "$(grep -c '^SMS=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
165
		if [ "$(grep -c '^SMS=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
166
				echo "SMS=off" >> $DIR_UPDATE/etc/alcasar.conf
166
				echo "SMS=off" >> $DIR_UPDATE/etc/alcasar.conf
167
		fi
167
		fi
168
		if [ "$(grep -c '^SMS_NUM=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
168
		if [ "$(grep -c '^SMS_NUM=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
169
				echo "SMS_NUM=" >> $DIR_UPDATE/etc/alcasar.conf
169
				echo "SMS_NUM=" >> $DIR_UPDATE/etc/alcasar.conf
170
		fi
170
		fi
171
##  From 3.4.0  ##
171
##  From 3.4.0  ##
172
	# Fix subdomain dot position (.domain.org to domain.org.) for Unbound
172
	# Fix subdomain dot position (.domain.org to domain.org.) for Unbound
173
		for file in $DIR_E2G/exceptionsitelist $DIR_BLACKLIST/ossi-bl*/domains $DIR_BLACKLIST/ossi-wl*/domains; do
173
		for file in $DIR_E2G/exceptionsitelist $DIR_BLACKLIST/ossi-bl*/domains $DIR_BLACKLIST/ossi-wl*/domains; do
174
			[ -f $file ] && $SED "s/^\.\(.*\)$/\1./g" $file
174
			[ -f $file ] && $SED "s/^\.\(.*\)$/\1./g" $file
175
		done
175
		done
176
	# Add LDAPS parameters to config file
176
	# Add LDAPS parameters to config file
177
		if [ "$(grep -c '^LDAP_SSL=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
177
		if [ "$(grep -c '^LDAP_SSL=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
178
				echo "LDAP_SSL=on" >> $DIR_UPDATE/etc/alcasar.conf
178
				echo "LDAP_SSL=on" >> $DIR_UPDATE/etc/alcasar.conf
179
		fi
179
		fi
180
		if [ "$(grep -c '^LDAP_CERT_REQUIRED=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
180
		if [ "$(grep -c '^LDAP_CERT_REQUIRED=' $DIR_UPDATE/etc/alcasar.conf)" -eq 0 ]; then
181
				echo "LDAP_CERT_REQUIRED=" >> $DIR_UPDATE/etc/alcasar.conf
181
				echo "LDAP_CERT_REQUIRED=" >> $DIR_UPDATE/etc/alcasar.conf
182
		fi
182
		fi
183
######################   End of modifications between versions  #######################
183
######################   End of modifications between versions  #######################
184
# Retrieve the logo
184
# Retrieve the logo
185
		[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
185
		[ -e $DIR_UPDATE/organisme.png ] && cp -f $DIR_UPDATE/organisme.png $DIR_WEB/images/
186
		chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
186
		chown apache:apache $DIR_WEB/images/organisme.png $DIR_WEB/intercept.php
187
# Retrieve the security certificates (CA and server)
187
# Retrieve the security certificates (CA and server)
188
		cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
188
		cp -f $DIR_UPDATE/alcasar-ca.crt /etc/pki/CA/
189
		cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
189
		cp -f $DIR_UPDATE/alcasar-ca.key /etc/pki/CA/private/
190
		cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
190
		cp -f $DIR_UPDATE/alcasar.crt /etc/pki/tls/certs/
191
		cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
191
		cp -f $DIR_UPDATE/alcasar.key /etc/pki/tls/private/
192
		cp -f $DIR_UPDATE/alcasar.pem /etc/pki/tls/private/
192
		cp -f $DIR_UPDATE/alcasar.pem /etc/pki/tls/private/
193
		[ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt* /etc/pki/tls/certs/ # autosigned and official if exist
193
		[ -e $DIR_UPDATE/server-chain.crt ] && cp -f $DIR_UPDATE/server-chain.crt* /etc/pki/tls/certs/ # autosigned and official if exist
194
		chown -R root:apache /etc/pki
194
		chown -R root:apache /etc/pki
195
		chmod -R 750 /etc/pki
195
		chmod -R 750 /etc/pki
196
# Import of the users database
196
# Import of the users database
197
		$DIR_BIN/alcasar-mysql.sh --import "$(ls $DIR_UPDATE/alcasar-users-database*)"
197
		$DIR_BIN/alcasar-mysql.sh --import "$(ls $DIR_UPDATE/alcasar-users-database*)"
198
# Retrieve local parameters
198
# Retrieve local parameters
199
		cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
199
		cp -rf $DIR_UPDATE/etc/* $DIR_ETC/
200
		mv -f $DIR_UPDATE/etc/hosts /etc/hosts
200
		mv -f $DIR_UPDATE/etc/hosts /etc/hosts
201
		chmod 755 /etc/hosts
201
		chmod 755 /etc/hosts
202
# Retrieve BL/WL custom files
202
# Retrieve BL/WL custom files
203
		cp -f $DIR_UPDATE/custom_bl/exceptioniplist $DIR_E2G/
203
		cp -f $DIR_UPDATE/custom_bl/exceptioniplist $DIR_E2G/
204
		cp -f $DIR_UPDATE/custom_bl/exceptionsitelist $DIR_E2G/
204
		cp -f $DIR_UPDATE/custom_bl/exceptionsitelist $DIR_E2G/
205
		cp -f $DIR_UPDATE/custom_bl/urlregexplist $DIR_E2G/
205
		cp -f $DIR_UPDATE/custom_bl/urlregexplist $DIR_E2G/
206
		cp -f $DIR_UPDATE/custom_bl/bannedsitelist $DIR_E2G/
206
		cp -f $DIR_UPDATE/custom_bl/bannedsitelist $DIR_E2G/
207
		cp -f $DIR_UPDATE/custom_bl/exceptionurllist $DIR_E2G/
207
		cp -f $DIR_UPDATE/custom_bl/exceptionurllist $DIR_E2G/
208
		cp -f $DIR_UPDATE/custom_bl/bannedurllist $DIR_E2G/
208
		cp -f $DIR_UPDATE/custom_bl/bannedurllist $DIR_E2G/
209
		cp -rf $DIR_UPDATE/custom_bl/ossi-* $DIR_BLACKLIST/ 2>/dev/null
209
		cp -rf $DIR_UPDATE/custom_bl/ossi-* $DIR_BLACKLIST/ 2>/dev/null
210
		chown -R e2guardian:apache $DIR_E2G
210
		chown -R e2guardian:apache $DIR_E2G
211
		chmod -R g+rw $DIR_E2G
211
		chmod -R g+rw $DIR_E2G
212
# Adapt DNS/URL filtering
212
# Adapt DNS/URL filtering
213
		PARENT_SCRIPT=`basename $0`
213
		PARENT_SCRIPT=`basename $0`
214
		export PARENT_SCRIPT
214
		export PARENT_SCRIPT
215
		$DIR_BIN/alcasar-bl.sh -cat_choice
215
		$DIR_BIN/alcasar-bl.sh -cat_choice
216
		$DIR_BIN/alcasar-bl.sh -reload
216
		$DIR_BIN/alcasar-bl.sh -reload
217
# admin profile update (admin + manager + backup)
217
# admin profile update (admin + manager + backup)
218
		$DIR_BIN/alcasar-profil.sh --list
218
		$DIR_BIN/alcasar-profil.sh --list
219
# Start / Stop SSH Daemon
219
# Start / Stop SSH Daemon
220
		ssh_active=`grep "^SSH=" $CONF_FILE|cut -d"=" -f2`
220
		ssh_active=`grep "^SSH=" $CONF_FILE|cut -d"=" -f2`
221
		if [ $ssh_active = "on" ]
221
		if [ $ssh_active = "on" ]
222
		then
222
		then
223
			/usr/bin/systemctl -q enable sshd.service
223
			/usr/bin/systemctl -q enable sshd.service
224
		else
224
		else
225
			/usr/bin/systemctl -q disable sshd.service
225
			/usr/bin/systemctl -q disable sshd.service
226
		fi
226
		fi
227
# Remove the update folder
227
# Remove the update folder
228
		rm -rf $DIR_UPDATE
228
		rm -rf $DIR_UPDATE
229
		;;
229
		;;
230
 
230
 
231
	--apply|-apply)
231
	--apply|-apply)
232
		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"
232
		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"
233
		PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2`
233
		PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $CONF_FILE|cut -d"=" -f2`
234
		if ! echo $PRIVATE_IP_MASK | egrep -q $PTN
234
		if ! echo $PRIVATE_IP_MASK | egrep -q $PTN
235
		then
235
		then
236
			echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
236
			echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
237
			exit 0
237
			exit 0
238
		fi
238
		fi
239
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2`
239
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2`
240
		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"
240
		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"
241
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
241
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
242
		then
242
		then
243
			PUBLIC_GATEWAY="dhcp"
243
			PUBLIC_GATEWAY="dhcp"
244
 
244
 
245
		else
245
		else
246
			if ! echo $PUBLIC_IP_MASK | egrep -q $PTN
246
			if ! echo $PUBLIC_IP_MASK | egrep -q $PTN
247
			then
247
			then
248
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
248
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
249
				exit 0
249
				exit 0
250
			fi
250
			fi
251
			PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
251
			PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
252
			PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
252
			PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
253
			PUBLIC_GATEWAY=`grep ^GW= $CONF_FILE|cut -d"=" -f2`
253
			PUBLIC_GATEWAY=`grep ^GW= $CONF_FILE|cut -d"=" -f2`
254
			if ! echo $PUBLIC_GATEWAY | egrep -q $PTN
254
			if ! echo $PUBLIC_GATEWAY | egrep -q $PTN
255
			then
255
			then
256
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
256
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
257
				exit 0
257
				exit 0
258
			fi
258
			fi
259
		fi
259
		fi
260
		DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2`
260
		DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2`
261
		if ! echo $DNS1 | egrep -q $PTN
261
		if ! echo $DNS1 | egrep -q $PTN
262
		then
262
		then
263
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
263
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
264
			exit 0
264
			exit 0
265
		fi
265
		fi
266
		DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2`
266
		DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2`
267
		if ! echo $DNS2 | egrep -q $PTN
267
		if ! echo $DNS2 | egrep -q $PTN
268
		then
268
		then
269
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
269
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
270
			exit 0
270
			exit 0
271
		fi
271
		fi
272
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
272
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
273
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
273
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
274
		private_network_calc
274
		private_network_calc
275
		INSTALL_DATE=`grep ^INSTALL_DATE= $CONF_FILE|cut -d"=" -f2`
275
		INSTALL_DATE=`grep ^INSTALL_DATE= $CONF_FILE|cut -d"=" -f2`
276
		ORGANISME=`grep ^ORGANISM= $CONF_FILE|cut -d"=" -f2-`
276
		ORGANISME=`grep ^ORGANISM= $CONF_FILE|cut -d"=" -f2-`
277
		BL_SAFESEARCH=`grep ^BL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
277
		BL_SAFESEARCH=`grep ^BL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
278
		WL_SAFESEARCH=`grep ^WL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
278
		WL_SAFESEARCH=`grep ^WL_SAFESEARCH= $CONF_FILE|cut -d"=" -f2`
279
		BL_PUREIP=`grep ^BL_PUREIP= $CONF_FILE|cut -d"=" -f2`
279
		BL_PUREIP=`grep ^BL_PUREIP= $CONF_FILE|cut -d"=" -f2`
280
		DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
280
		DHCP_mode=`grep ^DHCP= $CONF_FILE|cut -d"=" -f2`
281
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
281
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
282
		then
282
		then
283
			if [ "$DHCP_mode" = "off" ] || [ "$DHCP_mode" = "Off" ] || [ "$DHCP_mode" = "OFF" ]
283
			if [ "$DHCP_mode" = "off" ] || [ "$DHCP_mode" = "Off" ] || [ "$DHCP_mode" = "OFF" ]
284
			then
284
			then
285
				$DIR_BIN/alcasar-dhcp.sh --off
285
				$DIR_BIN/alcasar-dhcp.sh --off
286
			else
286
			else
287
				$DIR_BIN/alcasar-dhcp.sh --on
287
				$DIR_BIN/alcasar-dhcp.sh --on
288
			fi
288
			fi
289
 
289
 
290
# Set the local DNS (or not)
290
# Set the local DNS (or not)
291
			if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ]
291
			if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ]
292
			then
292
			then
293
				$DIR_BIN/alcasar-dns-local.sh --on
293
				$DIR_BIN/alcasar-dns-local.sh --on
294
			else
294
			else
295
				$DIR_BIN/alcasar-dns-local.sh --off
295
				$DIR_BIN/alcasar-dns-local.sh --off
296
			fi
296
			fi
297
 
297
 
298
# Set the pure ip option (or not)
298
# Set the pure ip option (or not)
299
			if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ]
299
			if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ]
300
			then
300
			then
301
				bl_filter_param+="--pureip_off"
301
				bl_filter_param+="--pureip_off"
302
			else
302
			else
303
				bl_filter_param+="--pureip_on"
303
				bl_filter_param+="--pureip_on"
304
			fi
304
			fi
305
 
305
 
306
# Set the safesearch options (or not)
306
# Set the safesearch options (or not)
307
			bl_filter_param=""
307
			bl_filter_param=""
308
			if [ "$BL_SAFESEARCH" = "on" ] || [ "$BL_SAFESEARCH" = "On" ] || [ "$BL_SAFESEARCH" = "ON" ]
308
			if [ "$BL_SAFESEARCH" = "on" ] || [ "$BL_SAFESEARCH" = "On" ] || [ "$BL_SAFESEARCH" = "ON" ]
309
			then
309
			then
310
				bl_filter_param+="--safesearch_on "
310
				bl_filter_param+="--safesearch_on "
311
			else
311
			else
312
				bl_filter_param+="--safesearch_off "
312
				bl_filter_param+="--safesearch_off "
313
			fi
313
			fi
314
 
314
 
315
			$DIR_BIN/alcasar-url_filter_bl.sh $bl_filter_param
315
			$DIR_BIN/alcasar-url_filter_bl.sh $bl_filter_param
316
 
316
 
317
			if [ "$WL_SAFESEARCH" = "on" ] || [ "$WL_SAFESEARCH" = "On" ] || [ "$WL_SAFESEARCH" = "ON" ]
317
			if [ "$WL_SAFESEARCH" = "on" ] || [ "$WL_SAFESEARCH" = "On" ] || [ "$WL_SAFESEARCH" = "ON" ]
318
			then
318
			then
319
				$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_on
319
				$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_on
320
			else
320
			else
321
				$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_off
321
				$DIR_BIN/alcasar-url_filter_wl.sh --safesearch_off
322
			fi
322
			fi
323
 
323
 
324
# Reload the local dns configuration
324
# Reload the local dns configuration
325
			$DIR_BIN/alcasar-dns-local.sh --reload
325
			$DIR_BIN/alcasar-dns-local.sh --reload
326
 
326
 
327
# Logout everybody
327
# Logout everybody
328
			$DIR_BIN/alcasar-logout.sh all
328
			$DIR_BIN/alcasar-logout.sh all
329
# Services stop
329
# Services stop
330
			echo -n "Stop services : "
330
			echo -n "Stop services : "
331
			for i in ntpd tinyproxy e2guardian unbound unbound-whitelist dnsmasq-whitelist unbound-blacklist unbound-blackhole chilli network lighttpd
331
			for i in ntpd tinyproxy e2guardian unbound unbound-whitelist dnsmasq-whitelist unbound-blacklist unbound-blackhole chilli network lighttpd
332
			do
332
			do
333
				/usr/bin/systemctl stop $i && echo -n "$i, "
333
				/usr/bin/systemctl stop $i && echo -n "$i, "
334
			done
334
			done
335
			echo
335
			echo
336
		fi
336
		fi
337
# EXTIF config
337
# EXTIF config
338
		if [ $PUBLIC_IP_MASK == "dhcp" ]
338
		if [ $PUBLIC_IP_MASK == "dhcp" ]
339
		then
339
		then
340
			cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
340
			cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
341
DEVICE=$EXTIF
341
DEVICE=$EXTIF
342
BOOTPROTO=dhcp
342
BOOTPROTO=dhcp
343
DNS1=127.0.0.1
343
DNS1=127.0.0.1
344
PEERDNS=no
344
PEERDNS=no
345
RESOLV_MODS=yes
345
RESOLV_MODS=yes
346
ONBOOT=yes
346
ONBOOT=yes
347
METRIC=10
347
METRIC=10
348
MII_NOT_SUPPORTED=yes
348
MII_NOT_SUPPORTED=yes
349
IPV6INIT=no
349
IPV6INIT=no
350
IPV6TO4INIT=no
350
IPV6TO4INIT=no
351
ACCOUNTING=no
351
ACCOUNTING=no
352
USERCTL=no
352
USERCTL=no
353
MTU=$MTU
353
MTU=$MTU
354
NOZEROCONF=yes
354
NOZEROCONF=yes
355
EOF
355
EOF
356
		else
356
		else
357
			cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
357
			cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
358
DEVICE=$EXTIF
358
DEVICE=$EXTIF
359
BOOTPROTO=static
359
BOOTPROTO=static
360
IPADDR=$PUBLIC_IP
360
IPADDR=$PUBLIC_IP
361
NETMASK=$PUBLIC_NETMASK
361
NETMASK=$PUBLIC_NETMASK
362
GATEWAY=$PUBLIC_GATEWAY
362
GATEWAY=$PUBLIC_GATEWAY
363
DNS1=127.0.0.1
363
DNS1=127.0.0.1
364
RESOLV_MODS=yes
364
RESOLV_MODS=yes
365
ONBOOT=yes
365
ONBOOT=yes
366
METRIC=10
366
METRIC=10
367
MII_NOT_SUPPORTED=yes
367
MII_NOT_SUPPORTED=yes
368
IPV6INIT=no
368
IPV6INIT=no
369
IPV6TO4INIT=no
369
IPV6TO4INIT=no
370
ACCOUNTING=no
370
ACCOUNTING=no
371
USERCTL=no
371
USERCTL=no
372
MTU=$MTU
372
MTU=$MTU
373
NOZEROCONF=yes
373
NOZEROCONF=yes
374
EOF
374
EOF
375
		fi
375
		fi
376
# INTIF config (for bypass mode only)
376
# INTIF config (for bypass mode only)
377
		$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
377
		$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
378
		$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
378
		$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/bypass-ifcfg-$INTIF
379
# NTP server
379
# NTP server
380
		$SED "/127.0.0.1/!s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap?g" /etc/ntp.conf
380
		$SED "/127.0.0.1/!s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap?g" /etc/ntp.conf
381
# host.allow
381
# host.allow
382
		cat <<EOF > /etc/hosts.allow
382
		cat <<EOF > /etc/hosts.allow
383
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
383
ALL: LOCAL, 127.0.0.1, localhost, $PRIVATE_IP
384
sshd: ALL
384
sshd: ALL
385
ntpd: $PRIVATE_NETWORK_SHORT
385
ntpd: $PRIVATE_NETWORK_SHORT
386
EOF
386
EOF
387
# Set hostname
387
# Set hostname
388
		hostnamectl set-hostname $HOSTNAME.$DOMAIN
388
		hostnamectl set-hostname $HOSTNAME.$DOMAIN
389
# /etc/hosts
389
# /etc/hosts
390
		domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
390
		domainNames="$HOSTNAME $HOSTNAME.$DOMAIN"
391
		[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
391
		[ "$HOSTNAME" != 'alcasar' ] && domainNames="alcasar $domainNames"
392
		$SED "/^$PRIVATE_IP\t/d"  /etc/hosts
392
		$SED "/^$PRIVATE_IP\t/d"  /etc/hosts
393
		$SED "/\s$HOSTNAME\s\$/d" /etc/hosts
393
		$SED "/\s$HOSTNAME\s\$/d" /etc/hosts
394
		[ "$HOSTNAME" != 'alcasar' ] && $SED "/\salcasar\s\$/d" /etc/hosts
394
		[ "$HOSTNAME" != 'alcasar' ] && $SED "/\salcasar\s\$/d" /etc/hosts
395
		echo "$PRIVATE_IP	$domainNames" >> /etc/hosts
395
		echo "$PRIVATE_IP	$domainNames" >> /etc/hosts
396
# MOTD
396
# MOTD
397
		$SED "s@'https://\(.\+\)/acc'@'https://$HOSTNAME.$DOMAIN/acc'@" /etc/mageia-release
397
		$SED "s@'https://\(.\+\)/acc'@'https://$HOSTNAME.$DOMAIN/acc'@" /etc/mageia-release
398
# Lighttpd
398
# Lighttpd
399
		$SED "s?^server\.bind.*?server\.bind = \"$PRIVATE_IP\"?g" /etc/lighttpd/lighttpd.conf
399
		$SED "s?^server\.bind.*?server\.bind = \"$PRIVATE_IP\"?g" /etc/lighttpd/lighttpd.conf
400
		$SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$PRIVATE_IP"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
400
		$SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$PRIVATE_IP"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
401
		$SED "s/^\([\t ]*\)var.server_name.*/\1var.server_name = \"$PRIVATE_IP\"/g" /etc/lighttpd/vhosts.d/alcasar.conf
401
		$SED "s/^\([\t ]*\)var.server_name.*/\1var.server_name = \"$PRIVATE_IP\"/g" /etc/lighttpd/vhosts.d/alcasar.conf
402
# FreeRADIUS Web
402
# FreeRADIUS Web
403
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
403
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
404
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
404
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
405
# coova
405
# CoovaChilli
406
		$SED "s/^uamallowed.*/uamallowed\t$HOSTNAME,$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
406
		$SED "s/^uamallowed.*/uamallowed\t$HOSTNAME,$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
407
		$SED "s/^locationname.*/locationname\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
407
		$SED "s/^locationname.*/locationname\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
-
 
408
		$SED "s/^domain.*/domain\t\t$DOMAIN/g" /etc/chilli.conf
408
		[ "`grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2`" == "on" ] && chilli_login_protocol="https" || chilli_login_protocol="http"
409
		[ "`grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2`" == "on" ] && chilli_login_protocol="https" || chilli_login_protocol="http"
409
		$SED "s/^uamserver.*/uamserver\t$chilli_login_protocol:\/\/$HOSTNAME.$DOMAIN\/intercept.php/" /etc/chilli.conf
410
		$SED "s/^uamserver.*/uamserver\t$chilli_login_protocol:\/\/$HOSTNAME.$DOMAIN\/intercept.php/" /etc/chilli.conf
410
		$SED "s/^radiusnasid.*/radiusnasid\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
411
		$SED "s/^radiusnasid.*/radiusnasid\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
411
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
412
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
412
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
413
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
413
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
414
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
414
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
415
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
415
		# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
416
		# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
416
		$SED "s?^$PRIVATE_MAC.*?$PRIVATE_MAC $PRIVATE_SECOND_IP?" $DIR_ETC/alcasar-ethers $DIR_ETC/alcasar-ethers-info
417
		$SED "s?^$PRIVATE_MAC.*?$PRIVATE_MAC $PRIVATE_SECOND_IP?" $DIR_ETC/alcasar-ethers $DIR_ETC/alcasar-ethers-info
417
# dnsmasq-whitelist
418
# dnsmasq-whitelist
418
		$SED "/^server=/d" /etc/dnsmasq-whitelist.conf
419
		$SED "/^server=/d" /etc/dnsmasq-whitelist.conf
419
		echo "server=$DNS1" >> /etc/dnsmasq-whitelist.conf
420
		echo "server=$DNS1" >> /etc/dnsmasq-whitelist.conf
420
		echo "server=$DNS2" >> /etc/dnsmasq-whitelist.conf
421
		echo "server=$DNS2" >> /etc/dnsmasq-whitelist.conf
421
# unbound
422
# unbound
422
		# removing unbound configuration files
423
		# removing unbound configuration files
423
		rm -f /etc/unbound/conf.d/{forward,blacklist,whitelist,blackhole}/iface.*
424
		rm -f /etc/unbound/conf.d/{forward,blacklist,whitelist,blackhole}/iface.*
424
		rm -f /etc/unbound/conf.d/common/forward-zone.conf
425
		rm -f /etc/unbound/conf.d/common/forward-zone.conf
425
		find /etc/unbound/conf.d/common/local-dns/ ! -name "global.conf" -type f -delete
426
		find /etc/unbound/conf.d/common/local-dns/ ! -name "global.conf" -type f -delete
426
 
427
 
427
		# Configuration file for the dns servers forward-zone
428
		# Configuration file for the dns servers forward-zone
428
		cat << EOF > /etc/unbound/conf.d/common/forward-zone.conf
429
		cat << EOF > /etc/unbound/conf.d/common/forward-zone.conf
429
forward-zone:
430
forward-zone:
430
	name: "."
431
	name: "."
431
	forward-addr: $DNS1
432
	forward-addr: $DNS1
432
	forward-addr: $DNS2
433
	forward-addr: $DNS2
433
EOF
434
EOF
434
 
435
 
435
		# Configuration file of ALCASAR main domains for $INTIF
436
		# Configuration file of ALCASAR main domains for $INTIF
436
		cat << EOF > /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
437
		cat << EOF > /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
437
server:
438
server:
438
	local-zone: "$HOSTNAME.$DOMAIN" static
439
	local-zone: "$HOSTNAME.$DOMAIN" static
439
	local-data: "$HOSTNAME.$DOMAIN A $PRIVATE_IP"
440
	local-data: "$HOSTNAME.$DOMAIN A $PRIVATE_IP"
440
	local-zone: "$HOSTNAME" static
441
	local-zone: "$HOSTNAME" static
441
	local-data: "$HOSTNAME A $PRIVATE_IP"
442
	local-data: "$HOSTNAME A $PRIVATE_IP"
442
EOF
443
EOF
443
 
444
 
444
		# Configuration file for lo of forward unbound
445
		# Configuration file for lo of forward unbound
445
		cat << EOF > /etc/unbound/conf.d/forward/iface.lo.conf
446
		cat << EOF > /etc/unbound/conf.d/forward/iface.lo.conf
446
server:
447
server:
447
	interface: 127.0.0.1@53
448
	interface: 127.0.0.1@53
448
	access-control-view: 127.0.0.1/8 lo
449
	access-control-view: 127.0.0.1/8 lo
449
 
450
 
450
view:
451
view:
451
	name: "lo"
452
	name: "lo"
452
	view-first: yes
453
	view-first: yes
453
	local-zone: "$HOSTNAME.$DOMAIN" static
454
	local-zone: "$HOSTNAME.$DOMAIN" static
454
	local-data: "$HOSTNAME.$DOMAIN A 127.0.0.1"
455
	local-data: "$HOSTNAME.$DOMAIN A 127.0.0.1"
455
	local-zone: "$HOSTNAME" static
456
	local-zone: "$HOSTNAME" static
456
	local-data: "$HOSTNAME A 127.0.0.1"
457
	local-data: "$HOSTNAME A 127.0.0.1"
457
	local-zone: "$DOMAIN." static
458
	local-zone: "$DOMAIN." static
458
	local-data: "$DOMAIN. A"
459
	local-data: "$DOMAIN. A"
459
EOF
460
EOF
460
 
461
 
461
		if [ "$HOSTNAME" != 'alcasar' ]
462
		if [ "$HOSTNAME" != 'alcasar' ]
462
		then
463
		then
463
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
464
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
464
			echo -e "\tlocal-zone: \"alcasar A $PRIVATE_IP\"" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
465
			echo -e "\tlocal-zone: \"alcasar A $PRIVATE_IP\"" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
465
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/forward/iface.lo.conf
466
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/forward/iface.lo.conf
466
			echo -e "\tlocal-zone: \"alcasar A 127.0.0.1\"" >> /etc/unbound/conf.d/forward/iface.lo.conf
467
			echo -e "\tlocal-zone: \"alcasar A 127.0.0.1\"" >> /etc/unbound/conf.d/forward/iface.lo.conf
467
		fi
468
		fi
468
 
469
 
469
		# Configuration file for $INTIF of forward unbound
470
		# Configuration file for $INTIF of forward unbound
470
		cat << EOF > /etc/unbound/conf.d/forward/iface.${INTIF}.conf
471
		cat << EOF > /etc/unbound/conf.d/forward/iface.${INTIF}.conf
471
server:
472
server:
472
	interface: ${PRIVATE_IP}@53
473
	interface: ${PRIVATE_IP}@53
473
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
474
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
474
 
475
 
475
view:
476
view:
476
	name: "$INTIF"
477
	name: "$INTIF"
477
	view-first: yes
478
	view-first: yes
478
EOF
479
EOF
479
 
480
 
480
		# Configuration file for $INTIF of blacklist unbound
481
		# Configuration file for $INTIF of blacklist unbound
481
		cat << EOF > /etc/unbound/conf.d/blacklist/iface.${INTIF}.conf
482
		cat << EOF > /etc/unbound/conf.d/blacklist/iface.${INTIF}.conf
482
server:
483
server:
483
	interface: ${PRIVATE_IP}@54
484
	interface: ${PRIVATE_IP}@54
484
	access-control: $PRIVATE_IP_MASK allow
485
	access-control: $PRIVATE_IP_MASK allow
485
	access-control-tag: $PRIVATE_IP_MASK "blacklist"
486
	access-control-tag: $PRIVATE_IP_MASK "blacklist"
486
	access-control-tag-action: $PRIVATE_IP_MASK "blacklist" redirect
487
	access-control-tag-action: $PRIVATE_IP_MASK "blacklist" redirect
487
	access-control-tag-data: $PRIVATE_IP_MASK "blacklist" "A $PRIVATE_IP"
488
	access-control-tag-data: $PRIVATE_IP_MASK "blacklist" "A $PRIVATE_IP"
488
EOF
489
EOF
489
 
490
 
490
		# Configuration file for $INTIF of whitelist unbound
491
		# Configuration file for $INTIF of whitelist unbound
491
		cat << EOF > /etc/unbound/conf.d/whitelist/iface.${INTIF}.conf
492
		cat << EOF > /etc/unbound/conf.d/whitelist/iface.${INTIF}.conf
492
server:
493
server:
493
	interface: ${PRIVATE_IP}@55
494
	interface: ${PRIVATE_IP}@55
494
	access-control: $PRIVATE_IP_MASK allow
495
	access-control: $PRIVATE_IP_MASK allow
495
	access-control-tag: $PRIVATE_IP_MASK "whitelist"
496
	access-control-tag: $PRIVATE_IP_MASK "whitelist"
496
	access-control-tag-action: $PRIVATE_IP_MASK "whitelist" redirect
497
	access-control-tag-action: $PRIVATE_IP_MASK "whitelist" redirect
497
	access-control-tag-data: $PRIVATE_IP_MASK "whitelist" "A $PRIVATE_IP"
498
	access-control-tag-data: $PRIVATE_IP_MASK "whitelist" "A $PRIVATE_IP"
498
EOF
499
EOF
499
 
500
 
500
		# Configuration file for $INTIF of blackhole unbound
501
		# Configuration file for $INTIF of blackhole unbound
501
		cat << EOF > /etc/unbound/conf.d/blackhole/iface.${INTIF}.conf
502
		cat << EOF > /etc/unbound/conf.d/blackhole/iface.${INTIF}.conf
502
server:
503
server:
503
	interface: ${PRIVATE_IP}@56
504
	interface: ${PRIVATE_IP}@56
504
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
505
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
505
 
506
 
506
view:
507
view:
507
	name: "$INTIF"
508
	name: "$INTIF"
508
	local-zone: "." redirect
509
	local-zone: "." redirect
509
	local-data: ". A $PRIVATE_IP"
510
	local-data: ". A $PRIVATE_IP"
510
EOF
511
EOF
511
 
512
 
512
# dhcpd
513
# dhcpd
513
		cat <<EOF > /etc/dhcpd.conf
514
		cat <<EOF > /etc/dhcpd.conf
514
ddns-update-style none;
515
ddns-update-style none;
515
subnet $PRIVATE_NETWORK netmask $PRIVATE_NETMASK {
516
subnet $PRIVATE_NETWORK netmask $PRIVATE_NETMASK {
516
	option routers $PRIVATE_IP;
517
	option routers $PRIVATE_IP;
517
	option subnet-mask $PRIVATE_NETMASK;
518
	option subnet-mask $PRIVATE_NETMASK;
518
	option domain-name-servers $PRIVATE_IP;
519
	option domain-name-servers $PRIVATE_IP;
519
 
520
 
520
	range dynamic-bootp $PRIVATE_SECOND_IP $PRIVATE_LAST_IP;
521
	range dynamic-bootp $PRIVATE_SECOND_IP $PRIVATE_LAST_IP;
521
	default-lease-time 21600;
522
	default-lease-time 21600;
522
	max-lease-time 43200;
523
	max-lease-time 43200;
523
}
524
}
524
EOF
525
EOF
525
# tinyproxy
526
# tinyproxy
526
		$SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
527
		$SED "s?^Listen.*?Listen $PRIVATE_IP?g" /etc/tinyproxy/tinyproxy.conf
527
# DG + BL
528
# DG + BL
528
		$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
529
		$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/e2guardian/e2guardian.conf
529
# Watchdog
530
# Watchdog
530
		$SED "s?^PRIVATE_IP=.*?PRIVATE_IP=\"$PRIVATE_IP\"?g" $DIR_BIN/alcasar-watchdog.sh
531
		$SED "s?^PRIVATE_IP=.*?PRIVATE_IP=\"$PRIVATE_IP\"?g" $DIR_BIN/alcasar-watchdog.sh
531
# Prompts
532
# Prompts
532
		$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc
533
		$SED "s?^ORGANISME.*?ORGANISME=$ORGANISME?g" /etc/bashrc
533
# sudoers
534
# sudoers
534
		$SED "s?^Host_Alias.*?Host_Alias	LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost		#réseau de l'organisme?g" /etc/sudoers
535
		$SED "s?^Host_Alias.*?Host_Alias	LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost		#réseau de l'organisme?g" /etc/sudoers
535
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
536
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
536
		then
537
		then
537
# Services start
538
# Services start
538
			/usr/bin/systemctl start network && echo -n "Start service : network" && sleep 1
539
			/usr/bin/systemctl start network && echo -n "Start service : network" && sleep 1
539
			$DIR_BIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", chilli" # apply DHCP mode and start CoovaChilli
540
			$DIR_BIN/alcasar-dhcp.sh -$DHCP_mode && echo -n ", chilli" # apply DHCP mode and start CoovaChilli
540
			for i in unbound unbound-blackhole tinyproxy ntpd
541
			for i in unbound unbound-blackhole tinyproxy ntpd
541
			do
542
			do
542
				sleep 1
543
				sleep 1
543
				/usr/bin/systemctl start $i && echo -n ", $i"
544
				/usr/bin/systemctl start $i && echo -n ", $i"
544
			done
545
			done
545
			$DIR_BIN/alcasar-bl.sh -reload && echo -n ", unbound-blacklist, unbound-whitelist, dnsmasq-whitelist, e2guardian, iptables"
546
			$DIR_BIN/alcasar-bl.sh -reload && echo -n ", unbound-blacklist, unbound-whitelist, dnsmasq-whitelist, e2guardian, iptables"
546
			/usr/bin/systemctl restart lighttpd && echo -n ", lighttpd"
547
			/usr/bin/systemctl restart lighttpd && echo -n ", lighttpd"
547
		fi
548
		fi
548
# Start / Stop SSH Daemon
549
# Start / Stop SSH Daemon
549
		ssh_active=`grep ^SSH= $CONF_FILE|cut -d"=" -f2`
550
		ssh_active=`grep ^SSH= $CONF_FILE|cut -d"=" -f2`
550
		if [ $ssh_active = "on" ]
551
		if [ $ssh_active = "on" ]
551
		then
552
		then
552
			/usr/bin/systemctl enable sshd.service
553
			/usr/bin/systemctl enable sshd.service
553
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
554
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
554
			then
555
			then
555
				/usr/bin/systemctl start sshd.service
556
				/usr/bin/systemctl start sshd.service
556
			fi
557
			fi
557
		else
558
		else
558
			/usr/bin/systemctl disable sshd.service
559
			/usr/bin/systemctl disable sshd.service
559
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
560
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
560
			then
561
			then
561
				/usr/bin/systemctl stop sshd.service
562
				/usr/bin/systemctl stop sshd.service
562
			fi
563
			fi
563
		fi
564
		fi
564
# Start / Stop LDAP authentification
565
# Start / Stop LDAP authentification
565
		if [ $LDAP_mode = "on" ] || [ $LDAP_mode = "On" ] || [ $LDAP_mode = "ON" ]
566
		if [ $LDAP_mode = "on" ] || [ $LDAP_mode = "On" ] || [ $LDAP_mode = "ON" ]
566
		then
567
		then
567
			$DIR_BIN/alcasar-ldap.sh
568
			$DIR_BIN/alcasar-ldap.sh --on
-
 
569
		else
-
 
570
			$DIR_BIN/alcasar-ldap.sh --off
568
		fi
571
		fi
569
		echo
572
		echo
570
		;;
573
		;;
571
	*)
574
	*)
572
		echo "Argument inconnu : $1";
575
		echo "Argument inconnu : $1";
573
		echo "$usage"
576
		echo "$usage"
574
		exit 1
577
		exit 1
575
		;;
578
		;;
576
esac
579
esac
577
 
580