2021-04-03 07:36:47 +00:00
|
|
|
from bundlewrap.metadata import atomic
|
|
|
|
|
|
|
|
|
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'mosquitto': {},
|
|
|
|
'mosquitto-clients': {},
|
|
|
|
},
|
|
|
|
},
|
2021-04-03 07:43:24 +00:00
|
|
|
'icinga2_api': {
|
|
|
|
'mosquitto': {
|
|
|
|
'services': {
|
|
|
|
'MOSQUITTO PROCESS': {
|
|
|
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C mosquitto -c 1:',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-04-03 07:36:47 +00:00
|
|
|
'mosquitto': {
|
|
|
|
'listeners': {
|
|
|
|
'1883': {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
|
|
'iptables/port_rules',
|
|
|
|
)
|
|
|
|
def iptables(metadata):
|
|
|
|
sources = metadata.get('mosquitto/restrict-to', {'*'})
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
for listener in metadata.get('mosquitto/listeners').keys():
|
|
|
|
result[listener] = atomic(sources)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'iptables': {
|
|
|
|
'port_rules': result,
|
|
|
|
},
|
|
|
|
}
|