change piep for replaces

This commit is contained in:
Antonio J. Delgado 2025-01-31 16:52:13 +02:00
parent 2f7feb216d
commit 41618bf385

View file

@ -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']