OWASP CRS Docker Image
What is the OWASP CRS
OWASP CRS is a set of generic attack detection rules for use with ModSecurity or compatible web application firewalls.
ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx.
Supported Tags
Stable Tags
Stable Tags are composed of:
- CRS version, in the format
<major>[.<minor>[.<patch]]
- web server variant
- OS variant (optional, nginx only)
- date, in the format
YYYYMMDDHHMM
The stable tag format is <CRS version>-<web server>[-<os>]-<date>.
Examples (do not blindly copy these labels):
4-nginx-202509051009
4.18-nginx-202509051009
4.18.0-nginx-202509051009
Or for the previous major release:
3-nginx-alpine-202509051009
3.3-nginx-alpine-202509051009
3.3.7-nginx-alpine-202509051009
Rolling Tags
Rolling tags are updated whenever a new stable tag release occurs. Rolling tags can be practical but should not be used in production.
Rolling Tags are composed of:
- web server variant
- OS variant (optional)
The rolling tag format is <web server>[-<os>].
Examples:
LTS Tags
LTS (Long-Term Support) tags are stable tags pointing to a designated LTS release. They are updated less frequently than stable tags and are intended for users who prioritize stability over new features.
LTS Tags are composed of:
- CRS version, in the format
<major>.<minor> or <major>.<minor>.<patch>
- web server variant
- OS variant (optional)
lts suffix
- optional date, in the format
YYYYMMDDHHMM, appended before -lts for uniquely dated snapshots
The LTS tag format is <CRS version>-<web server>[-<os>]-lts and <CRS version>-<web server>[-<os>]-<date>-lts.
Examples:
4.25-nginx-lts
4.25.0-nginx-lts
4.25-apache-lts
4.25.0-apache-alpine-lts
4.25-nginx-202509051009-lts
4.25.0-nginx-202509051009-lts
OS Variants
- nginx – ModSecurity v3.0.17 on Nginx 1.30.7 official stable base image, and latest stable OWASP CRS 4.30.0
- Apache httpd – ModSecurity v2.9.15 on Apache 2.4.71 official stable base image, and latest stable OWASP CRS 4.30.0
Read-only Root Filesystem
[!IMPORTANT]
Read-only filesystem variants are not currently published. The nginx-read-only and
nginx-alpine-read-only tags do not exist on Docker Hub or ghcr.io.
The root filesystem of our containers is writable. Support for running on a read-only
filesystem is still in the nginx images — the READ_ONLY_FS build argument and the
0-move-writables.sh entrypoint script — but the build targets that would produce those
images are disabled in docker-bake.hcl, so no such tags are pushed.
Notes regarding Openresty version of this image
- The version was removed as no maintainer was found.
Supported architectures
Our builds are based on the official Apache httpd, nginx and Openresty images, which means we can only support the architectures they support.
We currently provide images for the following architectures:
[!WARNING]
Breaking change: linux/i386 is no longer published. Tags published from this change on (including the rolling tags such as apache and nginx) have no 32-bit x86 manifest, so a 32-bit x86 host cannot pull them.
If you run on a 32-bit x86 host:
- move to a 64-bit host (recommended), or
- keep using an image published before this change, preferably pinned by digest, e.g.
docker pull owasp/modsecurity-crs@sha256:<digest>. Find the digest of an older stable tag with docker buildx imagetools inspect owasp/modsecurity-crs:<older stable tag> and check that linux/386 is listed.
Pinned images do not receive updates, so they will not get security fixes for CRS, ModSecurity or the base image.
Building
If you want to see the targets of the build, use:
docker buildx bake -f ./docker-bake.hcl --print
To build for any platforms of your choosing, just use this example:
docker buildx create --use --platform linux/amd64,linux/arm64
docker buildx bake -f docker-bake.hcl
To build a specific target for a single platform only (replace target and platform strings in the example with your choices):
docker buildx bake -f docker-bake.hcl --set "*.platform=linux/amd64" nginx-alpine-writable
Apache images enable PCRE2 JIT by default. To build the non-JIT Apache variants for regex interpreter testing, use:
docker buildx bake -f docker-bake.hcl apache-no-jit
Notes regarding Openresty version of the image
Openresty image builds currently support only these architectures:
Container Health Checks
🆕 We add healthchecks to the images, so that containers return HTTP status code 200 from the /healthz endpoint. When a container has a healthcheck specified, it has a health status in addition to its normal status. This status is initially starting. Whenever a health check passes, it becomes healthy (whatever state it was previously in). After a certain number of consecutive failures, it becomes unhealthy. See https://docs.docker.com/engine/reference/builder/#healthcheck for more information.
CRS Versions
Hey, I used some specific git version with the containers? What happened?
You can achieve the same results just by getting any version you want, and using docker volumes. See this example:
git clone https://github.com/coreruleset/coreruleset.git myrules
cd myrules
git checkout ac2a0d1
docker run -p 8080:8080 -ti -e BLOCKING_PARANOIA=4 -v rules:/opt/owasp-crs/rules:ro --rm owasp/modsecurity-crs
Quick reference
What is ModSecurity
ModSecurity is an open source, cross platform Web Application Firewall (WAF) engine for Apache, IIS and Nginx. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
SSL files naming breaking change
SSL related variables have been renamed to highlight they are a path to a file, so docker doesn't complain about sensitive usage in the case of variables ending in _KEY.
Nginx based images breaking change
| ⚠️ WARNING |
| Nginx based images are now based on upstream nginx. This changed the way the config file for nginx is generated. |
If using the Nginx environment variables is not enough for your use case, you can mount your own nginx.conf file as the new template for generating the base config.
An example can be seen in the docker-compose file.
💬 What happens if I want to make changes in a different file, like /etc/nginx/conf.d/default.conf?
You mount your local file, e.g. nginx/default.conf as the new template: /etc/nginx/templates/conf.d/default.conf.template. You can do this similarly with other files. Files in the templates directory will be copied and subdirectories will be preserved.
Both nginx and httpd containers now run with an unprivileged user. This means that we cannot bind to ports below 1024, so you might need to correct your PORT and SSL_PORT settings. Now the defaults for both nginx and httpd are 8080 and 8443.
Nginx port_in_redirect breaking change
[!WARNING]
port_in_redirect is set to off via NGINX_PORT_IN_REDIRECT in the http block (applies globally, including any custom server blocks you mount).
Previously, nginx's default port_in_redirect on caused the internal listening port (e.g., 8080 or 8443) to be included in redirect Location headers (e.g., when nginx adds a trailing slash: /address → http://example.com:8080/address/). This broke setups where the container is behind a reverse proxy and the external port differs from the internal port.
With port_in_redirect off (the default), nginx omits the port from redirect URLs, so clients follow redirects using the correct external port. If you relied on the port being included in nginx-generated redirects, set NGINX_PORT_IN_REDIRECT=on.
The explicit HTTP to HTTPS redirect (emitted when SSL_VERIFY is enabled or *_ALWAYS_TLS_REDIRECT=on) is not affected by port_in_redirect; it uses SSL_REDIRECT_PORT, which defaults to SSL_PORT. Set SSL_REDIRECT_PORT to the externally reachable TLS port when it differs from SSL_PORT (for example SSL_REDIRECT_PORT=443 with -p 443:8443).
Common ENV Variables
These variables are common to image variants and will set defaults based on the image name.
| Name |
Description |
httpd default |
nginx / Openresty default (if different) |
| ACCESSLOG |
Location of the custom log file |
/var/log/apache2/access.log |
/var/log/nginx/access.log |
| BACKEND |
Partial URL for the remote server of the ProxyPass (httpd) and proxy_pass (nginx) directives |
http://localhost:80 |
- |
| ERRORLOG |
Location of the error log file |
/proc/self/fd/2 |
- |
| LOGLEVEL |
Minimum level for log messages to be logged to the error log |
warn |
- |
| METRICS_ALLOW_FROM |
A single range of IP addresses that can access the metrics |
127.0.0.0/255.0.0.0 ::1/128 |
127.0.0.0/24 |
| METRICS_DENY_FROM |
A range of IP addresses that cannot access the metrics |
All |
all |
| METRICSLOG |
Location of metrics log file |
/dev/null |
- |
| PROXY_SSL_CA_CERT_FILE |
A string indicating the path to the PEM-encoded list of accepted CA certificates for the proxied server |
/etc/ssl/certs/ca-certificates.crt |
/etc/ssl/certs/ca-certificates.crt |
| PROXY_SSL_CERT_FILE |
A string indicating the path to the PEM-encoded client certificate the proxy presents to the backend when the backend requests client authentication (mutual TLS). Only used when both this file and PROXY_SSL_CERT_KEY_FILE exist and PROXY_SSL=on; when the variables point at paths that do not both hold existing files, the container refuses to start (see Mutual TLS between the proxy and the backend) |
/usr/local/apache2/conf/proxy.crt |
/etc/nginx/conf/proxy.crt |
| PROXY_SSL_CERT_KEY_FILE |
A string indicating the path to the PEM-encoded private key of the client certificate the proxy presents to the backend (used only together with PROXY_SSL_CERT_FILE) |
/usr/local/apache2/conf/proxy.key |
/etc/nginx/conf/proxy.key |
| PROXY_SSL_CIPHERS |
A string indicating the cipher suite to connect to the backend via TLS |
"ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384" |
- |
| PROXY_SSL_PROTOCOLS |
TLS protocols to enable for the connection to the backend |
"all -SSLv3 -TLSv1 -TLSv1.1" |
TLSv1.2 TLSv1.3 |
| PROXY_SSL |
SSL Proxy Engine Operation Switch |
off |
- |