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

SSL cert entry logs are not present in /var/logs/modsec_auddit.log file. #3272

Open
vivekch0976 opened this issue Oct 9, 2024 · 4 comments
Labels
3.x Related to ModSecurity version 3.x

Comments

@vivekch0976
Copy link

Describe the bug

I am trying to enable allowing specific ssl certificate, I already set rules inside /etc/nginx/modsec/rules/ssl-client_certifcate.conf and also configure ngix for taking this certificate. I am able to do curl with client cert and key but its not logging inside modsec_audit.log.

@vivekch0976 vivekch0976 added the 3.x Related to ModSecurity version 3.x label Oct 9, 2024
@airween
Copy link
Member

airween commented Oct 9, 2024

hi @vivekch0976,

could you share your ssl-client_certificate.conf file? How do your rules look like?

And also please take a look about the new issue page: choose a version and please fill that carefully. Eg. we need to know the versions, etc..

@vivekch0976
Copy link
Author

vivekch0976 commented Oct 10, 2024

Hello @airween here it is.

SecRule REQUEST_HEADERS:X-SSL-CERT "contains '<client-crt-cn>'" \
    "id:1001,phase:1,t:none,log,pass,msg:'Allowed SSL certificate'"

@airween
Copy link
Member

airween commented Oct 10, 2024

Thanks,

are you sure the X-SSL-CERT header is there?

You can set up your debug log:

SecDebugLogLevel 9
SecDebugLog /var/log/nginx/modsec_debug.log

Restart your Nginx and check again. You have to see the rule's result in that log, eg

.... Rule returned 0.

or

.... Rule returned 1.

If the value is 0 then it means:

  • no header with that name
  • header presents but with not that value

@vivekch0976
Copy link
Author

vivekch0976 commented Oct 10, 2024

Hello, yes header is there in my own nginx conf file

Only add the header if the client certificate is valid

    if ($ssl_client_verify = SUCCESS) {
        add_header X-SSL-CERT $ssl_client_s_dn;
    }

    # Optional: Respond with 400 if the certificate is not valid
    if ($ssl_client_verify != SUCCESS) {
        return 400 "Client certificate required and not provided or invalid.";
    }

but still i am not able to see anything logs, i am doing testing via curl command (sudo curl -v --insecure --key client.pem --cert client.crt --cacert /etc/nginx/ssl/ca.crt https://, also i am using self signed certificate.
)
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

No branches or pull requests

2 participants