Skip to content

Commit c75ec5f

Browse files
committed
fix: test policy clarification
1 parent 14b4613 commit c75ec5f

File tree

1 file changed

+50
-10
lines changed

1 file changed

+50
-10
lines changed

content/nap-waf/v5/admin-guide/policy-lifecycle-management.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -925,25 +925,65 @@ You should see the compiled policy bundle file in the directory structure.
925925

926926
To verify that the policy bundles are being deployed and enforced correctly:
927927

928-
1. **Update NGINX Configuration**
928+
1. **Get Deployment Information**
929929

930-
Use the Custom Resource name in your NGINX configuration:
931-
```nginx
932-
app_protect_policy_file dataguard-blocking;
930+
First, get the deployment name and cluster IP by running:
931+
```bash
932+
kubectl get all -n <namespace>
933+
```
934+
935+
In the output, look for:
936+
- **Service CLUSTER-IP**: Under the `service/` entries, note the `CLUSTER-IP` value (e.g., `10.43.205.101`)
937+
- **Deployment name**: Under the `deployment.apps/` entries, note the full deployment name (e.g., `localenv-plm-nginx-app-protect-deployment`)
938+
939+
Example output:
933940
```
941+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
942+
service/localenv-plm-nginx-app-protect-nginx NodePort 10.43.205.101 <none> 80:30970/TCP 21h
934943
935-
2. **Reload NGINX**
944+
NAME READY UP-TO-DATE AVAILABLE AGE
945+
deployment.apps/localenv-plm-nginx-app-protect-deployment 1/1 1 1 21h
946+
```
947+
948+
2. **Update NGINX Configuration via ConfigMap**
949+
950+
Edit the NGINX configuration through the ConfigMap:
951+
```bash
952+
kubectl edit configmap nginx-config -n <namespace>
953+
```
954+
955+
In the editor that opens:
956+
- Press `i` to enter insert mode
957+
- Find the active policy directive (e.g., `app_protect_policy_file app_protect_default_policy;`)
958+
- Comment it out by adding `#` at the beginning of the line
959+
- Find the line `# app_protect_policy_file custom_resource_name;`
960+
- Remove the `#` to uncomment it
961+
- Change `custom_resource_name` to `dataguard-blocking`
962+
- Press `Esc` to exit insert mode
963+
- Type `:wq` and press `Enter` to save and exit
964+
965+
3. **Restart the NGINX Deployment**
936966

937-
Reload NGINX to apply the new policy:
967+
Restart the deployment to apply the configuration changes (replace with your actual deployment name and namespace):
938968
```bash
939-
nginx -s reload
969+
kubectl rollout restart deployment <deployment-name> -n <namespace>
970+
```
971+
972+
Example:
973+
```bash
974+
kubectl rollout restart deployment localenv-plm-nginx-app-protect-deployment -n localenv-plm
940975
```
941976

942-
3. **Test Policy Enforcement**
977+
4. **Test Policy Enforcement**
978+
979+
Send a request that should be blocked by the dataguard policy using the cluster IP you noted earlier:
980+
```bash
981+
curl "http://<CLUSTER-IP>:80/680-15-0817"
982+
```
943983

944-
Send a request that should be blocked by the dataguard policy to verify it's working:
984+
Example:
945985
```bash
946-
curl "http://[CLUSTER-IP]:80/?a=<script>"
986+
curl "http://10.43.205.101:80/680-15-0817"
947987
```
948988

949989
The request should be blocked, confirming that PLM has successfully compiled and deployed the policy.

0 commit comments

Comments
 (0)