Skip to content

Commit 988f65b

Browse files
committed
Merge remote-tracking branch 'origin/feat-199-k8s-1.25' into feat/k8s-1.25
2 parents 4dfd9b4 + a11d257 commit 988f65b

File tree

8 files changed

+81
-18
lines changed

8 files changed

+81
-18
lines changed

.github/workflows/minikube-k8s-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
minikube-version: 1.29.0
2727
driver: docker
28-
kubernetes-version: v1.23.12
28+
kubernetes-version: v1.25.6
2929
- name: test script
3030
run: |
3131
eval $(minikube docker-env)

aws/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ The documentation below is auto-generated to give insight on what's created via
190190
| Name | Description | Type | Default | Required |
191191
|------|-------------|------|---------|:--------:|
192192
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The EKS cluster name | `string` | `"wrongsecrets-exercise-cluster"` | no |
193-
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | The EKS cluster version to use | `string` | `"1.23"` | no |
193+
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | The EKS cluster version to use | `string` | `"1.25"` | no |
194194
| <a name="input_extra_allowed_ip_ranges"></a> [extra\_allowed\_ip\_ranges](#input\_extra\_allowed\_ip\_ranges) | Allowed IP ranges in addition to creator IP | `list(string)` | `[]` | no |
195195
| <a name="input_region"></a> [region](#input\_region) | The AWS region to use | `string` | `"eu-west-1"` | no |
196196
| <a name="input_state_bucket_arn"></a> [state\_bucket\_arn](#input\_state\_bucket\_arn) | ARN of the state bucket to grant access to the s3 user | `string` | n/a | yes |

aws/build-an-deploy-aws.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ else
9393
helm upgrade --install -n kube-system csi-secrets-store secrets-store-csi-driver/secrets-store-csi-driver --set enableSecretRotation=true --set rotationPollInterval=60s
9494
fi
9595

96+
echo "Patching default namespace"
97+
kubectl apply -f k8s/workspace-psa.yml
98+
9699
echo "Install ACSP"
97100
kubectl apply -f https://raw.githubusercontent.com/aws/secrets-store-csi-driver-provider-aws/main/deployment/aws-provider-installer.yaml
98101

aws/k8s/workspace-psa.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: default
5+
labels:
6+
pod-security.kubernetes.io/enforce: restricted
7+
kubernetes.io/metadata.name: default

helm/wrongsecrets-ctf-party/templates/cleanup/cron-job.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ spec:
2020
helm.sh/chart: {{ include "wrongsecrets-ctf-party.chart" . }}
2121
spec:
2222
serviceAccountName: 'wrongsecrets-cleaner'
23-
{{- with .Values.wrongsecretsCleanup.securityContext }}
2423
securityContext:
25-
{{- toYaml . | nindent 12 }}
26-
{{- end }}
24+
runAsUser: 1000
25+
runAsGroup: 3000
26+
fsGroup: 2000
2727
containers:
2828
- image: '{{ .Values.wrongsecretsCleanup.repository }}:{{ .Values.wrongsecretsCleanup.tag | default (printf "v%s" .Chart.Version) }}'
2929
imagePullPolicy: {{ .Values.imagePullPolicy | quote }}
30+
securityContext:
31+
allowPrivilegeEscalation: false
32+
readOnlyRootFilesystem: true
33+
runAsNonRoot: true
34+
capabilities:
35+
drop:
36+
- ALL
37+
seccompProfile:
38+
type: RuntimeDefault
3039
name: 'cleanup-job'
3140
env:
3241
- name: NAMESPACE

helm/wrongsecrets-ctf-party/templates/wrongsecrets-balancer/deployment.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ spec:
2424
runAsGroup: 3000
2525
fsGroup: 2000
2626
serviceAccountName: wrongsecrets-balancer
27-
{{- with .Values.balancer.securityContext }}
28-
securityContext:
29-
{{- toYaml . | nindent 8 }}
30-
{{- end }}
3127
containers:
3228
- name: {{ .Chart.Name }}
3329
image: '{{ .Values.balancer.repository }}:{{ .Values.balancer.tag | default (printf "v%s" .Chart.Version) }}'
@@ -94,6 +90,12 @@ spec:
9490
allowPrivilegeEscalation: false
9591
readOnlyRootFilesystem: true
9692
runAsNonRoot: true
93+
capabilities:
94+
drop:
95+
- ALL
96+
add:
97+
- CAP_NET_ADMIN
98+
- CAP_NET_BIND_SERVICE
9799
volumeMounts:
98100
- name: config-volume
99101
mountPath: /home/app/config/

helm/wrongsecrets-ctf-party/values.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ balancer:
3434
# -- Set this to a fixed random alpa-numeric string (recommended length 24 chars). If not set this get randomly generated with every helm upgrade, each rotation invalidates all active cookies / sessions requirering users to login again.
3535
cookieParserSecret: null
3636
repository: jeroenwillemsen/wrongsecrets-balancer
37-
tag: 1.7aws
37+
tag: 1.8aws
3838
# -- Number of replicas of the wrongsecrets-balancer deployment. Changing this in a commit? PLEASE UPDATE THE GITHUB WORKLFOWS THEN!(NUMBER OF "TRUE")
39-
replicas: 4
39+
replicas: 2
4040
service:
4141
# -- Kubernetes service type
4242
type: ClusterIP
@@ -55,6 +55,18 @@ balancer:
5555
limits:
5656
memory: 1024Mi
5757
cpu: 1000m
58+
securityContext:
59+
allowPrivilegeEscalation: false
60+
readOnlyRootFilesystem: true
61+
runAsNonRoot: true
62+
capabilities:
63+
drop:
64+
- ALL
65+
add:
66+
- CAP_NET_ADMIN
67+
- CAP_NET_BIND_SERVICE
68+
seccompProfile:
69+
type: RuntimeDefault
5870
# -- Optional Configure kubernetes scheduling affinity for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
5971
affinity: {}
6072
# -- Optional Configure kubernetes toleration for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
@@ -129,6 +141,11 @@ wrongsecrets:
129141
allowPrivilegeEscalation: false
130142
readOnlyRootFilesystem: true
131143
runAsNonRoot: true
144+
capabilities:
145+
drop:
146+
- ALL
147+
seccompProfile:
148+
type: RuntimeDefault
132149
# -- Optional environment variables to set for each JuiceShop instance (see: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/)
133150
env:
134151
- name: K8S_ENV
@@ -196,9 +213,15 @@ virtualdesktop:
196213
allowPrivilegeEscalation: false
197214
readOnlyRootFilesystem: true
198215
runAsNonRoot: true
216+
capabilities:
217+
drop:
218+
- ALL
219+
seccompProfile:
220+
type: RuntimeDefault
199221
runtimeClassName: {}
200222
affinity: {}
201223
# -- Optional mount environment variables from configMaps or secrets (see: https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables)
224+
202225
envFrom: []
203226
tolerations: []
204227

@@ -220,7 +243,6 @@ wrongsecretsCleanup:
220243
memory: 256Mi
221244
limits:
222245
memory: 256Mi
223-
securityContext: {}
224246
# -- Optional Configure kubernetes scheduling affinity for the wrongsecretsCleanup Job(see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
225247
affinity: {}
226248
# -- Optional Configure kubernetes toleration for the wrongsecretsCleanup Job (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)

wrongsecrets-balancer/src/kubernetes.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const createNameSpaceForTeam = async (team) => {
3434
},
3535
labels: {
3636
name: `t-${team}`,
37+
'pod-security.kubernetes.io/audit': 'restricted',
38+
'pod-security.kubernetes.io/enforce': 'baseline',
3739
},
3840
};
3941
k8sCoreApi.createNamespace(namedNameSpace).catch((error) => {
@@ -126,11 +128,12 @@ const createK8sDeploymentForTeam = async ({ team, passcodeHash }) => {
126128
name: 'wrongsecrets',
127129
image: `jeroenwillemsen/wrongsecrets:${wrongSecretsContainterTag}`,
128130
imagePullPolicy: get('wrongsecrets.imagePullPolicy'),
129-
// resources: get('wrongsecrets.resources'),
130131
securityContext: {
131132
allowPrivilegeEscalation: false,
132133
readOnlyRootFilesystem: true,
133134
runAsNonRoot: true,
135+
capabilities: { drop: ['ALL'] },
136+
seccompProfile: { type: 'RuntimeDefault' },
134137
},
135138
env: [
136139
{
@@ -385,6 +388,8 @@ const createAWSDeploymentForTeam = async ({ team, passcodeHash }) => {
385388
allowPrivilegeEscalation: false,
386389
readOnlyRootFilesystem: true,
387390
runAsNonRoot: true,
391+
capabilities: { drop: ['ALL'] },
392+
seccompProfile: { type: 'RuntimeDefault' },
388393
},
389394
env: [
390395
{
@@ -1068,6 +1073,11 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
10681073
},
10691074
spec: {
10701075
serviceAccountName: 'webtop-sa',
1076+
// securityContext: {
1077+
// runAsUser: 1000,
1078+
// runAsGroup: 1000,
1079+
// fsGroup: 1000,
1080+
// },
10711081
containers: [
10721082
{
10731083
name: 'virtualdesktop',
@@ -1086,12 +1096,22 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
10861096
'ephemeral-storage': '8Gi',
10871097
},
10881098
},
1089-
// resources: get('virtualdesktop.resources'),
10901099
securityContext: {
1091-
// allowPrivilegeEscalation: false,
1092-
// readOnlyRootFilesystem: true,
1100+
allowPrivilegeEscalation: true, //S6 will capture any weird things
1101+
readOnlyRootFilesystem: false,
1102+
runAsNonRoot: false,
10931103
},
1094-
env: [...get('virtualdesktop.env', [])],
1104+
env: [
1105+
{
1106+
name: 'PUID',
1107+
value: '1000',
1108+
},
1109+
{
1110+
name: 'PGID',
1111+
value: '1000',
1112+
},
1113+
...get('virtualdesktop.env', []),
1114+
],
10951115
envFrom: get('virtualdesktop.envFrom'),
10961116
ports: [
10971117
{
@@ -1127,7 +1147,7 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
11271147
{
11281148
emptyDir: {
11291149
medium: 'Memory',
1130-
sizeLimit: '128Mi',
1150+
sizeLimit: '160Mi',
11311151
},
11321152
name: 'config-fs',
11331153
},

0 commit comments

Comments
 (0)