coreruleset / modsecurity-crs-docker

Official ModSecurity Docker + Core Rule Set (CRS) images
https://coreruleset.org
Apache License 2.0
269 stars 69 forks source link

Apache LOGLEVEL or ACCESSLOG does not seem to have an effect #82

Closed igoooor closed 2 years ago

igoooor commented 2 years ago

Hello there,

I set my LOGLEVEL to error but I still see access logs in the container stdout. Did I misunderstood the purpose of LOGLEVEL? If so, is there a way to disable apache access logs?

Thanks!

fzipi commented 2 years ago

To disable apache access logs, you can set ACCESSLOG=/dev/null I guess. See https://github.com/coreruleset/modsecurity-docker#apache-env-variables from the base container. The crs container is sending the errorlog to stderr

igoooor commented 2 years ago

Good hint indeed, but weirdly enough I could not make that work. I'm checking this path a bit more

igoooor commented 2 years ago

So far I was not able to stop accesslogs from showing up. Anyone managed to do so?

fzipi commented 2 years ago

Ok, I think it was hiding in plain sight, but enough to be ignored. Short answer: you can't do it right now. This is because, while the base container will use the ACCESSLOG you provide, it also uses the directive TransferLog, and sends it unconditionally to stdout :/

I'm creating an issue in the base container to track this. Thanks for the report!

igoooor commented 2 years ago

Thank you for your support!

fzipi commented 2 years ago

Even after doing this:

      ACCESSLOG: "/dev/null"
      ERRORLOG: "/dev/null"
      METRICSLOG: "/dev/null"
      PERFLOG: "/dev/null combined"

I'm still getting access logs 😠 ! So I think this comes from the upstream httpd container. 😄

fzipi commented 2 years ago

And here is the place: https://github.com/docker-library/httpd/blob/f3b7fd9c8ef59d1ad46c8b2a27df3e02d822834f/2.4/Dockerfile#L205-L212.

We will need to do a similar change.

igoooor commented 2 years ago

I see the PR on the base container image is merged, so I guess it will soon make its way to the docker image?

theseion commented 2 years ago

It should... @fzipi?

fzipi commented 2 years ago

We have a weekly build, so it should be there already 🤔.

Can you try it?

fzipi commented 2 years ago

@igoooor Were you able to test this? Is it working now?

igoooor commented 2 years ago

sorry for my late reply I was away. Yes it seems to be working now with the latest docker build :)