Consolidate nftables setup for alpine, debian and ceph roles
This commit is contained in:
parent
bfda7b3236
commit
0d60aa107f
8 changed files with 76 additions and 52 deletions
22
templates/services.nft.j2
Normal file
22
templates/services.nft.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
table inet filter {
|
||||
chain input {
|
||||
{% for service in services %}
|
||||
{% set prefixes = service | allowed_prefixes %}
|
||||
{% set ports = service.ports | compact_numlist %}
|
||||
{% if 'name' in service %}
|
||||
# service {{ service.name }}
|
||||
{% endif %}
|
||||
{% if prefixes %}
|
||||
{% if prefixes | ipv4 %}
|
||||
ip saddr { {{ prefixes | ipv4 | join(', ') }} } {{ service.protocol.value }} dport { {{ ports }} } accept
|
||||
{% endif %}
|
||||
{% if prefixes | ipv6 %}
|
||||
ip6 saddr { {{ prefixes | ipv6 | join(', ') }} } {{ service.protocol.value }} dport { {{ ports }} } accept
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ service.protocol.value }} dport { {{ ports }} } accept
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue