-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Segfaults in kern.log #2872
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
Comments
Hello @GNU-Plus-Windows-User , "Lua 5.1.5" ModSecurity documentation states: "Note : ModSecurity v3 is compatible with Lua 5.2+." |
@martinhsv I've updated Lua to 5.2 and I'm still seeing segfaults in my logs, I've also tried disabling Lua and CrowdSec Nginx Bouncer altogether but there is still segfaults. |
Can you produce a core dump, and at least supply the backtrace? |
@martinhsv I've generated a core dump, but I couldn't figure out how to get a backtrace. |
@martinhsv I've managed to generate a backtrace but I don't know if I did it correctly
I still have that coredump if you want it, but I don't want to post it publicly. |
That looks like the start of a backtrace. Was there more output? Usually a backtrace will show that |
@martinhsv Sorry about that, I didn't read the documentation correctly.
|
Yes, that's it. Thanks. One point to clarify: You mentioned that you are using ModSecurity v3.0.8. Is that the official, published version from last September? Or is that a build from more recent v3/master (which would also report its version as v3.0.8)? |
@martinhsv I followed this guide to compile ModSecurity for Nginx https://www.nginx.com/blog/compiling-and-installing-modsecurity-for-open-source-nginx/ |
Thanks. That implies that you were using a later v3/master. There were some recent changes to the implicated function -- although I don't immediately see how those changes could have caused a segfault. If you are willing to do a couple of experiments, it might be interesting to know if: During step 3 ("Download and Compile the ModSecurity 3.0 Source Code") ...
Repeat the experiment above, but instead of the 'git checkout v3.0.8' specified above, try it with each of these:
Under which (if any) of those three tests the problem still occurs, could be very useful information. |
@martinhsv I've recompiled ModSec using |
By the way, what compiler and version are you using? |
@martinhsv I just finished all 3 tests, all of them had segfaults.
|
In your original report, you mentioned your nginx version as Nginx 1.22.1. I don't know that this is what is causing your problem, but: as of nginx 1.21.5, nginx has changed to use pcre2 by default, whereas the default in ModSecurity is pcre1. To manage this particular difference, you need to do one of three things:
|
@martinhsv I've recompiled ModSec using option 2 |
then you should install pcre2-dev package...
I don't remember now where did we discuss, but this repository has some problem (the provided Nginx package). Btw just two suggestions:
|
@martinhsv I've tried all 3 of your suggestions and I have segfaults with all 3 of them @airween Thank you for giving me the package name, I couldn't find it earlier. |
You should pass the correct path for headers (and for libraries) like
(of course with the correct path) |
@airween Now it's saying that the package |
could we move to the GH page of the tool, and open an issue there? |
@airween Sure, should I just open a new issue there? I'm new to github. |
yes, thank you.
No worries 😃. |
@airween I've given that repository you suggested a try and I'm still experiencing segfaults.
|
Waov. It's pretty interesting. With which Nginx have you tried? That module (both library and connector) has made for Nginx 1.18.0 (which is officially in Ubuntu 2204).
You don't need to add the jammy-updates. That was used earlier for Note: the focal-updates suite has been removed, because the Nginx package is part of regular Ubuntu focal repository. Therefore you do not need this line anymore: These warnings are valid, I have to review what changed in Ubuntu 2204, and modify the page content.
Thanks. |
@airween I'm currently using nginx 1.18.0, the one that comes with Ubuntu 22.04 out of the box. |
If you are able to consistently produce segfaults in all of those different points in v3 history, it suggests that there is something distinctive about your build, environment, configuration, etc. (v3.0.8, in particular, can be assumed to have been in use by a large-ish number of installations). Some options:
|
@martinhsv I managed to find a solution to my issue. |
Reopening since the underlying bug has been identified. Thanks @airween for the work in identifying some steps to reproduce. A fix will be committed shortly. |
Resolved via #2886 |
Describe the bug
ModSec has segfaults which causes CrowdSec Nginx Bouncer to stop working.
Logs and dumps
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Segfaults should not be showing up in logs
Server
Rule Set
Additional context
CrowdSec Nginx Bouncer will stop receiving decisions (IP Bans) if seg faults occur. I made a ticket on the CrowdSec Discord regarding the issue, they provided a fix for that but, if a segfault happens around the same time the bouncer is querying the CrowdSec Agent, the CrowdSec Bouncer will stop working.
Restarting Nginx temporarily fixes the issue
The text was updated successfully, but these errors were encountered: