Fix: Mailbox Stats über Dovecot mit config/mailpool.php

main v1.0.117
boban 2025-10-31 03:33:30 +01:00
parent 8058f9b814
commit 530faf6b45
1 changed files with 5 additions and 6 deletions

View File

@ -157,7 +157,7 @@ class Fail2BanJailModal extends ModalComponent
return ['permanent', $banAt ? ('seit '.$this->fmtTs($banAt)) : '—', $rose]; return ['permanent', $banAt ? ('seit '.$this->fmtTs($banAt)) : '—', $rose];
} }
if ($remaining === -2) { if ($remaining === -2) {
return ['~ '.$this->fmtSecs($this->getApproxBantime()), '—', $amber]; return ['~ '.$this->fmtSecs($this->getBantime($this->jail)), '—', $amber];
} }
if (is_int($remaining)) { if (is_int($remaining)) {
if ($remaining > 0) { if ($remaining > 0) {
@ -171,8 +171,7 @@ class Fail2BanJailModal extends ModalComponent
return ['—', '—', $muted]; return ['—', '—', $muted];
} }
private function getApproxBantime(): int { return 600; } private function getApproxBantime(): int { return $this->getBantime($this->jail); }
private function f2b(string $args): array private function f2b(string $args): array
{ {
$sudo = $this->bin('sudo'); $sudo = $this->bin('sudo');
@ -206,7 +205,7 @@ class Fail2BanJailModal extends ModalComponent
ORDER BY timeofban DESC LIMIT 1", ORDER BY timeofban DESC LIMIT 1",
$this->sql($jail), $this->sql($ip) $this->sql($jail), $this->sql($ip)
); );
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q); $cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
$out = trim((string)@shell_exec($cmd)); $out = trim((string)@shell_exec($cmd));
if ($out === '') return null; if ($out === '') return null;
[$timeofban, $expire] = array_map('intval', explode('|', $out)) + [null, null]; [$timeofban, $expire] = array_map('intval', explode('|', $out)) + [null, null];
@ -220,7 +219,7 @@ class Fail2BanJailModal extends ModalComponent
ORDER BY timeofban DESC LIMIT 1", ORDER BY timeofban DESC LIMIT 1",
$this->sql($jail), $this->sql($ip) $this->sql($jail), $this->sql($ip)
); );
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q); $cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
$out = trim((string)@shell_exec($cmd)); $out = trim((string)@shell_exec($cmd));
if ($out === '') return null; if ($out === '') return null;
[$timeofban, $bantime] = array_map('intval', explode('|', $out)) + [null, null]; [$timeofban, $bantime] = array_map('intval', explode('|', $out)) + [null, null];
@ -235,7 +234,7 @@ class Fail2BanJailModal extends ModalComponent
ORDER BY timeofban DESC LIMIT 1", ORDER BY timeofban DESC LIMIT 1",
$this->sql($jail), $this->sql($ip) $this->sql($jail), $this->sql($ip)
); );
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q); $cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
$out = trim((string)@shell_exec($cmd)); $out = trim((string)@shell_exec($cmd));
if ($out === '') return null; if ($out === '') return null;