bundles/icinga2: handle dig status messages in check_spam_blocklist

This commit is contained in:
Franzi 2023-09-09 14:10:27 +02:00
parent 8f500b121c
commit e029329a03
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -50,12 +50,18 @@ def check_list(ip_list, blocklist, warn_ips):
dns_name
]).decode().splitlines()
for item in result:
msgs.append('{} listed in {} as {}'.format(
ip,
blocklist,
item,
))
if item in warn_ips and returncode < 2:
if line.startswith(';;'):
msgs.append('{} - {}'.format(
blocklist,
item,
))
else:
msgs.append('{} listed in {} as {}'.format(
ip,
blocklist,
item,
))
if (item in warn_ips or line.startswith(';;')) and returncode < 2:
returncode = 1
else:
returncode = 2