-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(host-shield): [SMAGENT-8607] Allow for custom security context
This is the equivalent of #2062 on the host-shield side.
- Loading branch information
Showing
5 changed files
with
153 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
suite: Security Context tests | ||
templates: | ||
- templates/host/daemonset.yaml | ||
kubernetesProvider: | ||
scheme: | ||
"v1/Node": | ||
gvr: | ||
version: "v1" | ||
resource: "nodes" | ||
namespaced: false | ||
objects: | ||
- apiVersion: v1 | ||
kind: Node | ||
metadata: | ||
name: fakenode | ||
status: | ||
nodeInfo: | ||
osImage: fake-os-image | ||
values: | ||
- ../values/base.yaml | ||
tests: | ||
- it: Ensure the securityContext for a privileged agent is exactly what was defined | ||
set: | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext | ||
value: | ||
allowPrivilegeEscalation: true | ||
privileged: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
|
||
- it: Ensure the securityContext for a non-privileged agent contains the keys defined | ||
set: | ||
host: | ||
privileged: false | ||
driver: universal_ebpf | ||
asserts: | ||
- isSubset: | ||
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext | ||
content: | ||
allowPrivilegeEscalation: false | ||
seccompProfile: | ||
type: Unconfined | ||
- isNotSubset: | ||
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext | ||
content: | ||
allowPrivilegeEscalation: false | ||
privileged: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
|
||
- it: Ensure the custom_security_context is honored | ||
set: | ||
host: | ||
custom_security_context: | ||
allowPrivilegeEscalation: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
seLinuxOptions: | ||
type: super_t | ||
seccompProfile: | ||
type: Unconfined | ||
capabilities: | ||
add: | ||
- AUDIT_CONTROL | ||
- BLOCK_SUSPEND | ||
- DAC_READ_SEARCH | ||
- IPC_LOCK | ||
- IPC_OWNER | ||
- LEASE | ||
- LINUX_IMMUTABLE | ||
- MAC_ADMIN | ||
- MAC_OVERRIDE | ||
- NET_ADMIN | ||
- NET_BROADCAST | ||
- SYSLOG | ||
- SYS_ADMIN | ||
- SYS_BOOT | ||
- SYS_MODULE | ||
- SYS_NICE | ||
- SYS_PACCT | ||
- SYS_PTRACE | ||
- SYS_RAWIO | ||
- SYS_RESOURCE | ||
- SYS_TIME | ||
- SYS_TTY_CONFIG | ||
- WAKE_ALARM | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.containers[?(@.name == "sysdig-host-shield")].securityContext | ||
value: | ||
allowPrivilegeEscalation: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
seLinuxOptions: | ||
type: super_t | ||
seccompProfile: | ||
type: Unconfined | ||
capabilities: | ||
add: | ||
- AUDIT_CONTROL | ||
- BLOCK_SUSPEND | ||
- DAC_READ_SEARCH | ||
- IPC_LOCK | ||
- IPC_OWNER | ||
- LEASE | ||
- LINUX_IMMUTABLE | ||
- MAC_ADMIN | ||
- MAC_OVERRIDE | ||
- NET_ADMIN | ||
- NET_BROADCAST | ||
- SYSLOG | ||
- SYS_ADMIN | ||
- SYS_BOOT | ||
- SYS_MODULE | ||
- SYS_NICE | ||
- SYS_PACCT | ||
- SYS_PTRACE | ||
- SYS_RAWIO | ||
- SYS_RESOURCE | ||
- SYS_TIME | ||
- SYS_TTY_CONFIG | ||
- WAKE_ALARM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters