Skip to content

How to tell Modsec to not treat lines coming from unix socket #3506

@quenenni

Description

@quenenni

Hello,

I configured Anubis in our setup and now have these kind of lines in Apache logs:

www.XXXX.be:80 unix: - - [04/Mar/2026:18:57:24 +0100] "GET /actes/login.php HTTP/1.0" 200 4567 "http://www.XXXX.be/actes/tab_naiss.php" "Anubis-OGTag-Fetcher/1.0"

And Modsecurity doesn't like the "unix:" (instead of the ip address) part and I have lots of noise in the error.log

[Wed Mar 04 18:57:24.332780 2026] [security2:error] [pid 1099861:tid 1099861] [client 127.0.0.1:54318] [client 127.0.0.1] ModSecurity: IPmatch: bad IPv6 specification "unix:". [hostname "www.XXXX.be"] [uri "/actes/login.php"] [unique_id "aahyhOAeY7rI59rQMcYbPgAAAAc"], referer: http://www.XXXX.be/actes/tab_naiss.php
[Wed Mar 04 18:57:24.332955 2026] [security2:error] [pid 1099861:tid 1099861] [client 127.0.0.1:54318] [client 127.0.0.1] ModSecurity: Rule processing failed (id=905110, msg=). [hostname "www.XXXX.be"] [uri "/actes/login.php"] [unique_id "aahyhOAeY7rI59rQMcYbPgAAAAc"], referer: http://www.XXXX.be/actes/tab_naiss.php

I tried to configure a rule in my REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf (first rule in the file):

SecRule REQUEST_HEADERS:User-Agent  "@pm Anubis-OGTag-Fetcher"    "phase:request,id:999,log,allow,ctl:ruleEngine=off"

I can see in the log that my rule is treated, but still have the 2 lines from the rule 905110

[Wed Mar 04 18:57:24.338704 2026] [security2:error] [pid 1099861:tid 1099861] [client 127.0.0.1:54318] [client 127.0.0.1] ModSecurity: Access allowed (phase 2). Matched phrase "Anubis-OGTag-Fetcher" at REQUEST_HEADERS:User-Agent. [file "/etc/modsecurity/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf"] [line "10"] [id "999"] [hostname "www.XXXX.be"] [uri "/actes/login.php"] [unique_id "aahyhOAeY7rI59rQMcYbPgAAAAc"], referer: http://www.XXXX.be/actes/tab_naiss.php

My /etc/apache2/mods-enabled/security2.conf file:

<IfModule security2_module>
    # Default Debian dir for modsecurity's persistent data
    SecDataDir /var/cache/modsecurity

    Include /etc/modsecurity/modsecurity.conf
    Include /etc/modsecurity/crs-setup.conf
    Include /etc/modsecurity/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
    Include /etc/modsecurity/crs/*.conf
    Include /etc/modsecurity/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf
</IfModule>

How can I do to have Modsec no treat these lines from Anubis in apache logs?

The rule 905110 is way after my rule, so why Modsec does treat this rule when my rule says to allow the request and disable Modsec?

Any suggestion on how to handle this?

Thanks

NB: I also contacted Anubis in hope they can tell me if I can avoid these lines in the logs, waiting to see if there is a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.xRelated to ModSecurity version 2.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions