host_firewall: forward_policy defaults to drop

This commit is contained in:
2026-11-12 12:14:31 +00:00
parent e5a56b61d9
commit a6e1657363
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -131,10 +131,10 @@ firewall:
# forwarding hosts (Kubernetes with Cilium, Docker, routing peers) otherwise route packets for foreign destinations that # forwarding hosts (Kubernetes with Cilium, Docker, routing peers) otherwise route packets for foreign destinations that
# the datacenter sends to them back out. An uplink (see above) is already covered and left out. # the datacenter sends to them back out. An uplink (see above) is already covered and left out.
no_reflect: {} no_reflect: {}
# Forward chain default. accept: forwarded traffic passes unless a rule above drops it. log: traffic that no accept rule # Forward chain default. drop: forwarded traffic that no rule admits (replies, DNATed connections, trusted interfaces:
# (replies, DNATed connections, trusted interfaces: wt0, cluster, internal and guest ifaces, routed_v6 bridges) admits is # wt0, cluster, internal and guest ifaces, routed_v6 bridges, forward_ifaces, pod interfaces) is logged with fw-fwd-drop:
# logged with fw-fwd-drop: and counted, to find the interfaces a host still needs. drop: the same traffic is dropped. # and dropped. log: the same, but nothing is dropped. accept: no tail, forwarded traffic passes unless a rule above drops it.
forward_policy: accept forward_policy: drop
# Interfaces (name -> interface, wildcards allowed) whose forwarded traffic is accepted without trusting their input, # Interfaces (name -> interface, wildcards allowed) whose forwarded traffic is accepted without trusting their input,
# e.g. a transit bridge to a guest that only needs routing. # e.g. a transit bridge to a guest that only needs routing.
forward_ifaces: {} forward_ifaces: {}
+1 -1
View File
@@ -12,7 +12,7 @@
- name: Check the forward policy - name: Check the forward policy
ansible.builtin.assert: ansible.builtin.assert:
that: firewall.forward_policy | default('accept', true) in ['accept', 'log', 'drop'] that: firewall.forward_policy | default('drop', true) in ['accept', 'log', 'drop']
fail_msg: "firewall.forward_policy is {{ firewall.forward_policy }}, expected accept, log or drop" fail_msg: "firewall.forward_policy is {{ firewall.forward_policy }}, expected accept, log or drop"
- name: Remove the include block of the old nftables role - name: Remove the include block of the old nftables role
+2 -2
View File
@@ -444,7 +444,7 @@ table inet host {
ip6 saddr @geo_v6 accept ip6 saddr @geo_v6 accept
{% endif %} {% endif %}
} }
{% set forward_policy = firewall.forward_policy | default('accept', true) %} {% set forward_policy = firewall.forward_policy | default('drop', true) %}
{% set forward_ifaces = firewall.forward_ifaces | default({}, true) | dict2items | rejectattr('value', 'none') | map(attribute='value') | unique | list %} {% set forward_ifaces = firewall.forward_ifaces | default({}, true) | dict2items | rejectattr('value', 'none') | map(attribute='value') | unique | list %}
{% set forward_trusted = (([] if 'external' in group_names else ['wt0']) + cluster_ifaces + internal_ifaces + guest_ifaces + forward_ifaces) | unique | list %} {% set forward_trusted = (([] if 'external' in group_names else ['wt0']) + cluster_ifaces + internal_ifaces + guest_ifaces + forward_ifaces) | unique | list %}
{% if forward_guard or blocklists or firewall.scanners or rl_forward or firewall.block_smtp_out or firewall.uplinks or no_reflect or forward_policy != 'accept' %} {% if forward_guard or blocklists or firewall.scanners or rl_forward or firewall.block_smtp_out or firewall.uplinks or no_reflect or forward_policy != 'accept' %}
@@ -529,7 +529,7 @@ table inet host {
# What is forwarded on purpose: replies, connections DNATed here, traffic that arrives on a trusted interface (mesh, # What is forwarded on purpose: replies, connections DNATed here, traffic that arrives on a trusted interface (mesh,
# cluster, internal and guest interfaces) and traffic to the pods (Cilium translates services before netfilter, so # cluster, internal and guest interfaces) and traffic to the pods (Cilium translates services before netfilter, so
# connections from outside arrive as client -> pod without ct status dnat). One rule per interface: a set that mixes # connections from outside arrive as client -> pod without ct status dnat). One rule per interface: a set that mixes
# wildcards and plain names did not match wt0. Everything else is logged and, with forward_policy drop, dropped. # wildcards and plain names did not match wt0. Everything else is logged (fw-fwd-drop:, the first place to look when a Cilium or network change breaks forwarding), counted and, with forward_policy drop, dropped. Reflected packets drop above, silently.
ct state established,related accept ct state established,related accept
ct status dnat accept ct status dnat accept
{% for iface in forward_trusted %} {% for iface in forward_trusted %}