8000 Replace python with sed by zugao · Pull Request #4 · coreruleset/modsecurity-crs-docker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Replace python with sed #4

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

Merged
merged 1 commit into from
Jan 21, 2020
Merged

Conversation

zugao
Copy link
Contributor
@zugao zugao commented Jan 13, 2020

Replaced python with sed in entrypoint script.

Fixes: #2

Feature parity

I did some tests to make sure the content of the file is the same as the previous version.
These are the commands that I ran:

Build the image on the old branch with python:

docker build src -f 3.3-nginx/Dockerfile --tag owasp/modsecurity-crs:old
docker run -ti -e PARANOIA=11 \
               -e EXECUTING_PARANOIA=11 \
               -e ENFORCE_BODYPROC_URLENCODED=11 \
               -e ANOMALYIN=11 \
               -e ANOMALYOUT=11 \
               -e ALLOWED_METHODS=11 \
               -e ALLOWED_REQUEST_CONTENT_TYPE=11 \
               -e ALLOWED_REQUEST_CONTENT_TYPE_CHARSET=11 \
               -e ALLOWED_HTTP_VERSIONS=11 \
               -e RESTRICTED_EXTENSIONS=11 \
               -e STATIC_EXTENSIONS=11 \
               -e MAX_NUM_ARGS=11 \
               -e ARG_NAME_LENGTH=11 \
               -e ARG_LENGTH=11 \
               -e TOTAL_ARG_LENGTH=11 \
               -e MAX_FILE_SIZE=11 \
               -e COMBINED_FILE_SIZES=11 \
               -e RESTRICTED_HEADERS=11 \
               --rm owasp/modsecurity:1 \
               cat /etc/modsecurity.d/owasp-crs/crs-setup.conf > test_old.txt

Build the image on the new branch with sed:

docker build src -f 3.3-nginx/Dockerfile --tag owasp/modsecurity-crs:new
docker run -ti -e PARANOIA=11 \
               -e EXECUTING_PARANOIA=11 \
               -e ENFORCE_BODYPROC_URLENCODED=11 \
               -e ANOMALYIN=11 \
               -e ANOMALYOUT=11 \
               -e ALLOWED_METHODS=11 \
               -e ALLOWED_REQUEST_CONTENT_TYPE=11 \
               -e ALLOWED_REQUEST_CONTENT_TYPE_CHARSET=11 \
               -e ALLOWED_HTTP_VERSIONS=11 \
               -e RESTRICTED_EXTENSIONS=11 \
               -e STATIC_EXTENSIONS=11 \
               -e MAX_NUM_ARGS=11 \
               -e ARG_NAME_LENGTH=11 \
               -e ARG_LENGTH=11 \
               -e TOTAL_ARG_LENGTH=11 \
               -e MAX_FILE_SIZE=11 \
               -e COMBINED_FILE_SIZES=11 \
               -e RESTRICTED_HEADERS=11 \
               --rm owasp/modsecurity:1 \
               cat /etc/modsecurity.d/owasp-crs/crs-setup.conf > test_after.txt

Test the contents ignoring spaces:

diff -w test_new.txt test_old.txt

P.S. In the old config file the identation for SecAction 900300, 900310, 900320, 9003030, 900340, 900350 were wrong. It can be seen by running the following command:

diff test_new.txt test_old.txt

Copy link
Contributor
@bittner bittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

Can you post the output of a verification run that shows off that the change in equivalent behavior (at least for the current content of the configuration file)?

@zugao zugao force-pushed the feature/remove-python branch 3 times, most recently from c49898a to 260d863 Compare January 15, 2020 13:43
@bittner
Copy link
Contributor
bittner commented Jan 21, 2020

I assume, no feedback from the community is good feedback. Hence, merging. 🚀

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

Successfully merging this pull request may close these issues.

Use sed in entrypoint instead of Python
2 participants
0