You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Only downloads policy bundles when content changes
58
+
- New policies applied immediately upon detection
59
+
53
60
### Policy Attachment Strategy
54
61
55
62
The design uses **inherited policy attachment** following Gateway API best practices:
56
63
57
64
-**Gateway-level policies** provide default protection for all routes attached to the Gateway
58
65
-**Route-level policies** can override Gateway-level policies for specific routes requiring different protection
66
+
- NB: cannot _disable_ WAF protection on a per route level, but the Route level WAFPolicy configuration will completely override the Gateway level WAFPolicy configuration
59
67
-**Policy precedence**: More specific policies (Route-level) override less specific policies (Gateway-level)
60
68
-**Automatic inheritance**: New routes automatically receive Gateway-level protection without explicit configuration
61
69
@@ -246,8 +254,6 @@ spec:
246
254
247
255
### Policy Development Workflow
248
256
249
-
Given NAP v5 constraints, users must follow this workflow:
250
-
251
257
1. **Policy Development**: Write WAF policies using NAP v5 JSON schema
252
258
2. **Log Profile Development**: Create custom logging profiles or use built-in profiles (log_all, log_blocked, etc.)
253
259
3. **Compilation**: Use NAP v5 compiler tools to create policy and logging profile bundles
@@ -257,6 +263,24 @@ Given NAP v5 constraints, users must follow this workflow:
257
263
258
264
**Note**: Policy enforcement mode and behavior are defined within the compiled NAP policy itself. Security logging profiles can be either built-in names or custom compiled bundles.
- Only downloads policy bundles when content changes
287
-
- New policies applied immediately upon detection
288
-
289
302
### Security Logging Configuration
290
303
291
304
The securityLogs section supports multiple logging configurations, each generating an `app_protect_security_log` directive:
@@ -700,7 +713,45 @@ This label will help with discoverability and will be used by the planned Gatewa
700
713
701
714
According to the [Policy and Metaresources GEP](https://gateway-api.sigs.k8s.io/geps/gep-713/), the `WafPolicy` CRD must include a `status` stanza with a slice of Conditions.
702
715
703
-
The `Accepted` Condition must be populated on the `WafPolicy` CRD using the reasons defined in the [PolicyCondition API](https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1alpha2/policy_types.go). If these reasons are not sufficient, we can add implementation-specific reasons.
716
+
The `Accepted` Condition must be populated on the `WafPolicy` CRD using the reasons defined in the [PolicyCondition API](https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1alpha2/policy_types.go). Below are example implementation-specific reasons that describe the lifecycle phases and potential issues encountered while processing the policy:
| **PolicySourceInvalid** | The `policySource` contains invalid or incomplete information. | "The policy source is invalid. Ensure fileLocation is correct." |
721
+
| **PolicyFetchError** | Failed to fetch the policy due to network issues, authentication problems, or source misconfiguration. | "Failed to fetch policy bundle due to a network issue or invalid credentials." |
722
+
| **PolicyIntegrityInvalid**| Checksum verification failed for the fetched policy bundle. | "Policy integrity check failed because of a checksum mismatch." |
723
+
| **PolicyValidationError** | The WAF policy bundle failed schema or format validation for NGINX App Protect WAF. | "The policy bundle did not pass schema validation. Update the policy and retry compilation." |
724
+
| **PolicyDeployed** | The policy was successfully deployed to the NGINX Data Plane (Pods). | "The policy has been successfully deployed and is now protecting the targeted resources." |
725
+
| **PolicyDeployedUpdate** | An updated version of the policy was successfully deployed to the NGINX Data Plane (Pods) after polling or change detection. | "The policy has been updated and successfully redeployed to the targeted resources." |
726
+
| **PolicyDeploymentError** | The data plane (NGINX Pods) failed to apply the policy. | "Failed to deploy the WAF policy to the NGINX Pods." |
727
+
| **AuthenticationError** | Authentication to the external store (e.g., S3, HTTP) failed. | "Authentication error while trying to fetch the policy bundle." |
728
+
| **PolicyConfigError** | The policy configuration prevents proper processing. | "The policy configuration is incomplete or incorrectly formatted. Correct the configuration and retry." |
729
+
730
+
### Example Status Conditions in `WafPolicy`
731
+
732
+
```yaml
733
+
status:
734
+
conditions:
735
+
- type: Accepted
736
+
status: "True"
737
+
reason: PolicyDeployedUpdate
738
+
message: "The policy has been updated and successfully redeployed to the Gateway."
739
+
740
+
- type: Accepted
741
+
status: "False"
742
+
reason: PolicyFetchError
743
+
message: "Failed to fetch policy bundle due to a network issue or invalid credentials."
744
+
745
+
- type: Accepted
746
+
status: "True"
747
+
reason: PolicyDeployed
748
+
message: "The policy has been successfully deployed and is now protecting the targeted resources."
749
+
750
+
- type: Accepted
751
+
status: "False"
752
+
reason: PolicyIntegrityInvalid
753
+
message: "Policy integrity check failed because of a checksum mismatch."
754
+
```
704
755
705
756
#### Setting Status on Objects Affected by a Policy
706
757
@@ -1111,3 +1162,7 @@ This complete example demonstrates:
1111
1162
- **Native cloud authentication** with fallback secret support
1112
1163
- **Flexible logging configuration** per policy level
1113
1164
- **Automatic change detection** through configurable polling intervals
1165
+
1166
+
## Open questions
1167
+
1168
+
- Will NAP automatically pick up policy changes when the bundle is changed on disk? Do we need to reload NGINX?
0 commit comments