diff --git a/src/iptables_wrapper.rs b/src/iptables_wrapper.rs index 4293d8d..d7ffa7f 100644 --- a/src/iptables_wrapper.rs +++ b/src/iptables_wrapper.rs @@ -121,6 +121,13 @@ pub fn secure_port( return Err("Err gathering secure port rule".into()); } + let position = if docker && position.is_none() { + let all_docker_rules = iptables.list("filter", &chain).unwrap(); + Some(all_docker_rules.len() as i32 - 1) + } else { + position + }; + let rule = rule.unwrap(); if let Some(position) = position { insert_unique(&iptables, table, &chain, &rule, position)