From 48ebcfa9b56921dc0470f43504a9bd3426cf1953 Mon Sep 17 00:00:00 2001 From: Jean Cyr Date: Sun, 10 Nov 2013 01:19:50 -0500 Subject: bind - optionally add static dhcp leases at zone A records Similar to 'unbound' feature to avoid the need to duplicate static host addresses in both DHCP and BIND. - Add 'Register DHCP static mappings' checkbox to zone form - if checked, enumerate all static DHCP hosts and add to zone, such that their name can be resolved. --- config/bind/bind.inc | 12 ++++++++++++ config/bind/bind_zones.xml | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/bind/bind.inc b/config/bind/bind.inc index a288dcfb..436f352e 100644 --- a/config/bind/bind.inc +++ b/config/bind/bind.inc @@ -435,6 +435,14 @@ EOD; $zone_conf .= "$hostname \t IN $hosttype $hostvalue \t$hostdst\n"; } + if (($zone[regdhcpstatic] == 'on') && is_array($config['dhcpd'])) { + foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) + if(is_array($dhcpifconf['staticmap']) && isset($dhcpifconf['enable'])) + foreach ($dhcpifconf['staticmap'] as $host) + if ($host['ipaddr'] && $host['hostname']) { + $zone_conf .= "{$host['hostname']}\tIN A\t{$host['ipaddr']}\n"; + } + } if ($zone['customzonerecords']!=""){ $zone_conf .= "\n\n;\n;custom zone records\n;\n".base64_decode($zone['customzonerecords'])."\n"; } @@ -609,6 +617,7 @@ function bind_print_javascript_type_zone(){ document.iform.forwarders.disabled = 1; document.iform.dnssec.disabled = 0; document.iform.backupkeys.disabled = 0; + document.iform.regdhcpstatic.disabled = 0; document.iform.ipns.disabled = 0; document.iform.mail.disabled = 0; document.iform.serial.disabled = 0; @@ -625,6 +634,7 @@ function bind_print_javascript_type_zone(){ document.iform.forwarders.disabled = 1; document.iform.dnssec.disabled = 0; document.iform.backupkeys.disabled = 0; + document.iform.regdhcpstatic.disabled = 0; document.iform.ipns.disabled = 1; document.iform.mail.disabled = 1; document.iform.serial.disabled = 1; @@ -641,6 +651,7 @@ function bind_print_javascript_type_zone(){ document.iform.forwarders.disabled = 0; document.iform.dnssec.disabled = 1; document.iform.backupkeys.disabled = 1; + document.iform.regdhcpstatic.disabled = 1; document.iform.ipns.disabled = 1; document.iform.mail.disabled = 1; document.iform.serial.disabled = 1; @@ -657,6 +668,7 @@ function bind_print_javascript_type_zone(){ document.iform.forwarders.disabled = 1; document.iform.dnssec.disabled = 1; document.iform.backupkeys.disabled = 1; + document.iform.regdhcpstatic.disabled = 1; document.iform.ipns.disabled = 1; document.iform.mail.disabled = 0; document.iform.serial.disabled = 0; diff --git a/config/bind/bind_zones.xml b/config/bind/bind_zones.xml index 77893417..d5cbe1b8 100644 --- a/config/bind/bind_zones.xml +++ b/config/bind/bind_zones.xml @@ -72,7 +72,6 @@ Zones /pkg.php?xml=bind_zones.xml&id=0 - Sync @@ -384,6 +383,12 @@ on + + regdhcpstatic + Register DHCP static mappings + If this option is set, then DHCP static mappings will be registered in DNS, so that their name can be resolved. + checkbox + listtopic Custom Zone Domain records -- cgit v1.2.3 From 7bef8eca7511523919bbb2cb084e010d67c8fd94 Mon Sep 17 00:00:00 2001 From: Jean Cyr Date: Sun, 10 Nov 2013 11:55:54 -0500 Subject: Disable logging should not mean default logging - Prevent bind from flooding logs when 'enable logging' is not checked. --- config/bind/bind.inc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config') diff --git a/config/bind/bind.inc b/config/bind/bind.inc index 436f352e..146632c9 100644 --- a/config/bind/bind.inc +++ b/config/bind/bind.inc @@ -238,6 +238,9 @@ EOD; $bind_conf .="\t\t};\n\n"; } } + else { + $bind_conf .="\t\tlogging { category default { null; }; };\n\n"; + } #Config Zone domain if(!is_array($config["installedpackages"]["bindacls"]) || !is_array($config["installedpackages"]["bindacls"]["config"])){ -- cgit v1.2.3