diff options
Diffstat (limited to 'config/bind')
-rw-r--r-- | config/bind/bind.inc | 40 | ||||
-rw-r--r-- | config/bind/bind_zones.xml | 7 |
2 files changed, 37 insertions, 10 deletions
diff --git a/config/bind/bind.inc b/config/bind/bind.inc index e680099f..ff3728fb 100644 --- a/config/bind/bind.inc +++ b/config/bind/bind.inc @@ -105,10 +105,10 @@ function bind_zone_validate($post, $input_errors){ exec("$rndc_confgen ",$rndc_conf); foreach($rndc_conf as $line) $confgen_file.="$line\n"; - file_put_contents(BIND_LOCALBASE."/etc/rndc-confgen.pfsese",$confgen_file); + file_put_contents(BIND_LOCALBASE."/etc/rndc-confgen.pfsense",$confgen_file); } - if (file_exists(BIND_LOCALBASE."/etc/rndc-confgen.pfsese")){ - $rndc_conf=file(BIND_LOCALBASE."/etc/rndc-confgen.pfsese"); + if (file_exists(BIND_LOCALBASE."/etc/rndc-confgen.pfsense")){ + $rndc_conf=file(BIND_LOCALBASE."/etc/rndc-confgen.pfsense"); $confgen="rndc.conf"; $rndc_bindconf=""; foreach ($rndc_conf as $line){ @@ -179,8 +179,8 @@ EOD; $listenon=(pfSense_get_interface_addresses(convert_friendly_interface_to_real_interface_name($listenon))); if (is_ipaddr($listenon['ipaddr'])) $bind_listenon .= $listenon['ipaddr']."; "; - elseif(is_ipaddrv6($listenon['ipaddr'])) - $bind_listenonv6 .= $listenon['ipaddr']."; "; + if(is_ipaddrv6($listenon['ipaddr6'])) + $bind_listenonv6 .= $listenon['ipaddr6']."; "; } } } @@ -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"])){ @@ -429,12 +432,20 @@ EOD; $hostname = (preg_match("/(MX|NS)/",$zone['row'][$y]['hosttype'])?"@":$zone['row'][$y]['hostname']); $hosttype = $zone['row'][$y]['hosttype']; $hostdst = $zone['row'][$y]['hostdst']; - if (preg_match("/[a-zA-Z]/",$hostdst) && $hosttype !="TXT") + if (preg_match("/[a-zA-Z]/",$hostdst) && !preg_match("/(TXT|SPF|AAAA)/",$hosttype)) $hostdst .= "."; $hostvalue = $zone['row'][$y]['hostvalue']; $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"; } @@ -578,10 +589,15 @@ EOD; chown(CHROOT_LOCALBASE."/var/log","bind"); chown(CHROOT_LOCALBASE."/var/run/named","bind"); chgrp(CHROOT_LOCALBASE."/var/log","bind"); - if($bind_enable == "on") - mwexec("/usr/local/etc/rc.d/named.sh restart"); - else - mwexec("/usr/local/etc/rc.d/named.sh stop"); + $bind_sh="/usr/local/etc/rc.d/named.sh"; + if($bind_enable == "on"){ + chmod ($bind_sh,0755); + mwexec("{$bind_sh} restart"); + } + elseif (is_service_running('named')){ + mwexec("{$bind_sh} stop"); + chmod ($bind_sh,0644); + } //sync to backup servers bind_sync_on_changes(); conf_mount_ro(); @@ -604,6 +620,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; @@ -620,6 +637,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; @@ -636,6 +654,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; @@ -652,6 +671,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 7fde01a7..be4da9cf 100644 --- a/config/bind/bind_zones.xml +++ b/config/bind/bind_zones.xml @@ -364,6 +364,7 @@ <option><name>SRV</name><value>SRV</value></option> <option><name>PTR</name><value>PTR</value></option> <option><name>TXT</name><value>TXT</value></option> + <option><name>SPF</name><value>SPF</value></option> </options> </rowhelperfield> <rowhelperfield> @@ -384,6 +385,12 @@ </rowhelper> </field> <field> + <fieldname>regdhcpstatic</fieldname> + <fielddescr>Register DHCP static mappings</fielddescr> + <description>If this option is set, then DHCP static mappings will be registered in DNS, so that their name can be resolved.</description> + <type>checkbox</type> + </field> + <field> <type>listtopic</type> <name>Custom Zone Domain records</name> <fieldname>temp02</fieldname> |