From 28548bf4b4d13c2729722900a81d3a9cfe59d435 Mon Sep 17 00:00:00 2001
From: latham <latham@ispconfig3>
Date: Fri, 01 Jul 2011 12:13:16 -0400
Subject: [PATCH] Add IPTables to monitoring data and monitoring interface

---
 server/lib/classes/monitor_tools.inc.php |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 3d17880..02ffadd 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -1127,6 +1127,40 @@
 		return $res;
 	}
 
+	public function monitorIPTables() {
+        global $conf;
+
+        /* the id of the server as int */
+        $server_id = intval($conf['server_id']);
+
+        /** The type of the data */
+        $type = 'iptables_rules';
+
+        /* This monitoring is only available if fail2ban is installed */
+        system('which iptables', $retval); // Debian, Ubuntu, Fedora
+        if ($retval === 0) {
+            /*  Get the data of the log */
+            $data['output'] = shell_exec('iptables -S');
+
+            /*
+             * At this moment, there is no state (maybe later)
+             */
+            $state = 'no_state';
+        } else {
+            $state = 'no_state';
+            $data = '';
+        }
+
+        /*
+         * Return the Result
+         */
+        $res['server_id'] = $server_id;
+        $res['type'] = $type;
+        $res['data'] = $data;
+        $res['state'] = $state;
+        return $res;
+    }
+
 	public function monitorSysLog() {
 		global $app;
 		global $conf;

--
Gitblit v1.9.1