parent
595828c5f6
commit
dcf9a8d3e9
|
|
@ -160,8 +160,8 @@ WHERE bantime < 0
|
|||
ORDER BY timeofban DESC;
|
||||
SQL;
|
||||
|
||||
$q = sprintf($sql, $this->sql($jail));
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($q).' 2>&1';
|
||||
$qSql = str_replace(':JAIL:', $this->sql($jail), $sql);
|
||||
$cmd = "$sudo -n $sqlite -readonly ".escapeshellarg($db).' '.escapeshellarg($qSql).' 2>&1';
|
||||
$out = trim((string)@shell_exec($cmd));
|
||||
if ($out === '') return [];
|
||||
|
||||
|
|
@ -236,7 +236,11 @@ SQL;
|
|||
private function getDbFile(): string
|
||||
{
|
||||
[, $out] = $this->f2b('get dbfile');
|
||||
$path = trim($out);
|
||||
// nimm die letzte nicht-leere Zeile
|
||||
$lines = array_values(array_filter(array_map('trim', preg_split('/\r?\n/', $out))));
|
||||
$path = end($lines) ?: '';
|
||||
// fail2ban zeigt manchmal "`- /pfad" → führende Zeichen abschneiden
|
||||
$path = preg_replace('/^`?-?\s*/', '', $path);
|
||||
return $path !== '' ? $path : '/var/lib/fail2ban/fail2ban.sqlite3';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue