-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kprobe: Add test and examples for new types
The sockaddr and socket types were added. This commit adds a test and two example policies. Signed-off-by: Kevin Sheldrake <[email protected]>
- Loading branch information
1 parent
a755275
commit 2865fb0
Showing
4 changed files
with
180 additions
and
1 deletion.
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
58 changes: 58 additions & 0 deletions
58
examples/tracingpolicy/security-socket-connect-block-others.yaml
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,58 @@ | ||
apiVersion: cilium.io/v1alpha1 | ||
kind: TracingPolicy | ||
metadata: | ||
name: "security-socket-connect" | ||
spec: | ||
kprobes: | ||
- call: "security_socket_connect" | ||
syscall: false | ||
args: | ||
- index: 0 | ||
type: "socket" | ||
- index: 1 | ||
type: "sockaddr" | ||
- index: 2 | ||
type: "int" | ||
selectors: | ||
- matchArgs: | ||
- index: 0 | ||
operator: "Protocol" | ||
values: | ||
- "IPPROTO_TCP" | ||
- index: 1 | ||
operator: "Family" | ||
values: | ||
- "AF_INET" | ||
- "AF_INET6" | ||
- index: 1 | ||
operator: "SAddr" | ||
values: | ||
- "192.168.1.1" | ||
- index: 1 | ||
operator: "SPort" | ||
values: | ||
- 80 | ||
matchBinaries: | ||
- operator: "In" | ||
values: | ||
- "/usr/bin/curl" | ||
matchActions: | ||
- action: Post | ||
- matchArgs: | ||
- index: 0 | ||
operator: "Protocol" | ||
values: | ||
- "IPPROTO_TCP" | ||
- index: 1 | ||
operator: "Family" | ||
values: | ||
- "AF_INET" | ||
- "AF_INET6" | ||
matchBinaries: | ||
- operator: "In" | ||
values: | ||
- "/usr/bin/curl" | ||
matchActions: | ||
- action: "Override" | ||
argError: 1 | ||
|
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,20 @@ | ||
apiVersion: cilium.io/v1alpha1 | ||
kind: TracingPolicy | ||
metadata: | ||
name: "security-socket-connect" | ||
spec: | ||
kprobes: | ||
- call: "security_socket_connect" | ||
syscall: false | ||
args: | ||
- index: 1 | ||
type: "sockaddr" | ||
- index: 2 | ||
type: "int" | ||
selectors: | ||
- matchArgs: | ||
- index: 1 | ||
operator: "Family" | ||
values: | ||
- "AF_INET" | ||
- "AF_INET6" |
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