Skip to content
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

add SecAuditLogType HTTPS for retrocompatibility with Modsecurity #829

Closed
amsnek opened this issue Jun 29, 2023 · 21 comments · Fixed by #826
Closed

add SecAuditLogType HTTPS for retrocompatibility with Modsecurity #829

amsnek opened this issue Jun 29, 2023 · 21 comments · Fixed by #826

Comments

@amsnek
Copy link

amsnek commented Jun 29, 2023

Summary

Modsecurity (2.x/3.x) currently has the Option to write audit logs directly via via Network (http/https) in JSON format. This can be usefull to directly ship to a logging endpoint and skip the need for (local) file based writes.

Basic example

SecAuditLogFormat JSON
SecAuditLogType HTTPS
SecAuditLog http://<ip>:<port>

Documentation: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v3.x)#user-content-SecAuditLogType

Motivation

Since Coraza WAF aims to be a "drop in Replacement" I would suggest this feature to be added as well if possible.
This Subject was initially discussed here: #813

@jcchavezs
Copy link
Member

Thanks for opening this issue. There is a PR that started this work #826

@jcchavezs jcchavezs added the v3.1 label Jul 6, 2023
@jptosso
Copy link
Member

jptosso commented Jul 11, 2023

HTTPS audit log is now implemented and will be available in the v3.0.3 release #826

@jptosso jptosso linked a pull request Jul 11, 2023 that will close this issue
@jcchavezs
Copy link
Member

jcchavezs commented Jul 11, 2023 via email

@amsnek
Copy link
Author

amsnek commented Jul 11, 2023

Most Awesome! Will try this as soon as possible but am currently stuck with some tasks. It may take a while/week or like for me to dig into this. Will report back as soon as possible!

@jcchavezs
Copy link
Member

jcchavezs commented Jul 11, 2023 via email

@amsnek
Copy link
Author

amsnek commented Jul 14, 2023

I just realised that I entirely forgot (also to mention) that I only used the haproxy / coraza-spoa plugin so far-> I somehow assumed that this is somewhat analogous (or maybe it is and I am not checking out the correct/latest for coraza-spoa, though I tried all branches). 🙈

coraza-spoa currently complains:
{
"level": "error",
"ts": 1689346036.85105,
"msg": "unable to create waf instance",
"app": "httpslog_test",
"error": "invalid WAF config from string: failed to parse string: failed to compile the directive "secauditlogtype": invalid logger "HTTPS""
}
panic: invalid WAF config from string: failed to parse string: failed to compile the directive "secauditlogtype": invalid logger "HTTPS"

will try and setup my testing Scenario with corazawaf itself. Or is there a way I could do this with spoa already? sorry for the confusion, its been a while I last touched coraza.

@jptosso
Copy link
Member

jptosso commented Jul 14, 2023

Hey! Coraza v3.0.3 will provide https logs supports. It's already available, we are just waiting to create the tag. If you want to test it you can import the latest commit of coraza waf

@jcchavezs
Copy link
Member

@jptosso could you please create a branch so @amsnek can try out. also dont forget to include the change of the content type before cutting 3.0.3

@jptosso
Copy link
Member

jptosso commented Aug 21, 2023

This feature is already released. @amsnek your feedback would be appreciated.

@amsnek
Copy link
Author

amsnek commented Aug 21, 2023

Hello, will do. Last i tried ~1 week (when trying latest commit/release) ago I still had the error that is an invalid logger.

@jptosso
Copy link
Member

jptosso commented Aug 21, 2023

Please make sure you are using coraza v3.0.3

@amsnek
Copy link
Author

amsnek commented Aug 21, 2023

Hello,

I am using the latest coraza-spoa (https://github.com/corazawaf/coraza-spoa.git) but the error remains:

./coraza-spoa_amd64 -config config.yaml
Loading 1 applications
panic: invalid WAF config from string: failed to parse string: failed to compile the directive "secauditlogtype": invalid logger "https"

goroutine 1 [running]:
main.main()
        /git/coraza-spoa/cmd/coraza-spoa/main.go:24 +0x109

-> can I not test this with coraza-spoa?
as stated in: #829 (comment)

@jcchavezs
Copy link
Member

Not sure coraza-spoa is up to date to it. Could you please verify it with go mod?

@amsnek
Copy link
Author

amsnek commented Aug 21, 2023

yeah, but not sure howto test it properly in my setup with "go mod", didnt use that yet.
-> but will do so but will take some time to look into that.

@jptosso
Copy link
Member

jptosso commented Aug 21, 2023

This PR contains the HTTPS feature: corazawaf/coraza-spoa#84 please make sure to use coraza-spoa@a5e0f31

@amsnek
Copy link
Author

amsnek commented Aug 21, 2023

can confirm, that works! 👍
lots of (important) fields are empty (uri, version, method etc) in json format but that its independent from "secauditlogtype"
much awesome, thanks!

-> will close the issue

@jptosso
Copy link
Member

jptosso commented Aug 21, 2023

Great. Make sure you are using all log parts

@amsnek
Copy link
Author

amsnek commented Aug 21, 2023

yeah, i am using the same as on my modsecurity counterpart:
SecAuditLogParts ABIJDEFHZ
-> but either I am doing something wrong, or lots of fields are empty
I made a feature request and more detailed description for this in:
#856

-> which was just updated 👍

@github-actions
Copy link

This issue has been open 30 days waiting for feedback. Remove the stale label or comment, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Sep 21, 2023
@amsnek
Copy link
Author

amsnek commented Sep 21, 2023

closing again -> SecAuditLogType HTTPS works as intended.

Thanks!

@amsnek amsnek closed this as completed Sep 21, 2023
@jcchavezs
Copy link
Member

jcchavezs commented Sep 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants