bundles/nfs-server: add iptables config

This commit is contained in:
Franzi 2021-03-21 11:24:21 +01:00
parent 626075ee94
commit 62f7080db9
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -1,3 +1,5 @@
from bundlewrap.metadata import atomic
defaults = {
'apt': {
'packages': {
@ -5,3 +7,25 @@ defaults = {
},
},
}
@metadata_reactor.provides(
'iptables/port_rules',
)
def iptables(metadata):
ips = set()
for share_items in metadata.get('nfs-server/shares', {}).values():
for share_target in share_items:
ips.add(share_target.split('(', 2)[0])
return {
'iptables': {
'port_rules': {
'111': atomic(ips),
'111/udp': atomic(ips),
'2049': atomic(ips),
'35295': atomic(ips),
},
},
}