Skip to content

Update Chapter 4 Prevention Policies #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Deny a privileged pod start
apiVersion: cilium.io/v1alpha1
apiVersion: isovalent.com/v1alpha1
kind: TracingPolicy
metadata:
name: "deny-privileged-pod-start"
spec:
kprobes:
- call: "<TBD>"
# match open fd_install at pod start
- call: "fd_install"
syscall: false
args:
- index: 0
type: int
- index: 1
type: "file"
selectors:
# match all the namespace PIDs including init
- matchPIDs:
Expand All @@ -15,17 +20,23 @@ spec:
isNamespacePID: true
values:
- 0
# match a process with CAP_SYS_ADMIN
- matchCapabilities:
- operator: In
isNamespaceCapability: true
# match a process with CAP_SYS_ADMIN
matchCapabilities:
- type: Effective
operator: In
values:
- "CAP_SYS_ADMIN"
# match on containerd-shim binary
- matchBinarys:
- operator: "In"
# match a process with CAP_SYS_ADMIN that gained it later
matchCapabilityChanges:
- type: Effective
operator: In
values:
- "/usr/bin/containerd-shim"
# terminate the process
- matchActions:
- action: Sigkill
- "CAP_SYS_ADMIN"
# match on containerd-shim binary
- matchBinaries:
- operator: "In"
values:
- "/usr/bin/containerd-shim"
# terminate the process
- matchActions:
- action: Sigkill
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ metadata:
name: "deny-nsenter"
spec:
kprobes:
- call: "<TBD>"
syscall: false
- call: "__x64_sys_setns"
syscall: true
args:
- index: 0
type: "int"
selectors:
- matchPIDs:
# match host processes
Expand All @@ -21,15 +24,5 @@ spec:
isNamespacePID: true
values:
- 1
# match on mount, network, uts, pid, ipc, user host namespaces
- matchNamespaceChanges:
- operator: In
values:
- "mount"
- "network"
- "uts"
- "pid"
- "ipc"
- "user"
- matchActions:
- action: Sigkill