WillyXJ / facileManager

A modular suite of web apps built with the sysadmin in mind.
www.facilemanager.com
GNU General Public License v2.0
87 stars 37 forks source link

[ISSUE] fmDNS truncates slave cache files during build config #574

Closed millallo closed 1 year ago

millallo commented 1 year ago

fM Version : 4.3.0 fmDNS Version : 5.2.1

In raising this issue, I confirm the following (please check boxes, eg [X]):


(BUG | ISSUE) Expected Behavior: Bind cache files on slave servers should not be truncated when building a new configuration.

(BUG | ISSUE) Actual Behavior: I have a hidden master and slave dns authoritative for some zones. If I change some options and build the config all file inside of /var/cache/bind/slave folder are emptied. Bind continues to run on slave without any issue but if I restart it, it renames all truncated files like db-* and recreates all cache files asking them to master server. But what if the master is down? I mean, is it correct to empty the cache while bind is running? I think it's correct to create an empty cache only if cache files don't exist.

(BUG | ISSUE) Steps to reproduce: Build configuration to a running slave.

Comment This is the temporary patch i use:

--- a/server/fm-modules/fmDNS/classes/class_buildconf.php
+++ b/server/fm-modules/fmDNS/classes/class_buildconf.php
@@ -929,6 +929,7 @@ class fm_module_buildconf extends fm_shared_module_buildconf {
                                                        $zones .= $this->getZoneOptions(array($zone_result[$i]->domain_id, $zone_result[$i]->parent_domain_id, $zone_result[$i]->domain_template_id), $server_serial_no, $domain_type, $server_group_ids). (string) $auto_zone_options;
                                                        /** Build zone file */
                                                        $zone_file_contents = ($domain_type == 'master') ? $this->buildZoneFile($zone_result[$i], $server_serial_no) : null;
+                                                 if($zone_file_contents!=null) //avoid truncation
                                                        $files[$zone_data_dir . '/' . $domain_type . '/' . $domain_name_file] = array('contents' => $zone_file_contents, 'syntax_check' => $zone_result[$i]->domain_check_config);
                                                        unset($zone_file_contents);
                                                        break;
WillyXJ commented 1 year ago

I think you're right and thanks for the patch.

WillyXJ commented 1 year ago

This is now fixed in fmDNS 5.3.1 and later.