use split
This commit is contained in:
parent
00badd911c
commit
81049aa360
1 changed files with 4 additions and 4 deletions
|
@ -48,7 +48,7 @@ class SmtpdWatcher:
|
|||
def _read_banned_ips(self):
|
||||
ips = {}
|
||||
result = subprocess.run(
|
||||
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'],
|
||||
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned', '|', 'tr', '-d', '"][\',"'],
|
||||
encoding='utf-8',
|
||||
check=True,
|
||||
capture_output=True,
|
||||
|
@ -56,18 +56,18 @@ class SmtpdWatcher:
|
|||
self._log.debug(
|
||||
result.stdout
|
||||
)
|
||||
ips['postfix'] = json.loads(result.stdout)
|
||||
ips['postfix'] = result.stdout.split(' ')
|
||||
self._log.debug(
|
||||
"Banned IPs in postfix jail: %s",
|
||||
ips['postfix']
|
||||
)
|
||||
result = subprocess.run(
|
||||
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned'],
|
||||
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned', '|', 'tr', '-d', '"][\',"'],
|
||||
encoding='utf-8',
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
ips['postfix-sasl'] = json.loads(result.stdout)
|
||||
ips['postfix-sasl'] = result.stdout.split(' ')
|
||||
self._log.debug(
|
||||
"Banned IPs in postfix-sasl jail: %s",
|
||||
ips['postfix-sasl']
|
||||
|
|
Loading…
Reference in a new issue