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):
|
def _read_banned_ips(self):
|
||||||
ips = {}
|
ips = {}
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'],
|
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned', '|', 'tr', '-d', '"][\',"'],
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
|
@ -56,18 +56,18 @@ class SmtpdWatcher:
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
result.stdout
|
result.stdout
|
||||||
)
|
)
|
||||||
ips['postfix'] = json.loads(result.stdout)
|
ips['postfix'] = result.stdout.split(' ')
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
"Banned IPs in postfix jail: %s",
|
"Banned IPs in postfix jail: %s",
|
||||||
ips['postfix']
|
ips['postfix']
|
||||||
)
|
)
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned'],
|
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned', '|', 'tr', '-d', '"][\',"'],
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
ips['postfix-sasl'] = json.loads(result.stdout)
|
ips['postfix-sasl'] = result.stdout.split(' ')
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
"Banned IPs in postfix-sasl jail: %s",
|
"Banned IPs in postfix-sasl jail: %s",
|
||||||
ips['postfix-sasl']
|
ips['postfix-sasl']
|
||||||
|
|
Loading…
Reference in a new issue