redirect naxsi log to a separate log file

Hi,

this patch is not "production ready" but I would like to see with you if it could be possible to integrate such patch.

My main concern: when using naxsi, it produce its whitelist in the error log. I don't think it is a good place to place these informations: it is not errors per se. Moreover in my case, I am a big fan of OSSec, and these messages in the error log enter in conflict with OSSec, which forbid me to use naxsi.

So I work (hard :-) ) to create a patch to store logs into another location.
By default it stores that in /var/log/nginx/naxsi.log. You can override it by using the "naxsi_logfile" keyword (i.e. "naxsi_logfile /var/log/nginx/naxsi2.log"), in location part of the nginx configuration.

My code needs to be reviewed
- simply because I was not familiar with nginx developpement, and I'm sure some code is not in the "nginx spirit".
- I don't have tested extensively for the moment
- the default logfile ("/var/log/nginx/naxsi.log") is hardcoded. I didn't figure out how to make it a autoconf variable

But I would really see this patch included, else I will not be able to push it more in my production environment.

Regards,

Nicolas Zin (nicolas.zin@gmail.com)
Thanks for the feedback.

I updated my sources accordingly.

Regards,


Nicolas

On Tue, Oct 7, 2014 at 7:47 AM, blotus <notifications@github.com> wrote:

> In naxsi_src/naxsi_skeleton.c:
>
> > @@ -149,6 +156,35 @@ static ngx_command_t  ngx_http_dummy_commands[] =  {
> >      NGX_HTTP_LOC_CONF_OFFSET,
> >      0,
> >      NULL },
> > +  /* NaxsiLogfile */
> > +  { ngx_string(TOP_NAXSI_LOGFILE_T),
> > +    NGX_HTTP_MAIN_CONF|NGX_CONF_1MORE,
>
> Replace NGX_CONF_1MORE with NGX_CONF_TAKE1 as only the first argument is
> used ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nbs-system/naxsi/pull/100/files#r18513358>.
>