add debug
This commit is contained in:
parent
d4fabf43ca
commit
00badd911c
1 changed files with 8 additions and 0 deletions
|
@ -49,9 +49,13 @@ class SmtpdWatcher:
|
||||||
ips = {}
|
ips = {}
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'],
|
['/usr/bin/fail2ban-client', 'get', 'postfix', 'banned'],
|
||||||
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
self._log.debug(
|
||||||
|
result.stdout
|
||||||
|
)
|
||||||
ips['postfix'] = json.loads(result.stdout)
|
ips['postfix'] = json.loads(result.stdout)
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
"Banned IPs in postfix jail: %s",
|
"Banned IPs in postfix jail: %s",
|
||||||
|
@ -59,6 +63,7 @@ class SmtpdWatcher:
|
||||||
)
|
)
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned'],
|
['/usr/bin/fail2ban-client', 'get', 'postfix-sasl', 'banned'],
|
||||||
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
@ -69,6 +74,7 @@ class SmtpdWatcher:
|
||||||
)
|
)
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['ufw', 'status', 'numbered'],
|
['ufw', 'status', 'numbered'],
|
||||||
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
@ -133,6 +139,7 @@ class SmtpdWatcher:
|
||||||
def _ufw_deny_ip(self, ip):
|
def _ufw_deny_ip(self, ip):
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/sbin/ufw', 'deny', 'from', ip],
|
['/usr/sbin/ufw', 'deny', 'from', ip],
|
||||||
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
@ -148,6 +155,7 @@ class SmtpdWatcher:
|
||||||
def _fail2ban_ban_ip(self, jail, ip):
|
def _fail2ban_ban_ip(self, jail, ip):
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
['/usr/bin/fail2ban-client', 'set', jail, 'banip', ip],
|
['/usr/bin/fail2ban-client', 'set', jail, 'banip', ip],
|
||||||
|
encoding='utf-8',
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue