Subversion Repositories ALCASAR

Rev

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

Rev 672 Rev 673
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-conf.sh 672 2011-07-08 15:34:22Z richard $
2
# $Id: alcasar-conf.sh 673 2011-07-11 20:26:36Z richard $
3
# $Author: richard $
-
 
4
 
3
 
5
# alcasar-conf.sh
4
# alcasar-conf.sh
6
# by Richard REY
5
# by Richard REY
7
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
8
 
7
 
Line 253... Line 252...
253
			then 
252
			then 
254
			echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
253
			echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
255
			exit 0
254
			exit 0
256
		fi
255
		fi
257
		DNS1=`grep DNS1 $CONF_FILE|cut -d"=" -f2`
256
		DNS1=`grep DNS1 $CONF_FILE|cut -d"=" -f2`
258
		check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
257
		check=$(echo $DNS1 | egrep $PTN)
259
		if [[ "$?" -ne 0 ]]
258
		if [[ "$?" -ne 0 ]]
260
		then 
259
		then 
261
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
260
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
262
			exit 0
261
			exit 0
263
		fi
262
		fi
264
		DNS2=`grep DNS2 $CONF_FILE|cut -d"=" -f2`
263
		DNS2=`grep DNS2 $CONF_FILE|cut -d"=" -f2`
265
		check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
264
		check=$(echo $DNS2 | egrep $PTN)
266
		if [[ "$?" -ne 0 ]]
265
		if [[ "$?" -ne 0 ]]
267
		then 
266
		then 
268
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
267
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
269
			exit 0
268
			exit 0
270
		fi
269
		fi
Line 324... Line 323...
324
		$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" /var/www/html/intercept.php /var/www/html/status.php
323
		$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" /var/www/html/intercept.php /var/www/html/status.php
325
# awstat
324
# awstat
326
		$SED "s?^HostAliases=.*?HostAliases=\"$PRIVATE_IP\"?g" /etc/awstats/awstats.conf
325
		$SED "s?^HostAliases=.*?HostAliases=\"$PRIVATE_IP\"?g" /etc/awstats/awstats.conf
327
# dnsmasq
326
# dnsmasq
328
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf
327
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf
329
		$SED "s?^server=.*?server=$DNS1?g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf
328
		for i in /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf
-
 
329
		do
-
 
330
			$SED "/^server=/d" $i
-
 
331
			echo "server=$DNS1" >> $i
330
		$SED "/$DNS1/!s?^server=.*?server=$DNS2?g" /etc/dnsmasq.conf /etc/dnsmasq-blackhole.conf
332
			echo "server=$DNS2" >> $i
-
 
333
		done
331
		$SED "s?^dhcp-range=.*?dhcp-range=$PRIVATE_DYN_FIRST_IP,$PRIVATE_DYN_LAST_IP,$PRIVATE_NETMASK,12h?g" /etc/dnsmasq.conf
334
		$SED "s?^dhcp-range=.*?dhcp-range=$PRIVATE_DYN_FIRST_IP,$PRIVATE_DYN_LAST_IP,$PRIVATE_NETMASK,12h?g" /etc/dnsmasq.conf
332
		$SED "s?^dhcp-option=option:router.*?dhcp-option=option:router,$PRIVATE_IP?g" /etc/dnsmasq.conf
335
		$SED "s?^dhcp-option=option:router.*?dhcp-option=option:router,$PRIVATE_IP?g" /etc/dnsmasq.conf
333
# DG + BL
336
# DG + BL
334
		$SED "s?^IP_RETOUR=.*?IP_RETOUR=\"$PRIVATE_IP\"?g" $DIR_SBIN/alcasar-bl.sh
337
		$SED "s?^IP_RETOUR=.*?IP_RETOUR=\"$PRIVATE_IP\"?g" $DIR_SBIN/alcasar-bl.sh
335
		$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/dansguardian/dansguardian.conf
338
		$SED "s?^filterip.*?filterip = $PRIVATE_IP?g" /etc/dansguardian/dansguardian.conf