bundles/openssh: move iptables rules to metadata reactor
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-03-21 10:37:28 +01:00
parent b943d2d465
commit c9f008ad82
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 14 additions and 6 deletions

View file

@ -1 +0,0 @@
iptables_both -A INPUT -p tcp --dport 22 -j ACCEPT

View file

@ -21,11 +21,6 @@ files = {
'action:iptables_enforce', 'action:iptables_enforce',
}, },
}, },
'/etc/iptables-rules.d/00-defaults': {
'triggers': {
'action:iptables_enforce',
},
},
} }
for bundle, rules in node.metadata.get('iptables/bundle_rules', {}).items(): for bundle, rules in node.metadata.get('iptables/bundle_rules', {}).items():

View file

@ -1,3 +1,5 @@
from bundlewrap.metadata import atomic
defaults = { defaults = {
'apt': { 'apt': {
'packages': { 'packages': {
@ -12,3 +14,15 @@ defaults = {
}, },
}, },
} }
@metadata_reactor.provides(
'iptables/port_rules/22',
)
def iptables(metadata):
return {
'iptables': {
'port_rules': {
'22': atomic(metadata.get('openssh/restrict-to', set('*'))),
},
},
}