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

WAF v5 docs update #5719

Merged
merged 87 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
fecb959
WIP - WAFv5 docs
jjngx Jun 10, 2024
1b1f293
Update make targets
jjngx Jun 10, 2024
44393ac
Update troubleshooting doc, re-ordering pages
jjngx Jun 10, 2024
1249c75
Bump redhat/ubi8 from `2a5d234` to `143123d` in /build (#5715)
dependabot[bot] Jun 10, 2024
cde8d24
[pre-commit.ci] pre-commit autoupdate (#5724)
pre-commit-ci[bot] Jun 11, 2024
6b98b56
Bump docker/build-push-action from 5.3.0 to 5.4.0 in the actions grou…
dependabot[bot] Jun 11, 2024
678e85e
Docs - pulling NIC WAF images
jjngx Jun 11, 2024
26052a1
Docs - pulling NIC WAF images
jjngx Jun 11, 2024
36012e0
Building NIC - make targets
jjngx Jun 11, 2024
dd7df3a
Update installation doc
jjngx Jun 11, 2024
ceaf8f4
Update installation docs for WAF v5
jjngx Jun 11, 2024
deed446
Fix merge conflict
jjngx Jun 12, 2024
0b794a6
Remove ref to json policies from WAFv5 doc, update waf docker image tags
jjngx Jun 12, 2024
74127b9
Merge branch 'main' into docs/waf5
jjngx Jun 13, 2024
f191e5f
Merge branch 'main' into docs/waf5
jjngx Jun 13, 2024
100c38b
Merge branch 'main' into docs/waf5
jjngx Jun 14, 2024
f95acbd
Merge branch 'main' into docs/waf5
jjngx Jun 14, 2024
3312260
Merge branch 'main' into docs/waf5
jjngx Jun 17, 2024
9dc5a70
Fix hugo build
jjngx Jun 17, 2024
9ae8176
Merge branch 'main' into docs/waf5
jjngx Jun 17, 2024
d6acfbc
Merge branch 'main' into docs/waf5
jjngx Jun 17, 2024
0de914b
Merge branch 'main' into docs/waf5
shaun-nx Jun 18, 2024
8aabfc6
Add waf5 bundle example
jjngx Jun 18, 2024
ae88c06
Merge branch 'main' into docs/waf5
jjngx Jun 18, 2024
ca2ba78
Merge branch 'main' into docs/waf5
shaun-nx Jun 19, 2024
3ff5e9b
Merge branch 'main' into docs/waf5
shaun-nx Jun 19, 2024
130bb8b
Remove examples
shaun-nx Jun 19, 2024
3460ce7
Merge branch 'main' into docs/waf5
shaun-nx Jun 19, 2024
70fcfd9
Update waf v5 configuration guide
shaun-nx Jun 19, 2024
48a34ac
Merge branch 'main' into docs/waf5
shaun-nx Jun 19, 2024
56e06b7
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
jjngx Jun 19, 2024
d33274f
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
jjngx Jun 19, 2024
4c66949
Update docs/content/installation/integrations/app-protect-waf-v5/inst…
jjngx Jun 19, 2024
8682239
Update docs/content/installation/integrations/app-protect-waf-v5/_ind…
jjngx Jun 19, 2024
33b1cca
Merge branch 'main' into docs/waf5
jjngx Jun 19, 2024
d60b72c
Fix a link
jjngx Jun 19, 2024
31aa89d
Fix rendering issue
jjngx Jun 19, 2024
f5fa9e7
Remove ref to WAF from WAFv5 section
jjngx Jun 19, 2024
5b072b7
Merge branch 'main' into docs/waf5
ADubhlaoich Jun 19, 2024
331888c
Merge branch 'main' into docs/waf5
ADubhlaoich Jun 20, 2024
0d8facb
Merge branch 'main' into docs/waf5
ADubhlaoich Jun 20, 2024
7124f5a
Remove references to WAF from WAF v5 docs
jjngx Jun 20, 2024
7a53380
Merge branch 'main' into docs/waf5
oseoin Jun 20, 2024
c659899
Merge branch 'main' into docs/waf5
jjngx Jun 21, 2024
da351e8
Update config steps for policy bundle
jjngx Jun 21, 2024
5db5f53
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
jjngx Jun 21, 2024
f0b73cb
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
jjngx Jun 21, 2024
9741530
Update docs/content/installation/integrations/app-protect-waf-v5/inst…
jjngx Jun 21, 2024
c8b276a
Use hugo native syntax for notes
jjngx Jun 21, 2024
3f7b2ce
Don't use explicit anchors
jjngx Jun 21, 2024
5a7d560
Update notes
jjngx Jun 21, 2024
683cb03
Add helm install and configuration stage for waf v5
shaun-nx Jun 21, 2024
bab716b
Update helm deployment example
shaun-nx Jun 21, 2024
3e5c90c
Merge branch 'main' into docs/waf5
shaun-nx Jun 21, 2024
9f1ed0b
Corret typo and add note regarding default volunes with emptyDir
shaun-nx Jun 21, 2024
17d6dd6
Merge branch 'main' into docs/waf5
shaun-nx Jun 21, 2024
9c1858b
Correct typo
shaun-nx Jun 24, 2024
76fcc90
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
119a45f
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
1c46455
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
499c38a
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
6cefd48
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
d73c743
Move the RBAC section into the Install With Manifests section + remov…
shaun-nx Jun 24, 2024
0b3a82a
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
f9ebec1
Merge branch 'main' into docs/waf5
ADubhlaoich Jun 24, 2024
ca3bd9f
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
618ef32
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
b838e21
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
0e2032f
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
6932cc2
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
d076fd6
Update docs/content/installation/integrations/app-protect-waf-v5/conf…
shaun-nx Jun 24, 2024
b0579dc
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
5443259
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
a6bec22
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
560e77c
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
30405ba
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
bde1152
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
2a874be
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
1ffaf2b
Update docs/content/installation/integrations/app-protect-waf-v5/trou…
shaun-nx Jun 24, 2024
13902f7
Merge branch 'main' into docs/waf5
shaun-nx Jun 24, 2024
43bb219
Remove troubleshooting guide
shaun-nx Jun 24, 2024
40f4412
Undo changes in Dockerfile
jjngx Jun 25, 2024
9b0ca60
Merge branch 'main' into docs/waf5
vepatel Jun 25, 2024
f8d0640
Newline in dockerfile
shaun-nx Jun 25, 2024
355ea01
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 25, 2024
1577611
Update NIC version
jjngx Jun 25, 2024
31dce9c
Re-add troubleshooting guide for v4
shaun-nx Jun 25, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ Key targets include:
| _alpine-image_ | Builds an Alpine-based image with NGINX. |
| _alpine-image-plus_ | Builds an Alpine-based image with NGINX Plus. |
| _alpine-image-plus-fips_ | Builds an Alpine-based image with NGINX Plus and FIPS. |
| _alpine-image-nap-v5-plus-fips_ | Builds an Alpine-based image with NGINX Plus, the [NGINX App Protect WAF v5](/nginx-app-protect/) module and FIPS. |
| _debian-image_ | Builds a Debian-based image with NGINX. |
| _debian-image-plus_ | Builds a Debian-based image with NGINX Plus. |
| _debian-image-nap-plus_ | Builds a Debian-based image with NGINX Plus and the [NGINX App Protect WAF](/nginx-app-protect/) module. |
| _debian-image-nap-v5-plus_ | Builds a Debian-based image with NGINX Plus and the [NGINX App Protect WAF v5](/nginx-app-protect/) module. |
| _debian-image-dos-plus_ | Builds a Debian-based image with NGINX Plus and the [NGINX App Protect DoS](/nginx-app-protect-dos/) module. |
| _debian-image-nap-dos-plus_ | Builds a Debian-based image with NGINX Plus, [NGINX App Protect WAF](/nginx-app-protect/) and [NGINX App Protect DoS](/nginx-app-protect-dos/) modules. |
| _ubi-image_ | Builds a UBI-based image with NGINX for [OpenShift](https://www.openshift.com/) clusters. |
| _ubi-image-plus_ | Builds a UBI-based image with NGINX Plus for [OpenShift](https://www.openshift.com/) clusters. |
| _ubi-image-nap-plus_ | Builds a UBI-based image with NGINX Plus and the [NGINX App Protect WAF](/nginx-app-protect/) module for [OpenShift](https://www.openshift.com/) clusters. |
| _ubi-image-nap-v5-plus_ | Builds a UBI-based image with NGINX Plus and the [NGINX App Protect WAF v5](/nginx-app-protect/) module for [OpenShift](https://www.openshift.com/) clusters. |
| _ubi-image-dos-plus_ | Builds a UBI-based image with NGINX Plus and the [NGINX App Protect DoS](/nginx-app-protect-dos/) module for [OpenShift](https://www.openshift.com/) clusters. |
| _ubi-image-nap-dos-plus_ | <p>Builds a UBI-based image with NGINX Plus, [NGINX App Protect WAF](/nginx-app-protect/) and the [NGINX App Protect DoS](/nginx-app-protect-dos/) module for [OpenShift](https://www.openshift.com/) clusters.</p> <p> **Important**: Save your RHEL organization and activation keys in a file named _rhel_license_ at the project root.</p> <p> For instance:</p> <pre>RHEL_ORGANIZATION=1111111<br />RHEL_ACTIVATION_KEY=your-key</pre>|
{{</bootstrap-table>}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: NGINX App Protect DoS
description: Learn how to use NGINX Ingress Controller for Kubernetes with NGINX App Protect DoS.
weight: 200
weight: 300
menu:
docs:
parent: Integrations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: NGINX App Protect WAF v5
description: Learn how to use NGINX Ingress Controller for Kubernetes with NGINX App Protect version 5.
weight: 200
menu:
docs:
parent: NGINX Ingress Controller
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
docs: DOCS-000
title: Configuration
toc: true
weight: 200
---


## Overview

This document explains how to use F5 NGINX Ingress Controller to configure [NGINX App Protect WAF v5](https://docs.nginx.com/nginx-app-protect-waf/v5/).
jjngx marked this conversation as resolved.
Show resolved Hide resolved

{{< note >}} Check out the complete NGINX Ingress Controller with NGINX App Protect WAF example resources on GitHub [for VirtualServer resources](https://github.com/nginxinc/kubernetes-ingress/tree/v3.6.0/examples/custom-resources/app-protect-waf-v5) and [for Ingress resources](https://github.com/nginxinc/kubernetes-ingress/tree/v3.6.0/examples/ingress-resources/app-protect-waf-v5).{{< /note >}}


## Global Configuration

NGINX Ingress Controller has global configuration parameters that match those in NGINX App Protect WAF. They are found in the [ConfigMap resource]({{< relref "configuration/global-configuration/configmap-resource.md#modules" >}}): the NGINX App Protect WAF parameters are prefixed with `app-protect*`.

## Enable NGINX App Protect WAF v5

NGINX App Protect WAF can be enabled and configured for custom resources (VirtualServer, VirtualServerRoute) or Ingress resources.

- For custom resources, you need to create a Policy Custom Resource referencing a policy bundle, then add it to the VirtualServer definition. Additional detail can be found in the [Policy Resource documentation]({{< relref "configuration/policy-resource.md#waf" >}}).
- For Ingress resources, apply the [`app-protect` annotations]({{< relref "configuration/ingress-resources/advanced-configuration-with-annotations.md#app-protect" >}}) to each desired resource.



## NGINX App Protect WAF Bundles {#waf-bundles}

You define App Protect WAF bundles for VirtualServer custom resources by creating policy bundles and putting them on a mounted volume accessible from NGINX Ingress Controller.

Before applying a policy, a WAF policy bundle must be created, then copied to a volume mounted to `/etc/app_protect/bundles`.

{{< note >}} NGINX Ingress Controller supports `securityLogs` for policy bundles. Log bundles must also be copied to a volume mounted to `/etc/app_protect/bundles`. {{< /note >}}

This example shows how a policy is configured by referencing a generated WAF Policy Bundle:


```yaml
apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
name: <policy_name>
spec:
waf:
enable: true
apBundle: "<policy_bundle_name>.tgz"
```
This example shows the same policy as above but with a log bundle used for security log configuration:
```yaml
apiVersion: k8s.nginx.org/v1
kind: Policy
metadata:
name: <policy_name>
spec:
waf:
enable: true
apBundle: "<policy_bundle_name>.tgz"
securityLogs:
- enable: true
apLogBundle: "<log_bundle_name>.tgz"
logDest: "syslog:server=syslog-svc.default:514"
```
## Configuration in NGINX Plus Ingress Controller using Virtual Server Resource
This example shows how to deploy NGINX Ingress Controller with NGINX Plus and NGINX App Protect WAF v5, deploy a simple web application, and then configure load balancing and WAF protection for that application using the VirtualServer resource.
{{< note >}} You can find the files for this example on [GitHub](https://github.com/nginxinc/kubernetes-ingress/tree/v3.6.0/examples/custom-resources/app-protect-waf/app-protect-waf-v5).{{< /note >}}
## Prerequisites
1. Follow the installation [instructions]({{< relref "installation/integrations/app-protect-waf-v5/installation.md" >}}) to deploy NGINX Ingress Controller with NGINX Plus and NGINX App Protect WAF version 5.
2. Save the public IP address of NGINX Ingress Controller into a shell variable:
```shell
IC_IP=XXX.YYY.ZZZ.III
```

3. Save the HTTP port of NGINX Ingress Controller into a shell variable:

```shell
IC_HTTP_PORT=<port number>
```

### Step 1. Deploy a Web Application

Create the application deployment and service:

```shell
kubectl apply -f https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v3.6.0/examples/custom-resources/app-protect-waf-v5/webapp.yaml
```

### Step 2. Create the Syslog Service

Create the syslog service and pod for the NGINX App Protect WAF security logs:


```shell
kubectl apply -f https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v3.6.0/examples/custom-resources/app-protect-waf-v5/syslog.yaml
```

### Step 3 - Deploy the WAF Policy


{{< note >}} Configuration settings in the Policy resource enable WAF protection by configuring NGINX App Protect WAF with the log configuration created in the previous step. The policy bundle referenced as `your_policy_bundle_name.tgz` need to be created and placed in the `/etc/app_protect/bundles` volume first.{{</ note >}}

Create and deploy the WAF policy.

```shell
kubectl apply -f https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v3.6.0/examples/custom-resources/app-protect-waf-v5/waf.yaml
```


### Step 4 - Configure Load Balancing


{{< note >}} VirtualServer references the `waf-policy` created in Step 3.{{</ note >}}

1. Create the VirtualServer Resource:

```shell
kubectl apply -f https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v3.6.0/examples/custom-resources/app-protect-waf-v5/virtual-server.yaml
```


### Step 5 - Test the Application

To access the application, curl the coffee and the tea services. We'll use the `--resolve` option to set the Host header of a request with `webapp.example.com`
1. Send a request to the application:
```shell
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP http://webapp.example.com:$IC_HTTP_PORT/
```
```shell
Server address: 10.12.0.18:80
Server name: webapp-7586895968-r26zn
```
1. Try to send a request with a suspicious URL:
```shell
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP "http://webapp.example.com:$IC_HTTP_PORT/<script>"
```
```shell
<html><head><title>Request Rejected</title></head><body>
```
1. Check the security logs in the syslog pod:
```shell
kubectl exec -it <SYSLOG_POD> -- cat /var/log/messages
```
### Example VirtualServer configuration
The GitHub repository has a full [VirtualServer example](https://raw.githubusercontent.com/nginxinc/kubernetes-ingress/v3.6.0/examples/custom-resources/app-protect-waf-v5/webapp.yaml).
```yaml
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: webapp
spec:
host: webapp.example.com
policies:
- name: waf-policy
upstreams:
- name: webapp
service: webapp-svc
port: 80
routes:
- path: /
action:
pass: webapp
```
Loading