Id like to overwrite public URLs to point to internal IP addresses using Zentyal DNS. The goal is for all requests to an address eg www.example.com to be routed to an internal server eg http://192.168.1.255 .
This works when I alter the files in /etc/bind, but the changes are lost with each restart. I have tried to create a stub for these changes in "/etc/zentyal/stubs/bind" but the configurations changes are not recognized on module restart or reboot.
How do I make the BIND/DNS changes persist across module restarts, reboots and software updates?
I realised no BIND stubs exist, the configurations in /etc/bind are created from the DNS stubs in /usr/share/zentyal/stubs/dns/. I kludged a solution borrowing Ubuntu tips from -> https://www.redpill-linpro.com/sysadvent/2015/12/08/dns-rpz.html
Create in there a file called db.rpz with the following contents:
$TTL 60
@ IN SOA localhost. root.localhost. (
2015112501 ; serial
1h ; refresh
30m ; retry
1w ; expiry
30m) ; minimum
IN NS localhost.
localhost A 127.0.0.1
www.some-website.com A 127.0.0.1
www.other-website.com CNAME fake-hostname.com.
make a "dns" directory in /etc/zentyal/stubs
sudo mkdir /etc/zentyal/stubs/dns
Copy "named.conf.local.mas" and "named.conf.options.mas" from "/usr/share/zentyal/stubs/dns/" to "etc/zentyal/stubs/dns" to cd /usr/share/zentyal/stubs/dns/
sudo cp named.conf.local.mas /etc/zentyal/stubs/dns
sudo cp named.conf.options.mas /etc/zentyal/stubs/dns
Edit named.conf.local.mas (inside /etc/zentyal/stubs/dns) and add this section:
zone "rpz" {
type master;
file "/etc/bind/db.rpz";
};
Edit named.conf.options.mas (inside /etc/zentyal/stubs/dns) and somewhere in the options { } section add the response-policyoption:
options {
// bunch
// of
// stuff
// please
// ignore
response-policy { zone "rpz"; };
}
Restart the DNS module in Zentyal.
sudo sudo zs dns restart
This will rewrite the "named.conf.options" and "named.conf.local" files in side "/etc/bind" each time the module is restarted (eg on reboot or module restart). The changes should persist across reboots and Zentyal upgrades.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.