aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-12-09 02:17:20 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-12-09 02:17:20 +0000
commit630533c484ff6ffc735b70b064efc041100a2b9f (patch)
treef7575db04072dffaa3673e68e0eacc02b18f9ff0 /packages
parentb785493b8a4bd99a98844b3a67c43c63ee47c2fb (diff)
downloadpfsense-packages-630533c484ff6ffc735b70b064efc041100a2b9f.tar.gz
pfsense-packages-630533c484ff6ffc735b70b064efc041100a2b9f.tar.bz2
pfsense-packages-630533c484ff6ffc735b70b064efc041100a2b9f.zip
* Cleanup status
* Import XMLRPC file
Diffstat (limited to 'packages')
-rw-r--r--packages/tinydns/tinydns_status.php28
-rw-r--r--packages/tinydns/tinydns_xmlrpc_sync.php111
2 files changed, 138 insertions, 1 deletions
diff --git a/packages/tinydns/tinydns_status.php b/packages/tinydns/tinydns_status.php
index a35d6b5b..f8ddda61 100644
--- a/packages/tinydns/tinydns_status.php
+++ b/packages/tinydns/tinydns_status.php
@@ -63,21 +63,31 @@ include("head.inc");
<tr>
<td width="80%" class="listhdrr">IP</td>
<td width="10%" class="listhdrr">Status</td>
+ <td width="10%" class="listhdrr">In Service</td>
<td width="10%" class="listhdrr">Response time</td>
</tr>
<?php
$pingdir = return_dir_as_array("/var/db/pingstatus");
+if(file_exists("/service/tinydns/root/data"))
+ $tinydns_data = file_get_contents("/service/tinydns/root/data");
+else
+ $tinydns_data = "";
foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) {
if($ping['recordtype'] == "SOA")
continue;
if(!$ping['row'])
continue;
$ipaddress = $ping['ipaddress'];
+ $hostname = $ping['hostname'];
$status = file_get_contents("/var/db/pingstatus/$ipaddress");
+ if(stristr($tinydns_data, $ipaddress))
+ $inservice = "<FONT COLOR='GREEN'>YES</FONT>";
+ else
+ $inservice = "<FONT COLOR='BLUE'>NO</FONT>";
echo "<tr>";
echo "<td class=\"listlr\">";
- echo $ipaddress;
+ echo "$hostname<br>$ipaddress";
echo "</td>";
echo "<td class=\"listlr\">";
if(stristr($status,"DOWN"))
@@ -85,6 +95,11 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) {
else
echo $status;
echo "</td>";
+
+ echo "<td class=\"listlr\">";
+ echo $inservice;
+ echo "</td>";
+
echo "<td class=\"listlr\">";
if(file_exists("/var/db/pingmsstatus/$ipaddress"))
$msstatus = file_get_contents("/var/db/pingmsstatus/$ipaddress");
@@ -100,6 +115,12 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) {
echo "<tr>";
echo "<td class=\"listlr\">&nbsp;&nbsp;&nbsp;&nbsp;|->&nbsp;&nbsp;";
echo $ipaddress;
+ if($row['loadbalance'])
+ echo " (LB)";
+ if(stristr($tinydns_data ,$row['failoverip']))
+ $inservice = "<FONT COLOR='GREEN'>YES</FONT>";
+ else
+ $inservice = "<FONT COLOR='BLUE'>NO</FONT>";
echo "</td>";
echo "<td class=\"listlr\">";
if(stristr($status,"DOWN"))
@@ -107,6 +128,11 @@ foreach($config['installedpackages']['tinydnsdomains']['config'] as $ping) {
else
echo $status;
echo "</td>";
+
+ echo "<td class=\"listlr\">";
+ echo $inservice;
+ echo "</td>";
+
echo "<td class=\"listlr\">";
if(file_exists("/var/db/pingmsstatus/$ipaddress"))
$msstatus = file_get_contents("/var/db/pingmsstatus/$ipaddress");
diff --git a/packages/tinydns/tinydns_xmlrpc_sync.php b/packages/tinydns/tinydns_xmlrpc_sync.php
new file mode 100644
index 00000000..6c6ef5a2
--- /dev/null
+++ b/packages/tinydns/tinydns_xmlrpc_sync.php
@@ -0,0 +1,111 @@
+<?php
+
+/* $Id$ */
+/*
+ tinydns_xmlrcpc_sync.php
+ Copyright (C) 2006 Scott Ullrich
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* NOTE: this file gets included from the pfSense filter.inc plugin process */
+
+require_once("/usr/local/pkg/tinydns.inc");
+require_once("service-utils.inc");
+
+if(!$config) {
+ log_error("\$config is not enabled!!");
+} else {
+ if(!$g['booting'])
+ tinydns_do_xmlrpc_sync();
+}
+
+function tinydns_do_xmlrpc_sync() {
+ global $config, $g;
+ $syncxmlrpc = $config['installedpackages']['tinydns']['config'][0]['syncxmlrpc'];
+ /* option enabled? */
+ if(!$syncxmlrpc)
+ return;
+
+ $carp = &$config['installedpackages']['carpsettings']['config'][0];
+ $password = $carp['password'];
+
+ if(!$carp['synchronizetoip'])
+ return;
+
+ log_error("[tinydns] tinydns_xmlrpc_sync.php is starting.");
+ $xmlrpc_sync_neighbor = $carp['synchronizetoip'];
+ if($config['system']['webgui']['protocol'] != "") {
+ $synchronizetoip = $config['system']['webgui']['protocol'];
+ $synchronizetoip .= "://";
+ }
+ $port = $config['system']['webgui']['port'];
+ /* if port is empty lets rely on the protocol selection */
+ if($port == "") {
+ if($config['system']['webgui']['protocol'] == "http") {
+ $port = "80";
+ } else {
+ $port = "443";
+ }
+ }
+ $synchronizetoip .= $carp['synchronizetoip'];
+
+ /* xml will hold the sections to sync */
+ $xml = array();
+ $xml['installedpackages']['tinydns'] = &$config['installedpackages']['tinydns'];
+ $xml['installedpackages']['tinydnswhitelist'] = &$config['installedpackages']['tinydnsdomains'];
+
+ /* assemble xmlrpc payload */
+ $params = array(
+ XML_RPC_encode($password),
+ XML_RPC_encode($xml)
+ );
+
+ /* set a few variables needed for sync code borrowed from filter.inc */
+ $url = $synchronizetoip;
+ $method = 'pfsense.restore_config_section';
+
+ /* Sync! */
+ log_error("Beginning tinydns XMLRPC sync to {$url}:{$port}.");
+ $msg = new XML_RPC_Message($method, $params);
+ $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
+ $cli->setCredentials('admin', $password);
+ if($g['debug'])
+ $cli->setDebug(1);
+ /* send our XMLRPC message and timeout after 240 seconds */
+ $resp = $cli->send($msg, "999");
+ 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()) {
+ $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.");
+}
+
+?> \ No newline at end of file