Skip to content

Commit

Permalink
fix: validating/mutating webhook networkpolicies and mtls (#192)
Browse files Browse the repository at this point in the history
## Description

Adds the proper ingress rules to the webhooks and PERMISSIVE mTLS to
allow calls to operate as expected. Validated by turning the webhook
failure policies to Fail and applying CRs. The fix applied is similar to
the approach taken with metrics-server, and can be re-evaluated as a
generated rule instead of Anywhere in the future.

## Related Issue

Related to #149 (not a
solve for it, but would also be modified by that issue)

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)(https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed
  • Loading branch information
mjnagel authored Feb 20, 2024
1 parent 0ec0cd4 commit b01e629
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
matchLabels:
app.kubernetes.io/name: metrics-server
portLevelMtls:
# Allow api service calls to operate permissive since ingress originates from the nodes
"10250":
mode: PERMISSIVE
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ spec:
portLevelMtls:
"18300":
mode: PERMISSIVE
{{- end }}
# Allow webhooks to operate permissive since ingress originates from the nodes
"30443":
mode: PERMISSIVE
{{- end }}
8 changes: 8 additions & 0 deletions src/neuvector/chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ spec:
selector:
app: neuvector-updater-pod

- direction: Ingress
# todo: evaluate a "KubeAPI" _ingress_ generated rule for webhook calls
remoteGenerated: Anywhere
selector:
app: neuvector-controller-pod
port: 30443
description: "Webhook"

- direction: Ingress
remoteNamespace: monitoring
remoteSelector:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1" }}
apiVersion: "security.istio.io/v1beta1"
kind: PeerAuthentication
metadata:
name: prometheus-operator-webhook
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: kube-prometheus-stack-operator
mtls:
mode: STRICT
portLevelMtls:
# Allow webhooks to operate permissive since ingress originates from the nodes
"10250":
mode: PERMISSIVE
{{- end }}
8 changes: 8 additions & 0 deletions src/prometheus-stack/chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ spec:
selector:
app: kube-prometheus-stack-admission-patch

- direction: Ingress
# todo: evaluate a "KubeAPI" _ingress_ generated rule for webhook calls
remoteGenerated: Anywhere
selector:
app: kube-prometheus-stack-operator
port: 10250
description: "Webhook"

# todo: lockdown egress to scrape targets
- direction: Egress
remoteNamespace: ""
Expand Down

0 comments on commit b01e629

Please sign in to comment.