host_firewall: forwarded tcp/25 is egress only when it leaves through an uplink

This commit is contained in:
2026-11-15 09:25:32 +00:00
parent f32e6930f5
commit b3aaf9062d
+7 -5
View File
@@ -516,13 +516,15 @@ table inet host {
{% endif %}
{% endfor %}
{% if firewall.block_smtp_out %}
{% set smtp_oif = ('oifname { "' ~ (uplink_ifaces | join('", "')) ~ '" } ') if uplink_ifaces else '' %}
# Pod, container and guest egress to tcp/25 is rejected like the host's own (chain output). Connections DNATed to
# a mail host (ct status dnat) and traffic inside the cluster ring (nodes, pods) pass.
ct status & dnat == 0 ip daddr != @cluster_v4 tcp dport 25 limit rate {{ firewall.log.out_rate }} log prefix "fw-out-reject: "
ct status & dnat == 0 ip daddr != @cluster_v4 tcp dport 25 reject with tcp reset
ct status & dnat == 0 ip6 daddr != @cluster_v6 tcp dport 25 limit rate {{ firewall.log.out_rate }} log prefix "fw-out-reject: "
ct status & dnat == 0 ip6 daddr != @cluster_v6 tcp dport 25 reject with tcp reset
# a mail host (ct status dnat) and traffic inside the cluster ring (nodes, pods) pass. With uplinks configured
# only packets leaving through one are egress: a scan forwarded from the uplink to a guest is not.
ct status & dnat == 0 {{ smtp_oif }}ip daddr != @cluster_v4 tcp dport 25 limit rate {{ firewall.log.out_rate }} log prefix "fw-out-reject: "
ct status & dnat == 0 {{ smtp_oif }}ip daddr != @cluster_v4 tcp dport 25 reject with tcp reset
ct status & dnat == 0 {{ smtp_oif }}ip6 daddr != @cluster_v6 tcp dport 25 limit rate {{ firewall.log.out_rate }} log prefix "fw-out-reject: "
ct status & dnat == 0 {{ smtp_oif }}ip6 daddr != @cluster_v6 tcp dport 25 reject with tcp reset
{% endif %}
{% if forward_policy != 'accept' %}