Skip to content

Commit 55821ff

Browse files
committed
feat: Add overview and compiler pages
1 parent 41c09d7 commit 55821ff

File tree

4 files changed

+281
-14
lines changed

4 files changed

+281
-14
lines changed

content/waf/_index.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
# The title is the product name
3-
title: F5 NGINX App Protect WAF
3+
title: "F5 WAF for NGINX"
44
# The URL is the base of the deployed path, becoming "docs.nginx.com/<url>/<other-pages>"
5-
url: /app-protect-waf/
5+
url: /waf/
66
# The cascade directive applies its nested parameters down the page tree until overwritten
77
cascade:
88
# The logo file is resolved from the theme, in the folder /static/images/icons/
@@ -29,17 +29,11 @@ Defend your applications and APIs with a software security solution that seamles
2929

3030
{{<card-layout>}}
3131
{{<card-section showAsCards="true" isFeaturedSection="true">}}
32-
{{<card title="Install NGINX App Protect WAF" titleUrl="/waf/install" icon="chevrons-right" >}}
32+
{{<card title="Install NGINX App Protect WAF" titleUrl="/waf/install" >}}
3333
Explore the methods available to deploy NGINX App Protect WAF in your environment.
3434
{{</card>}}
35-
<!-- The titleURL and icon are both optional -->
36-
<!-- Lucide icon names can be found at https://lucide.dev/icons/ -->
3735
{{<card title="Changelog" titleUrl="/waf/changelog" icon="archive">}}
3836
Review the latest changes and improvements to NGINX App Protect WAF.
3937
{{</card>}}
4038
{{</card-section>}}
4139
{{</card-layout>}}
42-
43-
<!-- ## Other content
44-
45-
[//]: # "You can add any extra content for the page here, such as additional cards, diagrams or text." -->

content/waf/fundamentals/overview.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,19 @@ It is also an opportunity to explain the difference between NGINX App Protect ve
2020

2121
The text here will likely be synthesized from the Overview descriptions at the top of the [Administration Guides]({{< ref "/nap-waf/v4/admin-guide/install.md#overview" >}}), but there's also detail from [F5.com](https://www.f5.com/products/nginx/nginx-app-protect) that can be added.
2222

23-
{{</ call-out>}}
23+
{{< /call-out >}}
24+
25+
[F5 WAF for NGINX](https://www.f5.com/products/nginx/nginx-app-protect) is an advanced, lightweight and high-performance web application firewall (WAF) for applications and APIs.
26+
27+
It provides protection for the OWASP Top 10, with additional functionality:
28+
29+
- HTTP response inspection and protocol compliance
30+
- Data schema validation (JSON & XML)
31+
- Meta character checking
32+
- Disallowing file types
33+
34+
For full details, see the [Supported Security Policy features]({{< ref "/waf/policies/configuration.md">}}).
35+
36+
F5 WAF for NGINX is part of the [NGINX One](https://www.f5.com/products/nginx/one) premium packages and runs natively on [NGINX Plus](https://www.f5.com/products/nginx/nginx-plus) and [NGINX Ingress Controller](https://www.f5.com/products/nginx/nginx-ingress-controller).
37+
38+
It is platform-agnostic and supports deployment options ranging from edge load balancers to individual pods in Kubernetes clusters.

content/waf/policies/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ The design intention for this page is to as a single source of truth to replace
1818

1919
Outside of the overlapping information for Policy configuration, the existing pages also include general configuration information, such as for NGINX App Protect WAF itself. This detail can be added to a separate page, ensuring that each document acts as a solution for exactly one problem at a time.
2020

21-
{{</ call-out>}}
21+
{{</ call-out>}}
22+
23+
## Supported Security Policy features

content/waf/tools/compiler.md

Lines changed: 259 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
# We use sentence case and present imperative tone
3-
title: "Build and use the NGINX App Protect WAF Compiler"
3+
title: "Build and use the F5 WAF for NGINX compiler"
44
# Weights are assigned in increments of 100: determines sorting order
55
weight: 200
66
# Creates a table of contents and sidebar, useful for large documents
7-
toc: false
7+
toc: true
88
# Types have a 1:1 relationship with Hugo archetypes, so you shouldn't need to change this
99
nd-content-type: how-to
1010
# Intended for internal catalogue and search, case sensitive:
@@ -18,4 +18,260 @@ The design intention for this page is to act as a new place for the v5 [NGINX Ap
1818

1919
Information that isn't critically important to a specific task should be moved to its own page. This page is a good example of one that doesn't need to be broken up, but is still moved into a peripheral "Tools" section for when it is necessary.
2020

21-
{{</ call-out>}}
21+
**13/08/2025:** What version of F5 WAF does this work with?
22+
23+
{{</ call-out>}}
24+
25+
This document describes how to use the F5 WAF for NGINX compiler, a tool for converting security policies and logging profiles from JSON to a bundle file that F5 WAF can process and apply.
26+
27+
You can use it to get the latest security updates for Attack Signatures, Threat Campaigns and Bot Signatures. The compiler is packaged as a Docker image and can executed using the Docker CLI or as part of a continuous integration/ continuous delivery (CI/CD) pipeline.
28+
29+
One or more bundle files can be referenced in the NGINX configuration file, and you can configure global settings such as the cookie seed and user-defined signatures.
30+
31+
32+
## Before you begin
33+
34+
To complete this guide, you will need the following prerequisites:
35+
36+
- [Docker](https://docs.docker.com/get-started/get-docker/)
37+
- An NGINX Plus subscription (purchased or trial)
38+
- Credentials to the [MyF5 Customer Portal](https://account.f5.com/myf5), provided by email from F5, Inc.
39+
40+
## Download your subscription credential files
41+
42+
{{< include "licensing-and-reporting/download-certificates-from-myf5.md" >}}
43+
44+
## Set up Docker for the F5 Container Registry
45+
46+
Create a directory and copy your certificate and key to this directory:
47+
48+
```shell
49+
mkdir -p /etc/docker/certs.d/private-registry.nginx.com
50+
cp <path-to-your-nginx-repo.crt> /etc/docker/certs.d/private-registry.nginx.com/client.cert
51+
cp <path-to-your-nginx-repo.key> /etc/docker/certs.d/private-registry.nginx.com/client.key
52+
```
53+
54+
Log in to the Docker registry:
55+
56+
```shell
57+
docker login private-registry.nginx.com
58+
```
59+
60+
## Create the Dockerfile
61+
62+
```dockerfile
63+
# syntax=docker/dockerfile:1
64+
ARG BASE_IMAGE=private-registry.nginx.com/nap/waf-compiler:<version-tag>
65+
FROM ${BASE_IMAGE}
66+
67+
# Installing packages as root
68+
USER root
69+
70+
ENV DEBIAN_FRONTEND="noninteractive"
71+
72+
RUN --mount=type=secret,id=nginx-crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
73+
--mount=type=secret,id=nginx-key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
74+
apt-get update \
75+
&& apt-get install -y \
76+
apt-transport-https \
77+
lsb-release \
78+
ca-certificates \
79+
wget \
80+
gnupg2 \
81+
ubuntu-keyring \
82+
&& wget -qO - https://cs.nginx.com/static/keys/app-protect-security-updates.key | gpg --dearmor | \
83+
tee /usr/share/keyrings/app-protect-security-updates.gpg >/dev/null \
84+
&& printf "deb [signed-by=/usr/share/keyrings/app-protect-security-updates.gpg] \
85+
https://pkgs.nginx.com/app-protect-security-updates/ubuntu `lsb_release -cs` nginx-plus\n" | \
86+
tee /etc/apt/sources.list.d/nginx-app-protect.list \
87+
&& wget -P /etc/apt/apt.conf.d https://cs.nginx.com/static/files/90pkgs-nginx \
88+
&& apt-get update \
89+
&& apt-get install -y \
90+
app-protect-attack-signatures \
91+
app-protect-bot-signatures \
92+
app-protect-threat-campaigns \
93+
&& apt-get clean \
94+
&& rm -rf /var/lib/apt/lists/*
95+
96+
# non-root default user (UID 101)
97+
USER nginx
98+
```
99+
100+
{{< call-out "note" >}}
101+
102+
You can can upgrade or downgrade one of the Signatures by specifying a specific version, such as _app-protect-attack-signatures-2020.04.30_.
103+
104+
{{< /call-out >}}
105+
106+
You can use the Docker registry API to list the available image tags.
107+
108+
Replace `<path-to-your-nginx-repo.key>` with the location of your client key and `<path-to-your-nginx-repo.crt>` with the location of your client certificate.
109+
110+
```shell
111+
curl -s https://private-registry.nginx.com/v2/nap/waf-compiler/tags/list --key <path-to-your-nginx-repo.key> --cert <path-to-your-nginx-repo.crt>
112+
```
113+
```json
114+
{
115+
"name": "nap/waf-compiler",
116+
"tags": [
117+
"1.0.0",
118+
"5.1.0",
119+
"5.2.0"
120+
]
121+
}
122+
```
123+
124+
The [jq](https://jqlang.github.io/jq/) command was used to format the example output
125+
126+
127+
## Build the container image
128+
129+
Run the following command to build your image, where `waf-compiler-<version-tag>:custom` is an example of the image tag:
130+
131+
```shell
132+
sudo docker build --no-cache --platform linux/amd64 \
133+
--secret id=nginx-crt,src=nginx-repo.crt \
134+
--secret id=nginx-key,src=nginx-repo.key \
135+
-t waf-compiler-<version-tag>:custom .
136+
```
137+
138+
{{< call-out "warning" >}}
139+
140+
Never upload your F5 WAF for NGINX images to a public container registry such as Docker Hub. Doing so violates your license agreement.
141+
142+
{{< /call-out >}}
143+
144+
## Using the compiler
145+
146+
This section uses `version-tag` as a placeholder in its examples, following the previous section. Ensure that all input files are accessible to UID 101.
147+
148+
### Compile a security policy
149+
150+
To compile a security policy from a JSON file and create a policy bundle, run the following command:
151+
152+
```shell
153+
docker run --rm \
154+
-v $(pwd):$(pwd) \
155+
waf-compiler-<version-tag>:custom \
156+
-p $(pwd)/policy.json -o $(pwd)/compiled_policy.tgz
157+
```
158+
159+
{{< call-out "warning" >}}
160+
161+
Ensure that the output directory is writable, otherwise you may encounter a permission denied error.
162+
163+
{{< /call-out >}}
164+
165+
To use multiple policy bundles within a single NGINX configuration, you must supply a [global settings](#global-settings) JSON file.
166+
167+
This ensures that all bundles have a common foundation such as cookie seed and user-defined signatures.
168+
169+
An example `global_settings.json` might look as follows:
170+
171+
```json
172+
{
173+
"waf-settings": {
174+
"cookie-protection": {
175+
"seed": "<seed value>"
176+
}
177+
}
178+
}
179+
```
180+
181+
To compile a policy with global settings, add the `-g` parameter:
182+
183+
```shell
184+
docker run --rm \
185+
-v $(pwd):$(pwd) \
186+
waf-compiler-1.0.0:custom \
187+
-g $(pwd)/global_settings.json -p $(pwd)/policy.json -o $(pwd)/compiled_policy.tgz
188+
```
189+
190+
You can incorporate the source of the policy (as `policy.json`) or logging profile (as `logging_profile.json`) into the final bundle using the `-include-source` parameter.
191+
192+
```shell
193+
docker run --rm \
194+
-v $(pwd):$(pwd) \
195+
waf-compiler-1.0.0:custom \
196+
-include-source -full-export -g $(pwd)/global_settings.json -p $(pwd)/policy.json -o $(pwd)/compiled_policy.tgz
197+
```
198+
199+
This will transform any configuration that relies on external references into an inline configuration within the bundled source.
200+
201+
Additionally, when `-include-source` is combined with `-full-export`, the policy.json within the bundle will contain the entire source policy, including any default settings from the base template.
202+
203+
### Compile a logging profile
204+
205+
To compile a logging profile, execute the command below:
206+
207+
```shell
208+
docker run \
209+
-v $(pwd):$(pwd) \
210+
waf-compiler-<version-tag>:custom \
211+
-l $(pwd)/log_01.json -o $(pwd)/log01.tgz
212+
```
213+
214+
### View bundle information
215+
216+
To view information about a bundle file, such as attack signatures versions, use the following command:
217+
218+
```shell
219+
docker run \
220+
-v $(pwd):$(pwd) \
221+
waf-compiler-<version-tag>:custom \
222+
-dump -bundle $(pwd)/compiled_policy.tgz
223+
```
224+
225+
## Global settings
226+
227+
The global settings allows configuration of the following items:
228+
229+
### cookie-protection
230+
231+
{{<bootstrap-table "table table-striped table-bordered">}}
232+
| Field Name | Type | Description |
233+
|-|-|-|
234+
| seed | string | The seed value is used by F5 NGINX App Protect WAF to generate the encryption key for the cookies it creates. These cookies are used for various purposes such as validating the integrity of the cookies generated by the application. Use a random alphanumeric string of at least 20 characters length (but not more than 1000 characters). |
235+
{{</bootstrap-table>}}
236+
237+
### user-defined-signatures
238+
239+
{{<bootstrap-table "table table-striped table-bordered">}}
240+
| Field Name | Reference | Type | Description |
241+
|-|-|-|-|
242+
| $ref | Yes | string | Path to the file that contains the user defined signatures. |
243+
{{</bootstrap-table>}}
244+
245+
#### Example
246+
247+
```json
248+
{
249+
"waf-settings": {
250+
"cookie-protection": {
251+
"seed": "80miIOiSeXfvNBiDJV4t"
252+
},
253+
"user-defined-signatures": [
254+
{
255+
"$ref": "file:///policies/uds.json"
256+
}
257+
]
258+
}
259+
}
260+
```
261+
262+
{{< call-out "warning" >}}
263+
264+
When deploying multiple scalability instances (Such as Kubernetes deployment replicas), ensure that all policy bundles are compiled with the same global settings and security updates.
265+
266+
{{< /call-out >}}
267+
268+
269+
## Using the compiler in a CI/CD process
270+
271+
When executing commands inside the compiler container, ensure that you use `/opt/app_protect/bin/apcompile` as the compiler binary.
272+
273+
This is particularly important if you're overriding the default entry point as part of a CI/CD process.
274+
275+
```shell
276+
/opt/app_protect/bin/apcompile -g /path/to/global_settings.json -p /path/to/policy.json -o /path/to/compiled_policy.tgz
277+
```

0 commit comments

Comments
 (0)