Update docs for newest features

This commit is contained in:
2025-11-12 19:32:45 +01:00
parent 0134b7de5e
commit 17f66b8ed4
4 changed files with 199 additions and 20 deletions

View File

@@ -422,10 +422,11 @@ func (sc *SSHConnector) TestFilter(ctx context.Context, filterName string, logLi
continue
}
// Use fail2ban-regex: log line as string, filter file path
// Escape the log line for shell safety
// Use sudo -s to run a shell that executes the piped command
escapedLine := strconv.Quote(logLine)
cmd := fmt.Sprintf("sudo fail2ban-regex %s %s", escapedLine, strconv.Quote(filterPath))
out, err := sc.runRemoteCommand(ctx, []string{"sh", "-c", cmd})
escapedPath := strconv.Quote(filterPath)
cmd := fmt.Sprintf("echo %s | fail2ban-regex - %s", escapedLine, escapedPath)
out, err := sc.runRemoteCommand(ctx, []string{"sudo", "sh", "-c", cmd})
// fail2ban-regex returns success (exit 0) if the line matches
// Look for "Lines: 1 lines, 0 ignored, 1 matched" or similar success indicators
if err == nil {