Subversion Repositories ALCASAR

Rev

Rev 2567 | Rev 2569 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2567 Rev 2568
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2567 2018-07-11 21:36:31Z rexy $
2
# $Id: alcasar-conf.sh 2568 2018-07-12 21:49:03Z rexy $
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
 
Line 261... Line 261...
261
				$DIR_BIN/alcasar-dhcp.sh --off
261
				$DIR_BIN/alcasar-dhcp.sh --off
262
			else
262
			else
263
			        $DIR_BIN/alcasar-dhcp.sh --on
263
			        $DIR_BIN/alcasar-dhcp.sh --on
264
			fi
264
			fi
265
 
265
 
266
# Implementation of the local DNS
266
# Set the local DNS (or not)
267
			if [ $INT_DNS_mode = "on" ] || [ $INT_DNS_mode = "On" ] || [ $INT_DNS_mode = "ON" ]
267
			if [ $INT_DNS_mode = "on" ] || [ $INT_DNS_mode = "On" ] || [ $INT_DNS_mode = "ON" ]
268
			then
268
			then
269
				$DIR_BIN/alcasar-dns-local.sh --on
269
				$DIR_BIN/alcasar-dns-local.sh --on
270
			else
270
			else
271
				$DIR_BIN/alcasar-dns-local.sh --off
271
				$DIR_BIN/alcasar-dns-local.sh --off
272
			fi
272
			fi
273
			
-
 
274
# Implementation of the authentification LDAP
-
 
275
#			if [ LDAP_mode = "on" ] || [ $LDAP_mode = "On" ] || [ $LDAP_mode = "ON" ]
-
 
276
#			then
-
 
277
#				$DIR_BIN/alcasar-ldap.sh
-
 
278
#			fi
-
 
279
 
273
 
280
# Logout everybody
274
# Logout everybody
281
			$DIR_BIN/alcasar-logout.sh all		
275
			$DIR_BIN/alcasar-logout.sh all		
282
# Services stop
276
# Services stop
283
			echo -n "Stop services : "
277
			echo -n "Stop services : "
Line 342... Line 336...
342
# /etc/hosts
336
# /etc/hosts
343
		cat <<EOF > /etc/hosts
337
		cat <<EOF > /etc/hosts
344
127.0.0.1	localhost
338
127.0.0.1	localhost
345
$PRIVATE_IP	$HOSTNAME
339
$PRIVATE_IP	$HOSTNAME
346
EOF
340
EOF
347
# Set hostname in CoovaChilli
-
 
348
		$SED "s/^uamallowed.*/uamallowed\t${domainNames// /,}/g" /etc/chilli.conf
-
 
349
		$SED "s/^locationname.*/locationname\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
-
 
350
		[ `grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2` == "on" ] && chilli_login_protocol="https" || chilli_login_protocol="http"
-
 
351
		$SED "s/^uamserver.*/uamserver\t$chilli_login_protocol:\/\/$HOSTNAME.$DOMAIN\/intercept.php/" /etc/chilli.conf
-
 
352
		$SED "s/^radiusnasid.*/radiusnasid\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
-
 
353
# Set hostname in Lighttpd
341
# Lighttpd
354
		$SED "s?^server\.bind.*?server\.bind = \"$HOSTNAME.$DOMAIN\"?g" /etc/lighttpd/lighttpd.conf
342
		$SED "s?^server\.bind.*?server\.bind = \"$HOSTNAME.$DOMAIN\"?g" /etc/lighttpd/lighttpd.conf
355
		$SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$HOSTNAME.$DOMAIN"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
343
		$SED 's/^$SERVER\["socket"\] == ".*:443.*/$SERVER\["socket"\] == "'"$HOSTNAME.$DOMAIN"':443" {/g' /etc/lighttpd/vhosts.d/alcasar.conf
356
		$SED "s/^\([\t ]*\)var.server_name.*/\1var.server_name = \"$HOSTNAME.$DOMAIN\"/g" /etc/lighttpd/vhosts.d/alcasar.conf
344
		$SED "s/^\([\t ]*\)var.server_name.*/\1var.server_name = \"$HOSTNAME.$DOMAIN\"/g" /etc/lighttpd/vhosts.d/alcasar.conf
357
# FreeRADIUS Web
345
# FreeRADIUS Web
358
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
346
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
359
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
347
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
360
# coova
348
# coova
-
 
349
		$SED "s/^uamallowed.*/uamallowed\t$HOSTNAME,$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
-
 
350
		$SED "s/^locationname.*/locationname\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
-
 
351
		[ `grep ^HTTPS_LOGIN= $CONF_FILE | cut -d'=' -f2` == "on" ] && chilli_login_protocol="https" || chilli_login_protocol="http"
-
 
352
		$SED "s/^uamserver.*/uamserver\t$chilli_login_protocol:\/\/$HOSTNAME.$DOMAIN\/intercept.php/" /etc/chilli.conf
-
 
353
		$SED "s/^radiusnasid.*/radiusnasid\t$HOSTNAME.$DOMAIN/g" /etc/chilli.conf
361
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
354
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
362
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
355
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
363
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
356
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
364
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
357
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
365
		# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
358
		# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
Line 421... Line 414...
421
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
414
			if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
422
			then
415
			then
423
				/usr/bin/systemctl stop sshd.service
416
				/usr/bin/systemctl stop sshd.service
424
			fi
417
			fi
425
		fi
418
		fi
-
 
419
# Start / Stop LDAP authentification
-
 
420
		if [ LDAP_mode = "on" ] || [ $LDAP_mode = "On" ] || [ $LDAP_mode = "ON" ]
-
 
421
		then
-
 
422
			$DIR_BIN/alcasar-ldap.sh
-
 
423
		fi
426
echo
424
		echo
427
		;;
425
		;;
428
	*)
426
	*)
429
		echo "Argument inconnu :$1";
427
		echo "Argument inconnu :$1";
430
		echo "$usage"
428
		echo "$usage"
431
		exit 1
429
		exit 1