summaryrefslogtreecommitdiff
path: root/data/templates/firewall/nftables-geoip-update.j2
blob: 832ccc3e901c19b99c0be2cc3387f155dc731981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/sbin/nft -f

{% if ipv4_sets is vyos_defined %}
{%     for setname, ip_list in ipv4_sets.items() %}
flush set ip vyos_filter {{ setname }}
{%     endfor %}

table ip vyos_filter {
{%     for setname, ip_list in ipv4_sets.items() %}
    set {{ setname }} {
        type ipv4_addr
        flags interval
        elements = { {{ ','.join(ip_list) }} }
    }
{%     endfor %}
}
{% endif %}

{% if ipv6_sets is vyos_defined %}
{%     for setname, ip_list in ipv6_sets.items() %}
flush set ip6 vyos_filter {{ setname }}
{%     endfor %}

table ip6 vyos_filter {
{%     for setname, ip_list in ipv6_sets.items() %}
    set {{ setname }} {
        type ipv6_addr
        flags interval
        elements = { {{ ','.join(ip_list) }} }
    }
{%     endfor %}
}
{% endif %}