diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-apache-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-apache-deployment.yaml index d609c5c3a99..d5a44e43e7a 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-apache-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-apache-deployment.yaml @@ -72,6 +72,8 @@ spec: - containerPort: {{ .Values.APACHE_PORT }} protocol: UDP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-clamav-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-clamav-deployment.yaml index e0bbd2e35a9..8a7af0353d2 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-clamav-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-clamav-deployment.yaml @@ -59,6 +59,8 @@ spec: - containerPort: 3310 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml index 492501b7ae3..b31676dc95f 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml @@ -42,6 +42,8 @@ spec: - containerPort: 9980 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: add: - MKNOD diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-database-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-database-deployment.yaml index 8476aa284e2..58accc21ab2 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-database-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-database-deployment.yaml @@ -68,6 +68,8 @@ spec: - containerPort: 5432 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-fulltextsearch-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-fulltextsearch-deployment.yaml index 033ca63236c..e289671d78c 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-fulltextsearch-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-fulltextsearch-deployment.yaml @@ -62,6 +62,8 @@ spec: - containerPort: 9200 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-imaginary-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-imaginary-deployment.yaml index 1a5ee79769f..dc42c9e6678 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-imaginary-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-imaginary-deployment.yaml @@ -34,6 +34,8 @@ spec: - containerPort: 9000 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: add: - SYS_NICE diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-notify-push-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-notify-push-deployment.yaml index c33ac701942..9e4133c03b8 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-notify-push-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-notify-push-deployment.yaml @@ -59,6 +59,8 @@ spec: - containerPort: 7867 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-redis-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-redis-deployment.yaml index 70dc381cdb4..cc7697ee36a 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-redis-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-redis-deployment.yaml @@ -45,6 +45,8 @@ spec: - containerPort: 6379 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-deployment.yaml index d6fc49e3cd6..76b77197d8d 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-deployment.yaml @@ -52,6 +52,8 @@ spec: - containerPort: 8081 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-recording-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-recording-deployment.yaml index 67405468cfa..93cc7aec882 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-recording-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-talk-recording-deployment.yaml @@ -38,6 +38,8 @@ spec: - containerPort: 1234 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-whiteboard-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-whiteboard-deployment.yaml index 4eb3cccdb35..55e9c2bed30 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-whiteboard-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-whiteboard-deployment.yaml @@ -42,6 +42,8 @@ spec: - containerPort: 3002 protocol: TCP securityContext: + allowPrivilegeEscalation: false + runAsNonRoot: true capabilities: drop: - NET_RAW diff --git a/nextcloud-aio-helm-chart/update-helm.sh b/nextcloud-aio-helm-chart/update-helm.sh index 04ab339d678..2f97db57024 100755 --- a/nextcloud-aio-helm-chart/update-helm.sh +++ b/nextcloud-aio-helm-chart/update-helm.sh @@ -423,6 +423,13 @@ find ./ -name "*nextcloud-aio-elasticsearch-persistentvolumeclaim.yaml" -exec se # shellcheck disable=SC1083 find ./ -name "*nextcloud-aio-elasticsearch-persistentvolumeclaim.yaml" -exec sed -i "$ a {{- end }}" \{} \; +cat << EOL >> /tmp/security.conf + allowPrivilegeEscalation: false + runAsNonRoot: true +EOL +# shellcheck disable=SC1083 +find ./ \( -not -name '*nextcloud-deployment.yaml*' -not -name '*onlyoffice-deployment.yaml*' -name "*deployment.yaml" \) -exec sed -i "/^.*securityContext:$/r /tmp/security.conf" \{} \; + chmod 777 -R ./ # Seems like the dir needs to match the name of the chart