diff options
-rw-r--r-- | packages/tinydns/tinydns.inc | 32 | ||||
-rw-r--r-- | packages/tinydns/tinydns_sync.xml | 30 |
2 files changed, 61 insertions, 1 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index e1012334..6fc4f522 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -477,6 +477,38 @@ function tinydns_do_xmlrpc_sync($sync_to_ip, $password) { } else { log_error("tinydns XMLRPC sync successfully completed with {$url}:{$port}."); } + + /* tell tinydns to reload our settings on the destionation sync host. */ + + $method = 'pfsense.exec_php'; + + $execcmd = "require('/usr/local/pkg/tinydns.inc');\n"; + $execcmd .= "tinydns_custom_php_changeip_command();\n"; + $execcmd .= "tinydns_custom_php_install_command();\n"; + $execcmd .= "tinydns_create_zone_file();\n"; + $execcmd .= "tinydns_setup_ping_items();\n"; + + /* assemble xmlrpc payload */ + $params = array( + XML_RPC_encode($password), + XML_RPC_encode($execcmd) + ); + + $resp = $cli->send($msg, "250"); + if(!$resp) { + $error = "A communications error occured while attempting tinydns XMLRPC sync with {$url}:{$port}."; + log_error($error); + file_notice("sync_settings", $error, "tinydns Settings Sync", ""); + } elseif($resp->faultCode()) { + $cli->setDebug(1); + $resp = $cli->send($msg, "250"); + $error = "An error code was received while attempting tinydns XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + log_error($error); + file_notice("sync_settings", $error, "tinydns Settings Sync", ""); + } else { + log_error("tinydns XMLRPC sync successfully completed with {$url}:{$port}."); + } + log_error("[tinydns] tinydns_xmlrpc_sync.php is ending."); } diff --git a/packages/tinydns/tinydns_sync.xml b/packages/tinydns/tinydns_sync.xml index 2156aaba..82c04897 100644 --- a/packages/tinydns/tinydns_sync.xml +++ b/packages/tinydns/tinydns_sync.xml @@ -90,8 +90,36 @@ <description>Admin password on remote firewall to faciliate sync</description> <type>password</type> </field> + <field> + <fielddescr>IP Address 2</fielddescr> + <fieldname>ipaddress2</fieldname> + <description>OPTIONAL. The IP address that TinyDNS will Sync its data to.</description> + <type>input</type> + </field> + <field> + <fielddescr>Password</fielddescr> + <fieldname>password2</fieldname> + <description>Admin password on remote firewall to faciliate sync</description> + <type>password</type> + </field> + <field> + <fielddescr>IP Address 3</fielddescr> + <fieldname>ipaddress</fieldname> + <description>OPTIONAL. The IP address that TinyDNS will Sync its data to.</description> + <type>input</type> + </field> + <field> + <fielddescr>Password 3</fielddescr> + <fieldname>password3</fieldname> + <description>Admin password on remote firewall to faciliate sync</description> + <type>password</type> + </field> </fields> <custom_php_resync_config_command> tinydns_do_xmlrpc_sync($_POST['ipaddress'], $_POST['password']); + if($_POST['ipaddress2]) + tinydns_do_xmlrpc_sync($_POST['ipaddress2'], $_POST['password2']); + if($_POST['ipaddress3]) + tinydns_do_xmlrpc_sync($_POST['ipaddress3'], $_POST['password3']); </custom_php_resync_config_command> -</packagegui> +</packagegui>
\ No newline at end of file |