Subversion Repositories ALCASAR

Rev

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

Rev 2964 Rev 3088
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-dns-local.sh 2964 2021-07-04 09:23:08Z rexy $
2
# $Id: alcasar-dns-local.sh 3088 2022-11-06 22:55:08Z rexy $
3
 
3
 
4
# alcasar-dns-local.sh
4
# alcasar-dns-local.sh
5
# by Rexy - 3abtux
5
# by Rexy - 3abtux
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 41... Line 41...
41
}
41
}
42
 
42
 
43
function hosts_to_unbound(){  # configure the unbound conf file with local host names resolution
43
function hosts_to_unbound(){  # configure the unbound conf file with local host names resolution
44
		cat << EOF > $LOCAL_DNS_FILE
44
		cat << EOF > $LOCAL_DNS_FILE
45
server:
45
server:
46
	local-data: "$INT_DNS_HOST.$INT_DNS_DOMAIN A $INT_DNS_IP"
46
	local-data: "$INT_DNS_HOST.$INT_DNS_DOMAIN IN A $INT_DNS_IP"
47
	local-data-ptr: "$INT_DNS_IP $INT_DNS_HOST.$INT_DNS_DOMAIN"
47
	local-data-ptr: "$INT_DNS_IP $INT_DNS_HOST.$INT_DNS_DOMAIN"
48
EOF
48
EOF
49
	while read -r line
49
	while read -r line
50
	do
50
	do
51
		ip_address=$(echo $line | awk '{ print $1 }')
51
		ip_address=$(echo $line | awk '{ print $1 }')
52
		domain=$(echo $line | awk '{ print $2 }')
52
		domain=$(echo $line | awk '{ print $2 }')
53
		if ! echo $line | grep -E -q "^([0-9\.\t ]+alcasar( |$)|127\.0\.0)"
53
		if ! echo $line | grep -E -q "^([0-9\.\t ]+alcasar( |$)|127\.0\.0)"
54
		then
54
		then
55
			echo -e "\tlocal-data: \"$domain.$INT_DNS_DOMAIN A $ip_address\"" >> $LOCAL_DNS_FILE
55
			echo -e "\tlocal-data: \"$domain.$INT_DNS_DOMAIN IN A $ip_address\"" >> $LOCAL_DNS_FILE
56
			echo -e "\tlocal-data-ptr: \"$ip_address $domain.$INT_DNS_DOMAIN\"" >> $LOCAL_DNS_FILE
56
			echo -e "\tlocal-data-ptr: \"$ip_address $domain.$INT_DNS_DOMAIN\"" >> $LOCAL_DNS_FILE
57
		fi
57
		fi
58
	done < $LOCAL_HOSTNAME_FILE
58
	done < $LOCAL_HOSTNAME_FILE
-
 
59
	if [ $INT_DNS_DOMAIN == "localdomain" ]
-
 
60
	then
-
 
61
		echo -e "\tlocal-zone: \"$INT_DNS_DOMAIN\" static" >> $LOCAL_DNS_FILE  # Don't forward this local zone
-
 
62
	fi
59
}
63
}
60
 
64
 
61
case $args in
65
case $args in
62
	-\? | -h | --h)
66
	-\? | -h | --h)
63
		echo "$usage"
67
		echo "$usage"