18 lines
632 B
Django/Jinja
18 lines
632 B
Django/Jinja
{% macro render_ipset(ipset, name, type="hash:net", family="inet", timeout=None) %}
|
|
create {{ name }} {{ type | default('hash:net') }} family {{ family }} counters {% if timeout %}timeout {{ timeout }}{% endif %} -exist
|
|
flush {{ name }}
|
|
{% if ipset | length %}
|
|
{% for ip_or_net in ipset | ipv4 %}
|
|
add {{ name }} {{ ip_or_net }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{{ render_ipset(firewall_ipset_mgmt, 'mgmt_v4') }}
|
|
|
|
{{ render_ipset(firewall_ipset_blacklist, 'blacklist_v4') }}
|
|
|
|
{{ render_ipset(firewall_ipset_bogons, 'bogons_v4') }}
|
|
|
|
{{ render_ipset([], 'cooloff_v4', type="hash:ip", timeout=firewall_ipset_cooloff_timeout) }}
|