host_firewall: routed_v6 names the guest bridges IPv6 from an uplink may leave through, no address list
This commit is contained in:
@@ -121,9 +121,10 @@ firewall:
|
|||||||
# addresses of the subnet to the host; with ip_forward they would be forwarded and masqueraded with the host address.
|
# addresses of the subnet to the host; with ip_forward they would be forwarded and masqueraded with the host address.
|
||||||
# Not for hosts whose forwarded inbound traffic is not DNATed in netfilter (Cilium NodePorts are DNATed in BPF).
|
# Not for hosts whose forwarded inbound traffic is not DNATed in netfilter (Cilium NodePorts are DNATed in BPF).
|
||||||
uplinks: {}
|
uplinks: {}
|
||||||
# IPv6 prefixes routed to guests (name -> prefix). New forwarded connections that arrive on an uplink pass the uplink drop
|
# Guest bridges (name -> interface) that IPv6 traffic from an uplink may be routed out of; IPv6 has no DNAT. New forwarded
|
||||||
# when they are addressed to one of them; everything else still drops, so the host never routes foreign destinations back
|
# IPv6 connections that arrive on an uplink pass the uplink drop only when they leave through one of them, so the host
|
||||||
# out of the uplink. The guest firewalls decide about the ports.
|
# never routes foreign destinations back out of the uplink or into the mesh and other interfaces. The kernel routes the
|
||||||
|
# prefix of the guest bridge, so no address is listed. The guest firewalls decide about the ports. IPv4 stays DNAT only.
|
||||||
routed_v6: {}
|
routed_v6: {}
|
||||||
# Reject outbound TCP 25; the mail group turns it off.
|
# Reject outbound TCP 25; the mail group turns it off.
|
||||||
block_smtp_out: true
|
block_smtp_out: true
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ set {{ name }} {
|
|||||||
{% set journal_rule = list(journal.clients) and journal.port %}
|
{% set journal_rule = list(journal.clients) and journal.port %}
|
||||||
{% set scrapers = firewall.scrapers | default({}, true) %}
|
{% set scrapers = firewall.scrapers | default({}, true) %}
|
||||||
{% set forward_guard = firewall.forward_guard | default({}, true) | dict2items | rejectattr('value', 'none') | list %}
|
{% set forward_guard = firewall.forward_guard | default({}, true) | dict2items | rejectattr('value', 'none') | list %}
|
||||||
{% set routed_v6 = list(firewall.routed_v6) %}
|
{% set routed_v6 = firewall.routed_v6 | default({}, true) | dict2items | rejectattr('value', 'none') | map(attribute='value') | unique | list %}
|
||||||
{% set blocklists = firewall.spamhaus or firewall.firehol %}
|
{% set blocklists = firewall.spamhaus or firewall.firehol %}
|
||||||
{% macro port_values(map) -%}
|
{% macro port_values(map) -%}
|
||||||
{{ map | default({}, true) | dict2items | rejectattr('value', 'none') | map(attribute='value') | map('string') | unique | join(' ') }}
|
{{ map | default({}, true) | dict2items | rejectattr('value', 'none') | map(attribute='value') | map('string') | unique | join(' ') }}
|
||||||
@@ -496,9 +496,9 @@ table inet host {
|
|||||||
{% for name, iface in firewall.uplinks.items() if iface is not none %}
|
{% for name, iface in firewall.uplinks.items() if iface is not none %}
|
||||||
|
|
||||||
{% if routed_v6 %}
|
{% if routed_v6 %}
|
||||||
# {{ name }}: from outside only what was DNATed here, admitted by a forward_guard zone above or addressed to a routed IPv6 prefix.
|
# {{ name }}: from outside only what was DNATed here, admitted by a forward_guard zone above or, for IPv6, routed out of a guest bridge.
|
||||||
iifname "{{ iface }}" ct state new ct status & dnat == 0 meta nfproto ipv4 counter drop
|
iifname "{{ iface }}" ct state new ct status & dnat == 0 meta nfproto ipv4 counter drop
|
||||||
iifname "{{ iface }}" ct state new ct status & dnat == 0 ip6 daddr != { {{ routed_v6 }} } counter drop
|
iifname "{{ iface }}" ct state new ct status & dnat == 0 meta nfproto ipv6 oifname != { "{{ routed_v6 | join('", "') }}" } counter drop
|
||||||
{% else %}
|
{% else %}
|
||||||
# {{ name }}: from outside only what was DNATed here or admitted by a forward_guard zone above.
|
# {{ name }}: from outside only what was DNATed here or admitted by a forward_guard zone above.
|
||||||
iifname "{{ iface }}" ct state new ct status & dnat == 0 counter drop
|
iifname "{{ iface }}" ct state new ct status & dnat == 0 counter drop
|
||||||
|
|||||||
Reference in New Issue
Block a user