Subversion Repositories ALCASAR

Rev

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

Rev 2830 Rev 2831
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2830 2020-06-04 20:02:48Z rexy $
2
# $Id: alcasar-conf.sh 2831 2020-06-07 21:43:19Z 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 368... Line 368...
368
		echo "server=$DNS2" >> /etc/dnsmasq-whitelist.conf
368
		echo "server=$DNS2" >> /etc/dnsmasq-whitelist.conf
369
# unbound
369
# unbound
370
		# removing unbound configuration files
370
		# removing unbound configuration files
371
		rm -f /etc/unbound/conf.d/{forward,blacklist,whitelist,blackhole}/iface.*
371
		rm -f /etc/unbound/conf.d/{forward,blacklist,whitelist,blackhole}/iface.*
372
		rm -f /etc/unbound/conf.d/common/forward-zone.conf
372
		rm -f /etc/unbound/conf.d/common/forward-zone.conf
373
		find /etc/unbound/conf.d/common/local-dns/ ! -name "global.conf" -type f -delete
-
 
374
		# Configuration file for the dns servers forward-zone
373
		# Configuration file for the dns servers forward-zone
375
		cat << EOF > /etc/unbound/conf.d/common/forward-zone.conf
374
		cat << EOF > /etc/unbound/conf.d/common/forward-zone.conf
376
forward-zone:
375
forward-zone:
377
	name: "."
376
	name: "."
378
	forward-addr: $DNS1
377
	forward-addr: $DNS1
379
	forward-addr: $DNS2
378
	forward-addr: $DNS2
380
EOF
379
EOF
381
		# Configuration file of ALCASAR main domains for $INTIF
380
		# Configuration file of ALCASAR main domains for $INTIF
382
		cat << EOF > /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
381
		cat << EOF > /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
383
server:
382
server:
384
	local-zone: "$HOSTNAME.$DOMAIN" static
383
	local-zone: "$DOMAIN" static
385
	local-data: "$HOSTNAME.$DOMAIN A $PRIVATE_IP"
384
	local-data: "$HOSTNAME.$DOMAIN A $PRIVATE_IP"
386
	local-zone: "$HOSTNAME" static
-
 
387
	local-data: "$HOSTNAME A $PRIVATE_IP"
385
	local-data-ptr: "$PRIVATE_IP $HOSTNAME.$DOMAIN"
388
EOF
386
EOF
389
		if [ "$HOSTNAME" != 'alcasar' ]
387
		if [ "$HOSTNAME" != 'alcasar' ]
390
		then
388
		then
391
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
389
			echo -e "\tlocal-zone: \"alcasar\" static" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
392
			echo -e "\tlocal-zone: \"alcasar A $PRIVATE_IP\"" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
390
			echo -e "\tlocal-zone: \"alcasar A $PRIVATE_IP\"" >> /etc/unbound/conf.d/common/local-dns/${INTIF}.conf
Line 398... Line 396...
398
server:
396
server:
399
	interface: 127.0.0.1@53
397
	interface: 127.0.0.1@53
400
	access-control-view: 127.0.0.1/8 lo
398
	access-control-view: 127.0.0.1/8 lo
401
view:
399
view:
402
	name: "lo"
400
	name: "lo"
403
	view-first: yes
-
 
404
	local-zone: "$HOSTNAME.$DOMAIN" static
401
	local-zone: "$DOMAIN" static
405
	local-data: "$HOSTNAME.$DOMAIN A 127.0.0.1"
402
	local-data: "$HOSTNAME.$DOMAIN A 127.0.0.1"
406
	local-zone: "$HOSTNAME" static
-
 
407
	local-data: "$HOSTNAME A 127.0.0.1"
-
 
408
	local-zone: "$DOMAIN." static
-
 
409
	local-data: "$DOMAIN. A"
403
	view-first: yes
410
EOF
404
EOF
411
		# Configuration file for $INTIF of forward
405
		# Configuration file for $INTIF of forward
412
		cat << EOF > /etc/unbound/conf.d/forward/iface.${INTIF}.conf
406
		cat << EOF > /etc/unbound/conf.d/forward/iface.${INTIF}.conf
413
server:
407
server:
414
	interface: ${PRIVATE_IP}@53
408
	interface: ${PRIVATE_IP}@53
415
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
409
	access-control-view: $PRIVATE_NETWORK_MASK $INTIF
416
 
-
 
417
view:
410
view:
418
	name: "$INTIF"
411
	name: "$INTIF"
419
	view-first: yes
412
	view-first: yes
420
EOF
413
EOF
421
		# Configuration file for $INTIF of blacklist
414
		# Configuration file for $INTIF of blacklist