2024-06-05 13:37:45 +00:00
|
|
|
table inet filter {
|
|
|
|
chain input {
|
|
|
|
{% for service in services %}
|
|
|
|
{% set prefixes = service | allowed_prefixes %}
|
|
|
|
{% set ports = service.ports | compact_numlist %}
|
2024-06-19 11:33:32 +00:00
|
|
|
{% if 'name' in service %}
|
2024-06-05 13:37:45 +00:00
|
|
|
# service {{ service.name }}
|
2024-06-19 11:33:32 +00:00
|
|
|
{% endif %}
|
2024-08-03 09:44:03 +00:00
|
|
|
{% if prefixes %}
|
|
|
|
{% if prefixes | ipv4 %}
|
|
|
|
ip saddr { {{ prefixes | ipv4 | join(', ') }} } {{ service.protocol.value }} dport { {{ ports }} } accept
|
2024-06-05 13:37:45 +00:00
|
|
|
{% endif %}
|
2024-08-03 09:44:03 +00:00
|
|
|
{% if prefixes | ipv6 %}
|
|
|
|
ip6 saddr { {{ prefixes | ipv6 | join(', ') }} } {{ service.protocol.value }} dport { {{ ports }} } accept
|
2024-06-05 13:37:45 +00:00
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
tcp dport { {{ ports }} } accept
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
}
|