Skip to content

Commit c948e15

Browse files
committed
secureCodeBox#2939 Add configurable seccompProfile for lurker
Signed-off-by: Samreet Singh <samreet.singh@iteratec.com>
1 parent e37e3b5 commit c948e15

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

operator/controllers/execution/scans/scan_reconciler.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,27 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanTypeSpe
288288
return nil, fmt.Errorf("unknown imagePull Policy for lurker: %s", lurkerPullPolicyRaw)
289289
}
290290

291+
seccompProfileRaw := os.Getenv("LURKER_SECCOMP_PROFILE")
292+
var seccompProfile corev1.SeccompProfile
293+
switch seccompProfileRaw {
294+
case "Localhost":
295+
seccompProfile = corev1.SeccompProfile{
296+
Type: corev1.SeccompProfileTypeLocalhost,}
297+
case "RuntimeDefault":
298+
seccompProfile = corev1.SeccompProfile{
299+
Type: corev1.SeccompProfileTypeRuntimeDefault,}
300+
case "Unconfined":
301+
seccompProfile = corev1.SeccompProfile{
302+
Type: corev1.SeccompProfileTypeUnconfined,}
303+
case "":
304+
seccompProfile = corev1.SeccompProfile{
305+
Type: corev1.SeccompProfileTypeRuntimeDefault,
306+
}
307+
default:
308+
return nil, fmt.Errorf("unknown seccompProfile for lurker: %s", seccompProfileRaw)
309+
}
310+
311+
r.Log.Info("Using Lurker Image", "seccompProfile", seccompProfileRaw)
291312
falsePointer := false
292313
truePointer := true
293314

@@ -338,6 +359,9 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanTypeSpe
338359
Capabilities: &corev1.Capabilities{
339360
Drop: []corev1.Capability{"ALL"},
340361
},
362+
SeccompProfile: &corev1.SeccompProfile{
363+
Type: seccompProfile.Type,
364+
},
341365
},
342366
}
343367

operator/templates/manager/manager.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ spec:
123123
value: "{{ .Values.lurker.image.repository }}:{{ .Values.lurker.image.tag | default .Chart.Version }}"
124124
- name: LURKER_PULL_POLICY
125125
value: {{ .Values.lurker.image.pullPolicy }}
126+
- name: LURKER_SECCOMP_PROFILE
127+
value: {{ .Values.securityContext.seccompProfile.type }}
126128
{{- if .Values.customCACertificate.existingCertificate }}
127129
- name: CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
128130
value: {{ .Values.customCACertificate.existingCertificate | quote }}

operator/tests/__snapshot__/operator_test.yaml.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ matches the snapshot:
6868
value: docker.io/securecodebox/lurker:0.0.0
6969
- name: LURKER_PULL_POLICY
7070
value: IfNotPresent
71+
- name: LURKER_SECCOMP_PROFILE
72+
value: Unconfined
7173
- name: CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
7274
value: foo
7375
- name: CUSTOM_CA_CERTIFICATE_NAME
@@ -115,6 +117,8 @@ matches the snapshot:
115117
privileged: false
116118
readOnlyRootFilesystem: true
117119
runAsNonRoot: true
120+
seccompProfile:
121+
type: Unconfined
118122
volumeMounts:
119123
- mountPath: /etc/ssl/certs/public.crt
120124
name: ca-certificate
@@ -645,6 +649,8 @@ properly-renders-the-service-monitor-when-enabled:
645649
value: docker.io/securecodebox/lurker:0.0.0
646650
- name: LURKER_PULL_POLICY
647651
value: IfNotPresent
652+
- name: LURKER_SECCOMP_PROFILE
653+
value: Unconfined
648654
- name: CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
649655
value: foo
650656
- name: CUSTOM_CA_CERTIFICATE_NAME
@@ -692,6 +698,8 @@ properly-renders-the-service-monitor-when-enabled:
692698
privileged: false
693699
readOnlyRootFilesystem: true
694700
runAsNonRoot: true
701+
seccompProfile:
702+
type: Unconfined
695703
volumeMounts:
696704
- mountPath: /etc/ssl/certs/public.crt
697705
name: ca-certificate

operator/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ securityContext:
5151
drop:
5252
# securityContext.capabilities.drop[0] -- This drops all linux privileges from the operator container. They are not required
5353
- ALL
54+
seccompProfile:
55+
# securityContext.seccompProfile.type -- one of RuntimeDefault, Unconfined, Localhost
56+
type: Unconfined
5457

5558
# -- Sets the securityContext on the operators pod level. See: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container
5659
podSecurityContext: {}

0 commit comments

Comments
 (0)