-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing hostname in WAF logs #75
Comments
Am I right to assume that hostname will come from this line https://github.com/corazawaf/coraza-caddy/blob/main/http.go#L44 @M4tteoP ? |
I think that around the hostname, and server name, we have to clarify a bit the logic and maybe do still some work around them: Hostname Server name The discussion/actions we should take are:
Thanks @TheForcer for raising it! |
Any hint on how to obtain the right server name @mholt? |
Are you talking about the user-given name of the server in the JSON config as keys here? https://caddyserver.com/docs/json/apps/http/servers/ |
Sometimes users might bind ip address or just a port. We will have to cover all flanks |
FYI, related conversation ModSecurity side: owasp-modsecurity/ModSecurity#2906 |
Any idea on how to continue? The problem is we are not filling ProcessConnection and that is the variable we are using to display the logs. |
I don't want to be this dude but are there any plans? And I could create a PR with it being the host header if available. For me specifically it would be nice to have the hostname because we have a single WAF for multiple domains. |
Please give it a stab @ErazerBrecht |
Hello, I'd also greatly appreciate this feature! I'm a first time caddy and coraza user and everything fell into place so neatly except this. |
I have exactly the same use case. So I'd like to upvote this issue. |
We have to push this solution. Is there any proxy standard that establishes how to get this? I would say:
Questions are
|
I don't think we should trust the Adding name resolution could add some latency, but I guess it just need to be performed once at initialization probably... so I would say let's do 1) from @M4tteoP above. |
We go back to the issue, what if a wildcard was used |
Using a wildcard doesn't work when doing name resolution. In the example above there was no wildcard, so I didn't thought it was a problem. We should agree that adding to logs anything that comes in the So, my reasoning here will be:
|
Maybe I'm completely misunderstanding the problem. Webservers in general, and Caddy in this case, are already able to log the requested HTTP header "Host", so in my naive idea, Coraza only has to do the same, which is implemented on the Caddy-side? Wildcard domains should not occur, at least not configured. Also configuration is not relevant to it and no reverse dns should be necessary. It is the Host-header from the HTTP request which should be used for the log and the value must be sanitized for the log in the same way, the webserver does it. |
OK, I followed the discussion in the linked pages and I understand it better why there are different approaches and solutions to this problem. As for me, I'm just trying to get some information from Caddy to the Coraza log, making it possible to link log lines to specific Caddy configuration parts. So maybe it is easier to implement something into Coraza Caddy which makes it possible to define log content in the Caddyfile which is appended to a log line. |
What I now tested, is to add a tag with the hostname. In @crs-setup.conf this is actually already outlined in an example for SecDefaultAction: But if I uncomment this lines an error message is returned when restarting Caddy, describing that "SecDefaultAction must not contain metadata actions". If that would work, it would be sufficient for my use case. |
Hi everyone,
I am currently trying to implement Coraza into my Caddy setup, but for some reason the hostname of blocked requests does not get logged. As you can see in the log samples below, the hostname is recorded as
[hostname ""]
According to #35 this should be fixed, so I am not sure if there is a possible misconfiguration at play also.
I've compiled Caddy 2.6.4 with xcaddy in several ways, with the most recent command seen as below. AFAIK these versions should contain the servername fixes.
xcaddy build --with github.com/corazawaf/coraza-caddy/@v2.0.0-rc.2 --with github.com/corazawaf/coraza/@v3.0.0
My current Caddyfile looks like this.
I am using the current rule files from coraza-coreruleset, haven't made any changes except additionaly allowing HTTP/3 & HTTP/3.0 versions in crs-setup.conf.
Would be happy about some hints. Thank you 😀
The text was updated successfully, but these errors were encountered: