Subversion Repositories ALCASAR

Rev

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

Rev 3088 Rev 3099
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-dns-local.sh 3088 2022-11-06 22:55:08Z rexy $
2
# $Id: alcasar-dns-local.sh 3099 2022-12-28 11:30:30Z 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 31... Line 31...
31
	echo "$usage"
31
	echo "$usage"
32
	exit 1
32
	exit 1
33
fi
33
fi
34
 
34
 
35
function restart_dns(){
35
function restart_dns(){
36
	for dns in unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole
36
	for dns in unbound unbound-blacklist unbound-whitelist unbound-blackhole
37
	do
37
	do
38
		echo "Restarting $dns. Please wait..."
38
		echo "Restarting $dns. Please wait..."
39
		systemctl restart $dns
39
		systemctl restart $dns
40
	done
40
	done
41
}
41
}
Line 98... Line 98...
98
		;;
98
		;;
99
	--hosts_to_unbound|-hosts_to_unbound)
99
	--hosts_to_unbound|-hosts_to_unbound)
100
			hosts_to_unbound
100
			hosts_to_unbound
101
		;;
101
		;;
102
	--off|-off) # disable DNS redirector
102
	--off|-off) # disable DNS redirector
103
		#$SED "s?^#filterwin2k.*?filterwin2k?g" $DNSMASQ_CONF_FILE
-
 
104
		rm -f $LOCAL_DOMAIN_CONF_FILE
103
		rm -f $LOCAL_DOMAIN_CONF_FILE
105
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE
104
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE
106
		restart_dns
105
		restart_dns
107
		/usr/local/bin/alcasar-iptables.sh
106
		/usr/local/bin/alcasar-iptables.sh
108
		;;
107
		;;
109
	--off-without-restart|-off-without-restart) # disable DNS redirector
108
	--off-without-restart|-off-without-restart) # disable DNS redirector
110
		#$SED "s?^#filterwin2k.*?filterwin2k?g" $DNSMASQ_CONF_FILE
-
 
111
		rm -f $LOCAL_DOMAIN_CONF_FILE
109
		rm -f $LOCAL_DOMAIN_CONF_FILE
112
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE
110
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=off?g" $ALCASAR_CONF_FILE
113
		/usr/local/bin/alcasar-iptables.sh
111
		/usr/local/bin/alcasar-iptables.sh
114
		;;
112
		;;
115
	--on|-on) # enable DNS redirector
113
	--on|-on) # enable DNS redirector
116
		#$SED "s?^filterwin2k.*?#filterwin2k?g" $DNSMASQ_CONF_FILE
-
 
117
		cat > $LOCAL_DOMAIN_CONF_FILE << EOF
114
		cat > $LOCAL_DOMAIN_CONF_FILE << EOF
118
server:
115
server:
119
    local-zone: "$INT_DNS_DOMAIN." transparent
116
    local-zone: "$INT_DNS_DOMAIN." transparent
120
forward-zone:
117
forward-zone:
121
	name: "$INT_DNS_DOMAIN."
118
	name: "$INT_DNS_DOMAIN."
Line 124... Line 121...
124
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=on?g" $ALCASAR_CONF_FILE
121
		$SED "s?^INT_DNS_ACTIVE.*?INT_DNS_ACTIVE=on?g" $ALCASAR_CONF_FILE
125
		restart_dns
122
		restart_dns
126
		/usr/local/bin/alcasar-iptables.sh
123
		/usr/local/bin/alcasar-iptables.sh
127
		;;
124
		;;
128
	--on-without-restart|-on-without-restart) # enable DNS redirector
125
	--on-without-restart|-on-without-restart) # enable DNS redirector
129
		#$SED "s?^filterwin2k.*?#filterwin2k?g" $DNSMASQ_CONF_FILE
-
 
130
		cat > $LOCAL_DOMAIN_CONF_FILE << EOF
126
		cat > $LOCAL_DOMAIN_CONF_FILE << EOF
131
server:
127
server:
132
    local-zone: "$INT_DNS_DOMAIN." transparent
128
    local-zone: "$INT_DNS_DOMAIN." transparent
133
forward-zone:
129
forward-zone:
134
	name: "$INT_DNS_DOMAIN."
130
	name: "$INT_DNS_DOMAIN."