31 lines
654 B
Python
31 lines
654 B
Python
from bundlewrap.metadata import atomic
|
|
|
|
defaults = {
|
|
'apt': {
|
|
'packages': {
|
|
'nfs-kernel-server': {}
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
@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),
|
|
},
|
|
},
|
|
}
|