-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: update caddy to properly detect basic auth failures (#1015)
- Loading branch information
1 parent
71d3853
commit 08b4d35
Showing
7 changed files
with
630 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} | ||
{"level":"error","ts":1711741827.9626286,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"54462","client_ip":"127.0.0.1","proto":"HTTP/1.1","method":"GET","host":"localhost:9080","uri":"/","headers":{"User-Agent":["curl/7.88.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000033987,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
parsers: | ||
- crowdsecurity/syslog-logs | ||
- "./parsers/s01-parse/crowdsecurity/caddy-logs.yaml" | ||
- crowdsecurity/http-logs | ||
- crowdsecurity/dateparse-enrich | ||
scenarios: | ||
- "crowdsecurity/http-generic-bf" | ||
postoverflows: | ||
- "" | ||
collections: [] | ||
log_file: caddy-logs.log | ||
log_type: caddy | ||
ignore_parsers: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
len(results) == 1 | ||
"127.0.0.1" in results[0].Overflow.GetSources() | ||
results[0].Overflow.Sources["127.0.0.1"].IP == "127.0.0.1" | ||
results[0].Overflow.Sources["127.0.0.1"].Range == "" | ||
results[0].Overflow.Sources["127.0.0.1"].GetScope() == "Ip" | ||
results[0].Overflow.Sources["127.0.0.1"].GetValue() == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[0].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[0].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[0].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[0].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[0].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[0].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[0].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[0].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[0].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[0].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[0].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[0].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[0].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.Events[1].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[1].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[1].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[1].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[1].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[1].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[1].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[1].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[1].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[1].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[1].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[1].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[1].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.Events[2].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[2].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[2].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[2].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[2].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[2].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[2].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[2].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[2].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[2].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[2].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[2].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[2].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.Events[3].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[3].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[3].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[3].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[3].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[3].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[3].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[3].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[3].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[3].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[3].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[3].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[3].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.Events[4].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[4].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[4].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[4].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[4].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[4].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[4].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[4].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[4].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[4].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[4].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[4].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[4].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.Events[5].GetMeta("datasource_path") == "caddy-logs.log" | ||
results[0].Overflow.Alert.Events[5].GetMeta("datasource_type") == "file" | ||
results[0].Overflow.Alert.Events[5].GetMeta("http_args_len") == "0" | ||
results[0].Overflow.Alert.Events[5].GetMeta("http_path") == "/" | ||
results[0].Overflow.Alert.Events[5].GetMeta("http_status") == "401" | ||
results[0].Overflow.Alert.Events[5].GetMeta("http_user_agent") == "curl/7.88.1" | ||
results[0].Overflow.Alert.Events[5].GetMeta("http_verb") == "GET" | ||
results[0].Overflow.Alert.Events[5].GetMeta("log_type") == "http_access-log" | ||
results[0].Overflow.Alert.Events[5].GetMeta("service") == "http" | ||
results[0].Overflow.Alert.Events[5].GetMeta("source_ip") == "127.0.0.1" | ||
results[0].Overflow.Alert.Events[5].GetMeta("sub_type") == "auth_fail" | ||
results[0].Overflow.Alert.Events[5].GetMeta("target_fqdn") == "localhost:9080" | ||
results[0].Overflow.Alert.Events[5].GetMeta("timestamp") == "2024-03-29T19:50:27Z" | ||
results[0].Overflow.Alert.GetScenario() == "crowdsecurity/http-generic-bf" | ||
results[0].Overflow.Alert.Remediation == true | ||
results[0].Overflow.Alert.GetEventsCount() == 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.