diff options
author | Christian Breunig <christian@breunig.cc> | 2023-09-08 17:36:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-08 17:36:17 +0200 |
commit | a12559a728310f0e3bf6dc18f7bd2a0ba444b890 (patch) | |
tree | 88d443e9961763c5ee0f922e9f68433d24f76e1e /data/templates/firewall/nftables-bridge.j2 | |
parent | 28ccebeac2ee4390d7c109a8a2da6b24769ab113 (diff) | |
parent | 1772c0a7232789e6eeb0caa78fe630fab899522d (diff) | |
download | vyos-1x-a12559a728310f0e3bf6dc18f7bd2a0ba444b890.tar.gz vyos-1x-a12559a728310f0e3bf6dc18f7bd2a0ba444b890.zip |
Merge pull request #2222 from nicolas-fort/T4072-fwall-bridge
T4072: add firewall bridge filtering.
Diffstat (limited to 'data/templates/firewall/nftables-bridge.j2')
-rw-r--r-- | data/templates/firewall/nftables-bridge.j2 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/data/templates/firewall/nftables-bridge.j2 b/data/templates/firewall/nftables-bridge.j2 new file mode 100644 index 000000000..7f94e10d6 --- /dev/null +++ b/data/templates/firewall/nftables-bridge.j2 @@ -0,0 +1,35 @@ +{% macro bridge(bridge) %} +{% set ns = namespace(sets=[]) %} +{% if bridge.forward is vyos_defined %} +{% for prior, conf in bridge.forward.items() %} +{% set def_action = conf.default_action %} + chain VYOS_FORWARD_{{ prior }} { + type filter hook forward priority {{ prior }}; policy {{ def_action }}; +{% if conf.rule is vyos_defined %} +{% for rule_id, rule_conf in conf.rule.items() if rule_conf.disable is not vyos_defined %} + {{ rule_conf | nft_rule('FWD', prior, rule_id, 'bri') }} +{% if rule_conf.recent is vyos_defined %} +{% set ns.sets = ns.sets + ['FWD_' + prior + '_' + rule_id] %} +{% endif %} +{% endfor %} +{% endif %} + } +{% endfor %} +{% endif %} + +{% if bridge.name is vyos_defined %} +{% for name_text, conf in bridge.name.items() %} + chain NAME_{{ name_text }} { +{% if conf.rule is vyos_defined %} +{% for rule_id, rule_conf in conf.rule.items() if rule_conf.disable is not vyos_defined %} + {{ rule_conf | nft_rule('NAM', name_text, rule_id, 'bri') }} +{% if rule_conf.recent is vyos_defined %} +{% set ns.sets = ns.sets + ['NAM_' + name_text + '_' + rule_id] %} +{% endif %} +{% endfor %} +{% endif %} + {{ conf | nft_default_rule(name_text) }} + } +{% endfor %} +{% endif %} +{% endmacro %} |