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

index 2375e52..6dff09c 100644 (file)
@@ -173,21 +173,32 @@ class Pman_Admin_Iptables extends Pman {
                 if (strtotime($expires) <= strtotime($old['expires'])) {
                     // expires time is the same..
                     //?? make sure it's not flagged for removal..
+                    
                     continue;
                 }
             }
             
             if ($old) {
                 $this->exec("{$iptables} -R postgres {$old['num']} -s {$ip}/32 -j ACCEPT --comment ".
-                    escapeshellarg(json_encode(array('expires'=>$expires))
+                    escapeshellarg(json_encode(array('expires'=>$expires));
+                
+                if (isset($remove[$ip])) {
+                    unset($remove[$ip]);
+                }
                 continue;
             }
             
             $this->exec("{$iptables} -I postgres {$lastrulenum} -s {$ip}/32 -j ACCEPT --comment ".
                     escapeshellarg(json_encode(array('expires'=>$expires))
+            
                                    
         }
         
+        // remove rules that need deleting..
+        foreach($remove as $r) {
+            
+        }
+        
         
         $this->exec($iptables. ' -A postgres -m limit --limit 2/min -j LOG '.
                         '--log-prefix "IPTables-Dropped: " --log-level 4');