bundles/nfs-server: add iptables config
This commit is contained in:
parent
626075ee94
commit
62f7080db9
1 changed files with 24 additions and 0 deletions
|
@ -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),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue