Skip to content

Commit d29e4e8

Browse files
authored
Hardening container (#254)
Issue #, if available: Relates aws-controllers-k8s/community#1112 Description of changes: - ~~No longer runs as root, runs as nobody instead, since runtime is from scratch I've added a "dummy" /etc/shadow file~~ - ~~Runtime image is now "from scratch" since we don't need much other than ca-certs and the binary itself (eg. curl, vim, etc)~~ - Standard principle of least privilege security caps in deployment manifest (drop all plus explicit least privilege deployment/pod settings and capabilities) This is a draft since there's still stuff missing, and not sure if you would want to go in a different direction By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent fd2fda0 commit d29e4e8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

templates/config/controller/deployment.yaml.tpl

+9
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,13 @@ spec:
5353
valueFrom:
5454
fieldRef:
5555
fieldPath: metadata.namespace
56+
securityContext:
57+
allowPrivilegeEscalation: false
58+
privileged: false
59+
capabilities:
60+
drop:
61+
- ALL
5662
terminationGracePeriodSeconds: 10
63+
hostIPC: false
64+
hostNetwork: false
65+
hostPID: false

templates/helm/templates/deployment.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ spec:
7373
value: {{ .Values.log.level | quote }}
7474
- name: ACK_RESOURCE_TAGS
7575
value: {{ join "," .Values.resourceTags | quote }}
76+
securityContext:
77+
allowPrivilegeEscalation: false
78+
privileged: false
79+
capabilities:
80+
drop:
81+
- ALL
7682
terminationGracePeriodSeconds: 10
7783
nodeSelector: {{ toYaml .Values.deployment.nodeSelector | nindent 8 }}
7884
{{ if .Values.deployment.tolerations -}}
@@ -84,3 +90,6 @@ spec:
8490
{{ if .Values.deployment.priorityClassName -}}
8591
priorityClassName: {{ .Values.deployment.priorityClassName -}}
8692
{{ end -}}
93+
hostIPC: false
94+
hostNetwork: false
95+
hostPID: false

0 commit comments

Comments
 (0)