bundles/nftables: store rules in dedicated files instead of nftables.conf
This commit is contained in:
parent
1742f51778
commit
0101e0c92d
11 changed files with 77 additions and 102 deletions
|
@ -37,20 +37,18 @@ def get_static_allocations(metadata):
|
|||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'nftables/rules/input/dhcpd',
|
||||
'nftables/rules/10-dhcpd',
|
||||
)
|
||||
def nftables(metadata):
|
||||
rules = set()
|
||||
for iface in node.metadata.get('dhcpd/subnets', {}):
|
||||
rules.add(f'udp dport {{ 67, 68 }} iif {iface} accept')
|
||||
rules.add(f'inet filter input udp dport {{ 67, 68 }} iif {iface} accept')
|
||||
|
||||
return {
|
||||
'nftables': {
|
||||
'rules': {
|
||||
'input': {
|
||||
# can't use port_rules here, because we're generating interface based rules.
|
||||
'dhcpd': sorted(rules),
|
||||
},
|
||||
# can't use port_rules here, because we're generating interface based rules.
|
||||
'10-dhcpd': sorted(rules),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue