Skip to content

Commit

Permalink
App Policy Bundle (#3560)
Browse files Browse the repository at this point in the history
App Policy Bundle
  • Loading branch information
jjngx committed Feb 23, 2023
1 parent 8ae8509 commit 14ebdc4
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 10 deletions.
2 changes: 2 additions & 0 deletions deployments/common/crds/k8s.nginx.org_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ spec:
description: WAF defines an WAF policy.
type: object
properties:
apBundle:
type: string
apPolicy:
type: string
enable:
Expand Down
2 changes: 2 additions & 0 deletions deployments/helm-chart/crds/k8s.nginx.org_policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ spec:
description: WAF defines an WAF policy.
type: object
properties:
apBundle:
type: string
apPolicy:
type: string
enable:
Expand Down
1 change: 1 addition & 0 deletions internal/configs/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

const (
pemFileNameForWildcardTLSSecret = "/etc/nginx/secrets/wildcard" // #nosec G101
appProtectBundleFolder = "/etc/nginx/waf/bundles/"
appProtectPolicyFolder = "/etc/nginx/waf/nac-policies/"
appProtectLogConfFolder = "/etc/nginx/waf/nac-logconfs/"
appProtectUserSigFolder = "/etc/nginx/waf/nac-usersigs/"
Expand Down
1 change: 1 addition & 0 deletions internal/configs/version2/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type OIDC struct {
type WAF struct {
Enable string
ApPolicy string
ApBundle string
ApSecurityLogEnable bool
ApLogConf []string
}
Expand Down
8 changes: 8 additions & 0 deletions internal/configs/version2/nginx-plus.virtualserver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ server {
app_protect_policy_file {{ .ApPolicy }};
{{ end }}

{{ if .ApBundle }}
app_protect_policy_file {{ .ApBundle }};
{{ end }}

{{ if .ApSecurityLogEnable }}
app_protect_security_log_enable on;
{{ range $logconf := .ApLogConf }}
Expand Down Expand Up @@ -429,6 +433,10 @@ server {
app_protect_policy_file {{ .ApPolicy }};
{{ end }}

{{ if .ApBundle }}
app_protect_policy_file {{ .ApBundle }};
{{ end }}

{{ if .ApSecurityLogEnable }}
app_protect_security_log_enable on;
{{ range $logconf := .ApLogConf }}
Expand Down

0 comments on commit 14ebdc4

Please sign in to comment.