add debug

This commit is contained in:
Antonio J. Delgado 2025-01-31 15:52:50 +02:00
parent d4fabf43ca
commit 00badd911c

View file

@ -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,
)