diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-06-12 09:32:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 09:32:27 +0200 |
commit | 59526a8adca2922f42778d7563bc0ddc32cfdda8 (patch) | |
tree | 37068db2932e20ed4aec01329c9e60d16eb769ed /data/templates/firewall/nftables-geoip-update.j2 | |
parent | fe18efba34c5d95d3052c9e6fda69668bbfe63f3 (diff) | |
parent | 8ba45cfcc1cc3fba57e1f82fa1299b7c253ba5ea (diff) | |
download | vyos-1x-59526a8adca2922f42778d7563bc0ddc32cfdda8.tar.gz vyos-1x-59526a8adca2922f42778d7563bc0ddc32cfdda8.zip |
Merge pull request #1357 from sarthurdev/geoip
firewall: T4299: Add support for GeoIP filtering
Diffstat (limited to 'data/templates/firewall/nftables-geoip-update.j2')
-rw-r--r-- | data/templates/firewall/nftables-geoip-update.j2 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/data/templates/firewall/nftables-geoip-update.j2 b/data/templates/firewall/nftables-geoip-update.j2 new file mode 100644 index 000000000..f9e61a274 --- /dev/null +++ b/data/templates/firewall/nftables-geoip-update.j2 @@ -0,0 +1,33 @@ +#!/usr/sbin/nft -f + +{% if ipv4_sets is vyos_defined %} +{% for setname, ip_list in ipv4_sets.items() %} +flush set ip filter {{ setname }} +{% endfor %} + +table ip 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 filter {{ setname }} +{% endfor %} + +table ip6 filter { +{% for setname, ip_list in ipv6_sets.items() %} + set {{ setname }} { + type ipv6_addr + flags interval + elements = { {{ ','.join(ip_list) }} } + } +{% endfor %} +} +{% endif %} |