bundles/postfix: add SPAM BLOCKLISt for every non-private IP attached to the server
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
aad1a742b7
commit
f9bd2d695d
1 changed files with 10 additions and 11 deletions
|
@ -20,10 +20,6 @@ defaults = {
|
|||
|
||||
if node.has_bundle('postfixadmin'):
|
||||
defaults['icinga2_api']['postfix']['services'].update({
|
||||
'SPAM BLOCKLIST': {
|
||||
'check_command': 'spam_blocklist',
|
||||
# vars.ip will be filled using a metadata reactor
|
||||
},
|
||||
'SMTP CONNECT': {
|
||||
'check_command': 'check_smtp',
|
||||
},
|
||||
|
@ -42,17 +38,20 @@ else:
|
|||
|
||||
@metadata_reactor
|
||||
def fill_icinga_spam_blocklist_check_with_hostname(metadata):
|
||||
if not node.has_bundle('postfixadmin'):
|
||||
raise DoNotRunAgain
|
||||
checks = {}
|
||||
|
||||
for variant, ips in repo.libs.tools.resolve_identifier(repo, node.name).items():
|
||||
for ip in ips:
|
||||
if not ip.is_private:
|
||||
checks[f'SPAM BLOCKLIST {ip}'] = {
|
||||
'check_command': 'check_rbl',
|
||||
'vars.ip': str(ip),
|
||||
}
|
||||
|
||||
return {
|
||||
'icinga2_api': {
|
||||
'postfix': {
|
||||
'services': {
|
||||
'SPAM BLOCKLIST': {
|
||||
'vars.ip': metadata.get('postfix/myhostname', metadata.get('hostname', node.hostname)),
|
||||
},
|
||||
},
|
||||
'services': checks,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue