Subversion Repositories ALCASAR

Rev

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

Rev 1377 Rev 1419
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-conf.sh 1377 2014-06-10 22:16:50Z richard $
2
# $Id: alcasar-conf.sh 1419 2014-07-24 15:40:16Z richard $
3
 
3
 
4
# alcasar-conf.sh
4
# alcasar-conf.sh
5
# by REXY
5
# by REXY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 261... Line 261...
261
				$DIR_SBIN/alcasar-dhcp.sh --off
261
				$DIR_SBIN/alcasar-dhcp.sh --off
262
			fi
262
			fi
263
# Logout everybody
263
# Logout everybody
264
			$DIR_SBIN/alcasar-logout.sh all		
264
			$DIR_SBIN/alcasar-logout.sh all		
265
# Services stop
265
# Services stop
266
			for i in squid ntpd chilli httpd network
266
			for i in ntpd chilli httpd network
267
			do
267
			do
268
				[ -e /etc/init.d/$i ] && /etc/init.d/$i stop && killall $i 2>/dev/null
268
				systemctl stop $i && echo "$i stopped"
269
			done
269
			done
270
		fi
270
		fi
271
 
271
 
272
# /etc/hosts
272
# /etc/hosts
273
		cat <<EOF > /etc/hosts
273
		cat <<EOF > /etc/hosts
Line 287... Line 287...
287
sshd: ALL
287
sshd: ALL
288
ntpd: $PRIVATE_NETWORK_SHORT
288
ntpd: $PRIVATE_NETWORK_SHORT
289
EOF
289
EOF
290
# Alcasar Control Center
290
# Alcasar Control Center
291
		$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
291
		$SED "s?^Listen.*?Listen $PRIVATE_IP:80?g" /etc/httpd/conf/httpd.conf
292
		FIC_MOD_SSL=`find /etc/httpd/modules.d/ -type f -name *mod_ssl.conf`
292
		FIC_MOD_SSL=`find /etc/httpd/conf/ -type f -name ssl.conf`
293
		$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" $FIC_MOD_SSL
293
		$SED "s?^Listen.*?Listen $PRIVATE_IP:443?g" $FIC_MOD_SSL
294
		$SED "/127.0.0.1/!s?Allow from .*?Allow from $PRIVATE_NETWORK_MASK?g" /etc/httpd/conf/webapps.d/alcasar.conf
294
		$SED "/127.0.0.1/!s?Allow from .*?Allow from $PRIVATE_NETWORK_MASK?g" /etc/httpd/conf/webapps.d/alcasar.conf
295
# Dialup_Admin
295
# Dialup_Admin
296
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
296
		$SED "s?^nas1_name:.*?nas1_name: alcasar-$ORGANISME?g" /etc/freeradius-web/naslist.conf
297
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
297
		$SED "s?^nas1_ip:.*?nas1_ip: $PRIVATE_IP?g" /etc/freeradius-web/naslist.conf
298
# coova
298
# coova
299
		$SED "s?ifconfig.*?ifconfig \$HS_LANIF $PRIVATE_IP?g" /etc/init.d/chilli
299
		#$SED "s?ifconfig.*?ifconfig \$HS_LANIF $PRIVATE_IP?g" /etc/init.d/chilli
300
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
300
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
301
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
301
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
302
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
302
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
303
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
303
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
304
# dhcp (coova + dnsmasq)
304
# dhcp (coova + dnsmasq)
305
		$DIR_SBIN/alcasar-dhcp.sh -$DHCP_mode
305
		$DIR_SBIN/alcasar-dhcp.sh -$DHCP_mode
306
# dnsmasq
306
# dnsmasq
307
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
307
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
308
		for i in /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
308
		for i in /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
309
		do
309
		do
310
			$SED "/^server=/d" $i
310
			$SED "/^server=/d" $i
311
			echo "server=$DNS1" >> $i
311
			echo "server=$DNS1" >> $i
312
			echo "server=$DNS2" >> $i
312
			echo "server=$DNS2" >> $i
Line 327... Line 327...
327
# sudoers
327
# sudoers
328
		$SED "s?^Host_Alias.*?Host_Alias	LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost		#réseau de l'organisme?g" /etc/sudoers
328
		$SED "s?^Host_Alias.*?Host_Alias	LAN_ORG=$PRIVATE_NETWORK/$PRIVATE_NETMASK,localhost		#réseau de l'organisme?g" /etc/sudoers
329
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
329
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
330
		then
330
		then
331
# Services start
331
# Services start
332
			for i in network squid ntpd chilli httpd 
332
			for i in network ntpd chilli httpd
333
			do
333
			do
334
				[ -e /etc/init.d/$i ] && /etc/init.d/$i start
334
				systemctl start $i && echo "$i started"
335
			done
335
			done
336
# Reload BL (restart DG, dnsmasq & iptables)
336
# Reload BL (restart DG, dnsmasq & iptables)
337
			$DIR_SBIN/alcasar-bl.sh -reload
337
			$DIR_SBIN/alcasar-bl.sh -reload
338
		fi
338
		fi
339
# Start / Stop SSH Daemon
339
# Start / Stop SSH Daemon