In test filters also priorize .local filters over .conf filters and return always also the explicit used filter path in results

This commit is contained in:
2025-12-06 13:11:15 +01:00
parent 5a3c59ae0d
commit 8268e37651
7 changed files with 101 additions and 31 deletions

View File

@@ -1325,12 +1325,15 @@ func TestFilterHandler(c *gin.Context) {
return
}
output, err := conn.TestFilter(c.Request.Context(), req.FilterName, req.LogLines)
output, filterPath, err := conn.TestFilter(c.Request.Context(), req.FilterName, req.LogLines)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to test filter: " + err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{"output": output})
c.JSON(http.StatusOK, gin.H{
"output": output,
"filterPath": filterPath,
})
}
// ApplyFail2banSettings updates /etc/fail2ban/jail.local [DEFAULT] with our JSON