Skip to content

Commit 61e07b3

Browse files
committed
DIGITAL-723: Update docs re: nginx version in modsecurity build
1 parent a848250 commit 61e07b3

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

docs/runbooks/scripts/pipeline/cloud-gov-waf-version.sh.MD

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### Runbook for `cloud-gov-waf-version.sh`
22

3+
#### DEPRECATED!
4+
5+
The script described here has been replaced. We no longer try to determine the `new_nginx_version` dynamically. In the absence of a stable API for buildpack details, this turned out to be too unreliable for the deployment pipeline.
6+
7+
However, something like this might make sense as part of a build-and-commit pipeline to generate a modsecurity bundle for later deployment.
8+
39
#### Overview
410

511
The script `cloud-gov-waf-version.sh` is a bash script designed to check for new versions of an nginx buildpack and update the environment variables accordingly. It also initializes the necessary libraries and checks if there are new versions available. The script runs a series of commands to determine the current and new versions of the nginx buildpack, extracts the relevant nginx version from the GitHub releases page, and makes decisions based on whether an update is necessary.
@@ -66,7 +72,7 @@ current_nginx_version=$(cat /tmp/current_bp_version | pup 'table json{}' | jq -r
6672
and for the new version:
6773

6874
```bash
69-
curl -Ls "https://github.com/cloudfoundry/nginx-buildpack/releases/tag/v${NEW_BP_VERSION}" > /tmp/new_nginx_version
75+
curl -Ls "https://github.com/cloudfoundry/nginx-buildpack/releases/tag/v${NEW_BP_VERSION}" > /tmp/new_nginx_version
7076
declare default_nginx_binary_version
7177
default_nginx_binary_version=$(cat /tmp/new_nginx_version | pup 'table json{}' | jq -r '.[].children[].children[] | select(.children[].text == "nginx") | select(.children[].text | contains(".x")) | .children[].text' | grep -v nginx | sed 's/.\{1\}$//')
7278

docs/runbooks/scripts/pipeline/terraform-build-waf-plugin.sh.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This runbook is for the `terraform-build-waf-plugin.sh` script, which involves b
77

88
##### Variable Checks
99
The script begins with checks to ensure the presence of several environment variables, namely:
10-
- `${new_nginx_version}`
10+
- `${nginx_version}`
1111
- `${modsecurity_nginx_version}`
1212
- `${ubuntu_version}`
1313

terraform/applications/nginx-waf/.docker/RUNBOOK.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ The `Dockerfile` initializes a Docker image that is based on the Ubuntu `jammy`
1818
ARG ubuntu_version="jammy"
1919
```
2020
These environment variables are important because they allow the builder to specify the exact versions of the components that will be built.
21-
21+
2222
- `modsecurity_nginx_version` is determined by the version of the [OWASP ModSecurity NGINX repo](https://github.com/owasp-modsecurity/ModSecurity-nginx).
2323
- `nginx_version` is deterimined by the version shipped in version of NGINX buildpack that is in use. This can be determined by using the `cf buildpacks` command to see what version Cloud.gov is using. That buildpack version can then be referenced at the [NGINX Buildpack GitHub repository](https://github.com/cloudfoundry/nginx-buildpack/releases) to see what version of NGINX is shipped in that version of the buildpack.
2424
- `ubuntu_version` is determined by what version of `cflinuxfs` is in use. As of this documents creation, it is `cflinuxfs4`, based on Ubuntu Jammy.
25-
26-
The ModSecurity plugin needs to be build for the specific version of NGINX running.
25+
26+
The ModSecurity plugin needs to be built for the specific version of NGINX running.
2727

2828
2. **Apt Source List Modification**
2929
```
@@ -65,7 +65,7 @@ In addition to the `Dockerfile`, a `Makefile` provides a build pipeline to compi
6565

6666
1. **Building the Docker Image**
6767
```
68-
docker build --platform linux/amd64 --tag nginx-modsecurity --build-arg=modsecurity_nginx_version=${modsecurity_nginx_version} --build-arg=nginx_version=${new_nginx_version} --build-arg=ubuntu_version=${ubuntu_version} .
68+
docker build --platform linux/amd64 --tag nginx-modsecurity --build-arg=modsecurity_nginx_version=${modsecurity_nginx_version} --build-arg=nginx_version=${nginx_version} --build-arg=ubuntu_version=${ubuntu_version} .
6969
```
7070
The Makefile references the arguments for the builds and constructs the Docker image.
7171

@@ -92,4 +92,4 @@ In addition to the `Dockerfile`, a `Makefile` provides a build pipeline to compi
9292

9393
- **Incorrect Version Compilation**: You might receive warnings about mismatching versions if the environment variables passed to the Docker build (`modsecurity_nginx_version`, `nginx_version`, and `ubuntu_version`) do not match the expected versions inside the Dockerfile statements.
9494

95-
- **Module Compilation Failure**: If there are issues with the dynamic module compilation step (`make` command), review the configuration and build paths to ensure that there are no typos or missing paths declared within the `Dockerfile`.
95+
- **Module Compilation Failure**: If there are issues with the dynamic module compilation step (`make` command), review the configuration and build paths to ensure that there are no typos or missing paths declared within the `Dockerfile`.

terraform/applications/nginx-waf/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ The WAF (Nginx) server is an ingress proxy, routing traffic to various internal
88
- `Dockerfile`: Builds the Nginx `modsecurity` plugin.
99
- `Makefile`: Builds a new version of the Caddy binary, then copies the resulting binary to the `modules` directory above this one (`../modules`).
1010
- `modsecurity`: modsecurity configuration, utilizing OWASP CRS.
11-
- https://github.com/SpiderLabs/ModSecurity
12-
- https://github.com/SpiderLabs/ModSecurity-nginx
11+
- https://github.com/owasp-modsecurity/ModSecurity
12+
- https://github.com/owasp-modsecurity/ModSecurity-nginx
1313
- https://github.com/coreruleset/coreruleset/
1414
- `modules`: Contains the compiled Nginx modsecurity binary.
1515
- `nginx`: Contains Nginx configuration files.

0 commit comments

Comments
 (0)