From 41618bf385a549736ee0407b9a118113da62a2f6 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Fri, 31 Jan 2025 16:52:13 +0200 Subject: [PATCH] change piep for replaces --- smtpd_watcher/smtpd_watcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smtpd_watcher/smtpd_watcher.py b/smtpd_watcher/smtpd_watcher.py index 0c60c49..ae0af45 100644 --- a/smtpd_watcher/smtpd_watcher.py +++ b/smtpd_watcher/smtpd_watcher.py @@ -48,7 +48,7 @@ class SmtpdWatcher: def _read_banned_ips(self): ips = {} result = subprocess.run( - ['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned', '|', 'tr', '-d', '"][\',"'], + ['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'], encoding='utf-8', check=True, capture_output=True, @@ -60,7 +60,7 @@ class SmtpdWatcher: result.returncode, result.stderr, ) - ips['postfix'] = result.stdout.split(' ') + ips['postfix'] = result.stdout.replace("'", '').replace(',', '').replace(']', '').replace('[', '').split(' ') self._log.debug( "Banned IPs in postfix jail: %s", ips['postfix']