1
0
Fork 0
forked from infra/ansible

nftables: Fix table name scoping issue.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill 2026-06-01 17:42:12 -04:00
commit 4a6fc0fdf5
10 changed files with 58 additions and 12 deletions

View file

@ -2,12 +2,6 @@
# _nft_accept_beg
# Setup an ip filter table with default accept policy, and the std. allow rules.
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
add table {{_tn}}
add chain {{_tn}} INPUT { type filter hook input priority 0; policy accept; }
add chain {{_tn}} FORWARD { type filter hook forward priority 0; policy accept; }

View file

@ -5,12 +5,6 @@
# Note that there's no _nft_drop_end because _nft_accept_end drops everything
# and we don't need that.
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
add table {{_tn}}
add chain {{_tn}} INPUT { type filter hook input priority 0; policy drop; }
add chain {{_tn}} FORWARD { type filter hook forward priority 0; policy drop; }

View file

@ -1,6 +1,15 @@
# {{ ansible_managed }}
# {{ template_path }}
# NOTE: This needs to be done at the top level because include inherits
# variables, but set variables don't escape.
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_drop_beg' %}
{% include '_nft_drop_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}

View file

@ -1,6 +1,13 @@
# {{ ansible_managed }}
# {{ template_path }}
# Set small Table Names.
# We need the big global ones so we can use them in *_rules but, that would be
# a lot in these files.
{% set _tn = nft_table_filter %}
{% set _tnat = nft_table_nat %}
{% include '_nft_accept_beg' %}
{% include '_nft_accept_std' %}