Iptables.php
authorAlan Knowles <alan@akbkhome.com>
Fri, 29 Mar 2013 06:36:01 +0000 (14:36 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 29 Mar 2013 06:36:01 +0000 (14:36 +0800)
Iptables.php

index 0a9d077..442d214 100644 (file)
@@ -207,6 +207,28 @@ class Pman_Admin_Iptables extends Pman {
 
         
     }
+    
+    
+    function createBase()
+    {
+        
+        $iptables = System::which('iptables');
+        if (!$iptables) {
+            $this->jerr("iptables could not be found.");
+        }
+        $this->exec("{$iptables} -F postgres"); // flush old
+        $this->exec("{$iptables} -N postgres");  // create new..
+        
+        $this->exec($iptables. ' -A postgres -m limit --limit 2/min -j LOG '.
+                        '--log-prefix "IPTables-Dropped: " --log-level 4');
+        $this->exec("$iptables -A postgres -j DROP");  
+
+        
+        
+        
+        
+    }
+    
     function exec($cmd) {
         echo "$cmd\n";
         echo `$cmd`;