insert PVEFW-IPS after vm rules generation v2
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 12 May 2014 13:19:16 +0000 (15:19 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 13 May 2014 12:26:57 +0000 (14:26 +0200)
or it never match it

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/Firewall.pm

index ce8d3fb..31b9ad1 100644 (file)
@@ -2576,8 +2576,7 @@ sub compile {
     # fixme: what log level should we use here?
     my $loglevel = get_option_log_level($hostfw_options, "log_level_out");
 
-    my $accept = ruleset_chain_exist($ruleset, "PVEFW-IPS") ? "PVEFW-IPS" : "ACCEPT";
-    ruleset_chain_add_conn_filters($ruleset, "PVEFW-FORWARD", $accept);
+    ruleset_chain_add_conn_filters($ruleset, "PVEFW-FORWARD", "ACCEPT");
 
     if ($cluster_conf->{ipset}->{blacklist}){
        ruleset_addlog($ruleset, "PVEFW-FORWARD", 0, "DROP: ", $loglevel, "-m set --match-set PVEFW-blacklist src");
@@ -2659,6 +2658,10 @@ sub compile {
        }
     }
 
+    if(ruleset_chain_exist($ruleset, "PVEFW-IPS")){
+       ruleset_insertrule($ruleset, "PVEFW-FORWARD", "-m conntrack --ctstate RELATED,ESTABLISHED -j PVEFW-IPS");
+    }
+
     return ($ruleset, $ipset_ruleset);
 }