From 00badd911cca5e5e994864d4da58f7904bc9b17a Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Fri, 31 Jan 2025 15:52:50 +0200 Subject: [PATCH] add debug --- smtpd_watcher/smtpd_watcher.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/smtpd_watcher/smtpd_watcher.py b/smtpd_watcher/smtpd_watcher.py index 7279a9e..fd3703f 100644 --- a/smtpd_watcher/smtpd_watcher.py +++ b/smtpd_watcher/smtpd_watcher.py @@ -49,9 +49,13 @@ class SmtpdWatcher: ips = {} result = subprocess.run( ['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'], + encoding='utf-8', check=True, capture_output=True, ) + self._log.debug( + result.stdout + ) ips['postfix'] = json.loads(result.stdout) self._log.debug( "Banned IPs in postfix jail: %s", @@ -59,6 +63,7 @@ class SmtpdWatcher: ) result = subprocess.run( ['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned'], + encoding='utf-8', check=True, capture_output=True, ) @@ -69,6 +74,7 @@ class SmtpdWatcher: ) result = subprocess.run( ['ufw', 'status', 'numbered'], + encoding='utf-8', check=True, capture_output=True, ) @@ -133,6 +139,7 @@ class SmtpdWatcher: def _ufw_deny_ip(self, ip): result = subprocess.run( ['/usr/sbin/ufw', 'deny', 'from', ip], + encoding='utf-8', check=True, capture_output=True, ) @@ -148,6 +155,7 @@ class SmtpdWatcher: def _fail2ban_ban_ip(self, jail, ip): result = subprocess.run( ['/usr/bin/fail2ban-client', 'set', jail, 'banip', ip], + encoding='utf-8', check=True, capture_output=True, )