Utility change: nginx + libmodsecurity3 infrastructure, with fail-fast as new CL argument#24
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
3eee5f7 to
1c54489
Compare
|
Fixed the phase 4 issue, found in the debug log that phase 4 did not process because the content header was missing. Now I use I do still have an issue: While most runs run fine, some can report a failure. It looks like some logging does not happen when it has to log a lot of stuff. To mitigate this, I removed access logging and audit logging of the configuration. This reduces the number of failed runs but does not look like a complete fix. I am unsure if something can be done at the configuration level to help further solve this, or if this is a known issue of V3. To go further in relaxing the load to avoid this error we could use |
Signed-off-by: Sebitosh <soloplayerdiablo@gmail.com>
1c54489 to
134ea7e
Compare
|
Hi @Sebitosh,
I'm a bit confused about the naming convention. I tried the generated rule set with generated test cases, and this is what I see: Actually I don't know what is the name of the used file, because there is no such file under generated folder, but there are tons of files with similar names, eg. |
It's an issue with the placement of the rule id in the generated test files. What happens is that |
Of course we could also add some kind of counter to the generated test files such that it displays something like that: If this is more what you mean |
|
I saw your PR #32, looks good to me, I'll merge that soon. Regarding to issues in
Yes, I'm glad you could catch that problem. Btw. in these cases you can send a request directly based on So, here is the request: The "problem" is that if you configure Nginx as a proxy and use Albedo as back end, Albedo does not sends You can get the possible URI-s: (if your Albedo listens on port 8000). So the solution is using and with this request, the expected rule ID appears in the log: Probably we should add this feature to our generate script: if the request is a POST and the phase is greater than 2, then the test should contains a Or we can open a feature request in Albedo. |
The issue I see here is: let's take the tests from CONF_002_TARGET_ARGS_A-GET.yaml, among the generated tests is a test for a phase 4 rule triggered by a GET request. In that case there is no way using
This could be a solution, but 1) Albedo devs might not want the inclusion of this header to be the default behavior on CRS's regression test workflow file: https://github.com/coreruleset/coreruleset/blob/main/.github/workflows/test.yml My intuition is that what should happen is that the proxy should be somehow configured to add a I realize that it overrides any set Content-Type previously contained in the response generated by |
Okay, let me check this soon, and I'll merge this PR then. Thanks! |
|
Hi @Sebitosh, do you plan to add anything here, or we can consider it's done? |
I think we can consider the PR for the infra done. Because of issue coreruleset/go-ftw#501 I might add changes to the generator script (using go-ftw's output option |
Description
#11
Like the apache2 infrastructure, provides the necessary configuration files to run the test set using
mrts.pyon nginx + libmodsecurity3. I discovered that the existing test set fails on libmodsecurity 3.0.14 , so I changed the script to provide the--fail-fastoption ofgo-ftwas an optional flag instead of a default behavior to watch every failed test.Current output
I have left the small logging messages from nginx so that we understand what is happening with the local installation, mine gives this:
The attempt at opening
/var/log/nginx/error.logis because of the compiled path values, but I overwrite this in thestart.pyscript to avoid the crash. Also I discovered that themodsecurity_rules_fileline in the configuration does not use the given prefix on the nginx command line, so thestart.pyandstop.pyare a bit adapted around that.I was very confused as to why the tests failed, and after some research I found out that it is because no logs are happening for rules in phase 4. I confirmed this by rewriting the tests with only phases 1 to 3 and then they all pass (I am attaching files with the output for reference). I am unsure if this is behavior due to libmodsecurity3 or the configuration I provided. @airween do you know what is causing this ?
As for the apache2 infrastructure, the
nginxserver is run on port80and is a reverse proxy toalbedoon port8000. This implies that to run the script as default user, one must allownginxto own port80as a non-root user.Also, if using the provided
go-ftwconfig file in thenginx_linuxdirectory, themrts.pyutility must be run from the root of the project as demonstrated above.The configuration assumes all the module binaries are located at
/usr/lib/nginx/modules/.phase1-3-success.ftw.output.txt
phase1-4-failure.ftw.output.txt