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

Update to CRS v4.1 #132

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> ${GITHUB_ENV}
- name: Build Image
run: docker build -t "${IMAGE}:${VERSION}" v3.3
run: docker build -t "${IMAGE}:${VERSION}" v4.1
- name: Push Image to DockerHub
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
- master

jobs:
test_3_3:
name: Docker build v3.3
test_4_1:
name: Docker build v4.1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -t test v3.3
run: docker build -t test v4.1
- name: Run image
run: docker run -d --name apache test
- name: Verify
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Based on the official [`owasp/modsecurity-crs`](https://hub.docker.com/r/owasp/m

* [![latest](
https://img.shields.io/badge/latest-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/modsecurity-docker/blob/master/v3.3/Dockerfile) based on [coreruleset/modsecurity-crs-docker](ttps://github.com/coreruleset/modsecurity-crs-docker) (ModSecurity 2, CRS v3.3.2)
* [![3.3](
https://img.shields.io/badge/3.3-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/modsecurity-docker/blob/master/v3.3/Dockerfile) based on [coreruleset/modsecurity-crs-docker](ttps://github.com/coreruleset/modsecurity-crs-docker) (ModSecurity 2, CRS v3.3.2)
https://github.com/vshn/modsecurity-docker/blob/master/v4.1/Dockerfile) based on [coreruleset/modsecurity-crs-docker](ttps://github.com/coreruleset/modsecurity-crs-docker) (ModSecurity 2, CRS v4.1.0)
* [![4.1](
https://img.shields.io/badge/4.1-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/modsecurity-docker/blob/master/v4.1/Dockerfile) based on [coreruleset/modsecurity-crs-docker](ttps://github.com/coreruleset/modsecurity-crs-docker) (ModSecurity 2, CRS v4.1.0)

## Usage

Expand All @@ -32,7 +32,7 @@ $ docker run -p 80:80 -it -e PARANOIA=4 --rm vshn/modsecurity bash
With a Dockerfile:

```Dockerfile
FROM docker.io/vshn/modsecurity:3.3
FROM docker.io/vshn/modsecurity:4.1

ENV PARANOIA=1 \
ANOMALY_INBOUND=500 \
Expand All @@ -49,7 +49,7 @@ VOLUME /tmp/modsecurity
With Docker Compose to start a ModSecurity and a httpbin container:

```console
cd v3.3
cd v4.1
docker-compose up
```

Expand Down
File renamed without changes.
11 changes: 10 additions & 1 deletion v3.3/Dockerfile → v4.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM docker.io/owasp/modsecurity-crs:3.3.5-apache-202402140602@sha256:2a6f6f3dbdcf5edda48606e1dd325f7fb785de7b2d22b70dcb03d692046c1d05
FROM docker.io/owasp/modsecurity-crs:4.1.0-apache-202405050505@sha256:ce9ebaf23dc8d7c229e8a2eef500bcabf6756800ca3226de7553dd70d051feec

# Upstream converted the image to run apache directly as user `httpd` instead of dropping privileges after start-up.
# see: https://github.com/coreruleset/modsecurity-crs-docker/commit/f9c687500e343f05005739c3d2c72c1dc92b0ff1#diff-02c190dd34ee6ce466ae02364d954e15a049a0343ba71774688653550e4c82f6R215
# and https://github.com/coreruleset/modsecurity-crs-docker/pull/227
USER 0:0

ENV APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=root \
Expand Down Expand Up @@ -136,5 +141,9 @@ RUN mkdir -p \

COPY entrypoint.sh /entrypoint.sh

# See beginning of file and upstream PR:
# https://github.com/coreruleset/modsecurity-crs-docker/pull/227/files#diff-02c190dd34ee6ce466ae02364d954e15a049a0343ba71774688653550e4c82f6R215
USER httpd

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["apachectl", "-D", "FOREGROUND"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.