2021-06-03 11:57:50 +00:00
|
|
|
if node.has_bundle('pacman'):
|
|
|
|
package = 'pkg_pacman:nftables'
|
|
|
|
else:
|
|
|
|
package = 'pkg_apt:nftables'
|
|
|
|
|
|
|
|
directories = {
|
|
|
|
# used by other bundles
|
|
|
|
'/etc/nftables-rules.d': {
|
|
|
|
'purge': True,
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:nftables:reload',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
|
|
|
'/etc/nftables.conf': {
|
|
|
|
'needs': {
|
|
|
|
'directory:/etc/nftables-rules.d',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:nftables:reload',
|
|
|
|
},
|
|
|
|
},
|
2021-06-04 05:27:49 +00:00
|
|
|
'/etc/systemd/system/nftables.service.d/bundlewrap.conf': {
|
|
|
|
'source': 'override.conf',
|
2022-03-13 13:13:59 +00:00
|
|
|
'content_type': 'mako',
|
2021-06-04 05:27:49 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:nftables:reload',
|
|
|
|
},
|
|
|
|
},
|
2021-06-03 11:57:50 +00:00
|
|
|
}
|
|
|
|
|
2021-12-14 13:03:13 +00:00
|
|
|
for ruleset, rules in node.metadata.get('nftables/rules', {}).items():
|
|
|
|
files[f'/etc/nftables-rules.d/{ruleset}'] = {
|
|
|
|
'source': 'rules-template',
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'rules': rules,
|
|
|
|
},
|
|
|
|
'needed_by': {
|
|
|
|
'svc_systemd:nftables',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:nftables:reload',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-06-03 11:57:50 +00:00
|
|
|
svc_systemd = {
|
|
|
|
'nftables': {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/nftables.conf',
|
|
|
|
package,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|