Skip to content

Commit

Permalink
Make deployments compliant with PSS policies (#234)
Browse files Browse the repository at this point in the history
* make deployments compliant with PSS policies

Signed-off-by: Matias Charriere <[email protected]>

* remove NET_BIND cap

Signed-off-by: Matias Charriere <[email protected]>

* annotate psp

Signed-off-by: Matias Charriere <[email protected]>

* update changelog

Signed-off-by: Matias Charriere <[email protected]>

* install PSP based on values for cluster upgrades

Signed-off-by: Matias Charriere <[email protected]>

---------

Signed-off-by: Matias Charriere <[email protected]>
  • Loading branch information
mcharriere authored Sep 27, 2023
1 parent cb97aad commit c3169e0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project's packages adheres to [Semantic Versioning](http://semver.org/s

## [Unreleased]

### Changed

- Make App compliant with PSS policies ([#234](https://github.com/giantswarm/coredns-app/pull/234)):
- Set seccompProfile to `RuntimeDefault`.
- Fix capabilities typo.
- Remove `NET_BIND_SERVICE` capabilities.
- Set `runAsNonRoot` as true.

## [1.18.1] - 2023-08-30

### Fixed
Expand Down
7 changes: 4 additions & 3 deletions helm/coredns-app/templates/deployment-masters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spec:
securityContext:
runAsUser: {{ .Values.userID }}
runAsGroup: {{ .Values.groupID }}
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
tolerations:
- effect: NoSchedule
operator: "Exists"
Expand Down Expand Up @@ -70,10 +73,8 @@ spec:
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- name: config-volume
Expand Down
7 changes: 4 additions & 3 deletions helm/coredns-app/templates/deployment-workers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
securityContext:
runAsUser: {{ .Values.userID }}
runAsGroup: {{ .Values.groupID }}
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
tolerations:
- operator: "Exists"
key: "node.cloudprovider.kubernetes.io/uninitialized"
Expand All @@ -54,10 +57,8 @@ spec:
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- name: config-volume
Expand Down
4 changes: 3 additions & 1 deletion helm/coredns-app/templates/psp.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{{- if le (int .Capabilities.KubeVersion.Minor) 24 }}
{{- if and (le (int .Capabilities.KubeVersion.Minor) 24) (not .Values.global.podSecurityStandards.enforced) }}
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'runtime/default'
labels:
{{- include "labels.common" . | nindent 4 }}
spec:
Expand Down
13 changes: 13 additions & 0 deletions helm/coredns-app/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
}
}
},
"global": {
"type": "object",
"properties": {
"podSecurityStandards": {
"type": "object",
"properties": {
"enforced": {
"type": "boolean"
}
}
}
}
},
"groupID": {
"type": "integer"
},
Expand Down
5 changes: 5 additions & 0 deletions helm/coredns-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ mastersInstance:
nodeSelector:
"node-role.kubernetes.io/control-plane": '""'


global:
podSecurityStandards:
enforced: false

# Uncomment and define `additionalLocalZones` to add additional local zones to CoreDNS config
# additionalLocalZones: []

Expand Down

0 comments on commit c3169e0

Please sign in to comment.