Skip to content

Commit 1cd29e5

Browse files
authored
Merge branch 'main' into deps/image-update-main-00f989f4
2 parents 92b7a36 + ae73e34 commit 1cd29e5

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

site/content/installation/integrations/app-protect-waf-v5/compile-waf-policies.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
2-
docs: DOCS-000
32
title: Compile NGINX App Protect WAF policies using NGINX Instance Manager
4-
toc: true
53
weight: 300
4+
toc: true
5+
type: how-to
6+
product: NIC
7+
docs: DOCS-000
68
---
79

810
## Overview
@@ -15,12 +17,17 @@ By using NGINX Instance Manager to compile WAF policies, the policy bundle can a
1517

1618
The following steps describe how to use the NGINX Instance Manager API to create a new security policy, compile a bundle, then add it to NGINX Ingress Controller.
1719

20+
---
21+
1822
## Before you start
23+
1924
### Requirements
2025
- A working [NGINX Instance Manager](https://docs.nginx.com/nginx-instance-manager/deploy/) instance.
2126
- An [NGINX Instance Manager user](https://docs.nginx.com/nginx-instance-manager/admin-guide/rbac/overview-rbac/) for API requests.
2227
- A NGINX Ingress Controller [deployment with NGINX App Protect WAF]({{< relref "/installation/integrations/app-protect-waf/installation.md" >}}).
2328

29+
---
30+
2431
## Create a new security policy
2532

2633
{{< tip >}} You can skip this step if you intend to use an existing security policy. {{< /tip >}}
@@ -80,6 +87,8 @@ It is one of two unique IDs we will use to download the bundle: it will be refer
8087

8188
{{< /important >}}
8289

90+
---
91+
8392
## Create a new security bundle
8493

8594
Once you have created (Or selected) a security policy, [create a security bundle](https://docs.nginx.com/nginx-instance-manager/nginx-app-protect/manage-waf-security-policies/#create-security-policy-bundles) using the API. The version in the bundle you create **must** match the WAF compiler version you intend to use.
@@ -180,6 +189,8 @@ It is one of two unique IDs we will use to download the bundle: it will be refer
180189

181190
{{< /important >}}
182191

192+
---
193+
183194
## Download the security bundle
184195

185196
Use a GET request to download the security bundle using the policy and bundle IDs:
@@ -196,7 +207,9 @@ curl -X GET -k 'https://127.0.0.1/api/platform/v1/security/policies/6af9f261-658
196207
| jq -r '.content' | base64 -d > security-policy-bundle.tgz
197208
```
198209

199-
## Add volumes and volumeMounts to NGINX Ingress Controller
210+
---
211+
212+
## Add volumes and volumeMounts
200213

201214
To use WAF security bundles, your NGINX Ingress Controller instance must have *volumes* and *volumeMounts*. Precise paths are used to detect when bundles are uploaded to the cluster.
202215

@@ -210,7 +223,7 @@ persistentVolumeClaim:
210223

211224
volumeMounts:
212225
- name: <volume_mount_name>
213-
mountPath: /etc/nginx/waf/bundles
226+
mountPath: /etc/app_protect/bundles
214227
```
215228
216229
A full example of a deployment file with `volumes` and `volumeMounts` could look like the following:
@@ -281,7 +294,7 @@ spec:
281294
- NET_BIND_SERVICE
282295
volumeMounts:
283296
- name: bundle-mount
284-
mountPath: /etc/nginx/waf/bundles
297+
mountPath: /etc/app_protect/bundles
285298
env:
286299
- name: POD_NAMESPACE
287300
valueFrom:
@@ -297,9 +310,11 @@ spec:
297310
- -external-service=nginx-ingress
298311
```
299312

313+
---
314+
300315
## Create WAF policy
301316

302-
To process a bundle, you must create a new WAF policy. This policy is added to `/etc/nginx/waf/bundles`, allowing NGINX Ingress Controller to load it into WAF.
317+
To process a bundle, you must create a new WAF policy. This policy is added to `/etc/app_protect/bundles`, allowing NGINX Ingress Controller to load it into WAF.
303318

304319
The example below shows the required WAF policy, and the *apBundle* and *apLogConf* fields you must use for the security bundle binary file (A tar ball).
305320

@@ -318,6 +333,8 @@ spec:
318333
logDest: "<security-log-destination-URL>"
319334
```
320335

336+
---
337+
321338
## Create VirtualServer resource and apply policy
322339

323340
Once the WAF policy has been created, link it to your *virtualServer resource*.
@@ -341,12 +358,14 @@ spec:
341358
pass: webapp
342359
```
343360

361+
---
362+
344363
## Upload the security bundle
345364

346-
To finish adding a security bundle, the binary file to the NGINX Ingress Controller pods.
365+
To finish adding a security bundle, upload the binary file to the NGINX Ingress Controller pods.
347366

348367
```shell
349-
kubectl cp /your/local/path/<bundle_name>.tgz <namespace>/<pod-name>:etc/nginx/waf/bundles<bundle_name>.tgz
368+
kubectl cp /your/local/path/<bundle_name>.tgz <namespace>/<pod-name>:etc/app_protect/bundles<bundle_name>.tgz -c nginx-plus-ingress
350369
```
351370

352371
Once the bundle has been uploaded to the cluster, NGINX Ingress Controller will detect and automatically load the new WAF policy.

0 commit comments

Comments
 (0)