Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Explicitly allow inbound traffic on FORWARD chain
Browse files Browse the repository at this point in the history
Nested warden forwards both inbound and outbound traffic on interfaces
that match the "w-+" wildcard. This means that inbound traffic is
dropped by default. This change makes sure that traffic that comes in
via the default outbound interface is always allowed.
  • Loading branch information
David Sabeti and Pieter Noordhuis committed Apr 5, 2013
1 parent e932f25 commit b1cb5f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions warden/root/linux/net.sh
Expand Up @@ -100,7 +100,12 @@ function setup_filter() {
iptables -A ${filter_default_chain} --destination "$n" --jump DROP iptables -A ${filter_default_chain} --destination "$n" --jump DROP
done done


# Forward outbound traffic via ${filter_forward_chain}
iptables -A FORWARD -i w-+ --jump ${filter_forward_chain} iptables -A FORWARD -i w-+ --jump ${filter_forward_chain}

# Forward inbound traffic immediately
default_interface=$(ip route show | grep default | cut -d' ' -f5 | head -1)
iptables -I ${filter_forward_chain} -i $default_interface --jump ACCEPT
} }


function teardown_nat() { function teardown_nat() {
Expand Down
2 changes: 1 addition & 1 deletion warden/root/linux/skeleton/net.sh
Expand Up @@ -38,7 +38,7 @@ function setup_filter() {
--goto ${filter_default_chain} --goto ${filter_default_chain}


# Bind instance chain to forward chain # Bind instance chain to forward chain
iptables -I ${filter_forward_chain} \ iptables -I ${filter_forward_chain} 2 \
--in-interface ${network_host_iface} \ --in-interface ${network_host_iface} \
--goto ${filter_instance_chain} --goto ${filter_instance_chain}
} }
Expand Down

0 comments on commit b1cb5f3

Please sign in to comment.