diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2022-05-17 21:30:50 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2022-05-28 13:20:13 +0000 |
commit | e990b2f4c045f5d1be02915ec7d8869d5475ed4e (patch) | |
tree | 47d28c45e5cabe54ec9507e9bc44e894ab4b8b2d /data/templates | |
parent | 9347dc53c5bd3d5712121524ea16f3030d735601 (diff) | |
download | vyos-1x-e990b2f4c045f5d1be02915ec7d8869d5475ed4e.tar.gz vyos-1x-e990b2f4c045f5d1be02915ec7d8869d5475ed4e.zip |
firewall: T970: Add firewall group domain-group
Domain group allows to filter addresses by domain main
Resolved addresses as elements are stored to named "nft set"
that used in the nftables rules
Also added a dynamic "resolver" systemd daemon
vyos-domain-group-resolve.service which starts python script
for the domain-group addresses resolving by timeout 300 sec
set firewall group domain-group DOMAINS address 'example.com'
set firewall group domain-group DOMAINS address 'example.org'
set firewall name FOO rule 10 action 'drop'
set firewall name FOO rule 10 source group domain-group 'DOMAINS'
set interfaces ethernet eth0 firewall local name 'FOO'
nft list table ip filter
table ip filter {
set DOMAINS {
type ipv4_addr
flags interval
elements = { 192.0.2.1, 192.0.2.85,
203.0.113.55, 203.0.113.58 }
}
chain NAME_FOO {
ip saddr @DOMAINS counter packets 0 bytes 0 drop comment "FOO-10"
counter packets 0 bytes 0 return comment "FOO default-action accept"
}
}
Diffstat (limited to 'data/templates')
-rw-r--r-- | data/templates/firewall/nftables.j2 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/data/templates/firewall/nftables.j2 b/data/templates/firewall/nftables.j2 index fac3fad03..1f88ae40c 100644 --- a/data/templates/firewall/nftables.j2 +++ b/data/templates/firewall/nftables.j2 @@ -45,6 +45,14 @@ table ip filter { {{ conf | nft_default_rule(name_text) }} } {% endfor %} +{% if group is vyos_defined and group.domain_group is vyos_defined %} +{% for name, name_config in group.domain_group.items() %} + set {{ name }} { + type ipv4_addr + flags interval + } +{% endfor %} +{% endif %} {% for set_name in ns.sets %} set RECENT_{{ set_name }} { type ipv4_addr |