From e029329a037b803a02e8b9500de0df125c64d697 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 9 Sep 2023 14:10:27 +0200 Subject: [PATCH] bundles/icinga2: handle dig status messages in check_spam_blocklist --- bundles/icinga2/files/check_spam_blocklist | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bundles/icinga2/files/check_spam_blocklist b/bundles/icinga2/files/check_spam_blocklist index aa80164..d6a2d31 100644 --- a/bundles/icinga2/files/check_spam_blocklist +++ b/bundles/icinga2/files/check_spam_blocklist @@ -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