components/*: Forbid write access to root filesystem

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
Arthur Silva Sens 2022-01-27 09:13:18 +00:00 committed by ArthurSens
parent 48b2bb6a72
commit 57c46a2861
13 changed files with 33 additions and 5 deletions

View File

@ -169,10 +169,12 @@ function(params) {
securityContext: if bb._config.privileged then {
runAsNonRoot: false,
capabilities: { drop: ['ALL'], add: ['NET_RAW'] },
readOnlyRootFilesystem: true,
} else {
runAsNonRoot: true,
runAsUser: 65534,
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
volumeMounts: [{
mountPath: '/etc/blackbox_exporter/',
@ -193,6 +195,7 @@ function(params) {
runAsNonRoot: true,
runAsUser: 65534,
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
terminationMessagePath: '/dev/termination-log',
terminationMessagePolicy: 'FallbackToLogsOnError',

View File

@ -84,8 +84,9 @@ function(params)
},
},
// FIXME(ArthurSens): The override adding 'allowPrivilegeEscalation: false' can be deleted when
// https://github.com/brancz/kubernetes-grafana/pull/128 gets merged.
// FIXME(ArthurSens): The securityContext overrides can be removed after some PRs get merged
// 'allowPrivilegeEscalation: false' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/128 gets merged.
// 'readOnlyRootFilesystem: true' can be deleted when https://github.com/brancz/kubernetes-grafana/pull/129 gets merged.
deployment+: {
spec+: {
template+: {
@ -93,6 +94,7 @@ function(params)
containers: std.map(function(c) c {
securityContext+: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
}, super.containers),
},

View File

@ -62,5 +62,6 @@ function(params) {
runAsGroup: 65532,
runAsNonRoot: true,
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
}

View File

@ -118,8 +118,9 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
image: ksm._config.kubeRbacProxyImage,
}),
// FIXME(ArthurSens): The override adding 'allowPrivilegeEscalation: false' can be deleted when
// https://github.com/kubernetes/kube-state-metrics/pull/1668 gets merged.
// FIXME(ArthurSens): The securityContext overrides can be removed after some PRs get merged
// 'allowPrivilegeEscalation: false' can be deleted when https://github.com/kubernetes/kube-state-metrics/pull/1668 gets merged.
// 'readOnlyRootFilesystem: true' can be deleted when https://github.com/kubernetes/kube-state-metrics/pull/1671 gets merged.
deployment+: {
spec+: {
template+: {
@ -137,6 +138,7 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
resources: ksm._config.resources,
securityContext+: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
}, super.containers) + [kubeRbacProxyMain, kubeRbacProxySelf],
},

View File

@ -183,6 +183,7 @@ function(params) {
resources: ne._config.resources,
securityContext: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
};

View File

@ -228,6 +228,7 @@ function(params) {
],
securityContext: {
allowPrivilegeEscalation: false,
readOnlyRootFilesystem: true,
},
};

View File

@ -125,11 +125,17 @@ function(params)
image: po._config.kubeRbacProxyImage,
}),
// FIXME(ArthurSens): The securityContext overrides can be removed after some PRs get merged
// 'readOnlyRootFilesystem: true' can be deleted when https://github.com/prometheus-operator/prometheus-operator/pull/4531 gets merged.
deployment+: {
spec+: {
template+: {
spec+: {
containers+: [kubeRbacProxy],
containers: std.map(function(c) c {
securityContext+: {
readOnlyRootFilesystem: true,
},
}, super.containers) + [kubeRbacProxy],
},
},
},

View File

@ -43,6 +43,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
volumeMounts:
@ -63,6 +64,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
terminationMessagePath: /dev/termination-log
@ -90,6 +92,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532

View File

@ -47,6 +47,7 @@ spec:
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-storage

View File

@ -43,6 +43,7 @@ spec:
memory: 190Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 65534
- args:
- --logtostderr
@ -63,6 +64,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
@ -85,6 +87,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532

View File

@ -45,6 +45,7 @@ spec:
memory: 180Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /host/sys
mountPropagation: HostToContainer
@ -79,6 +80,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532

View File

@ -49,6 +49,7 @@ spec:
memory: 180Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmpfs

View File

@ -44,6 +44,7 @@ spec:
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
- args:
- --logtostderr
- --secure-listen-address=:8443
@ -63,6 +64,7 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532