-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrules.yaml
229 lines (211 loc) · 5.02 KB
/
rules.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
- action: Terminate Pod
actionner: kubernetes:terminate
parameters:
grace_period_seconds: 5
ignore_standalone_pods: true
- action: Disable outbound connections
actionner: kubernetes:networkpolicy
parameters:
allow:
- "192.168.1.0/24"
- "172.17.0.0/16"
- action: Create cilium network policy
actionner: cilium:networkpolicy
parameters:
allow_cidr:
- "192.168.1.0/24"
- "172.17.0.0/16"
- action: Label Pod as Suspicious
description: "Add the label suspicious=true"
actionner: kubernetes:label
parameters:
labels:
suspicious: "true"
- action: Invoke Lambda function
actionner: aws:lambda
additional_contexts:
- aws
parameters:
aws_lambda_name: sample-function
aws_lambda_alias_or_version: $LATEST
aws_lambda_invocation_type: RequestResponse
- action: Invoke GCP function
actionner: gcp:function
additional_contexts:
- aws
parameters:
gcp_function_name: simple-http-function
gcp_function_location: us-central1
- rule: Suspicious outbound connection
description: "Label pods with suspicious outbound connections if not in the kube-system"
match:
rules:
- Unexpected outbound connection destination
output_fields:
- k8s.ns.name!=kube-system
actions:
- action: Create cilium network policy
- rule: Terminal shell in container
description: >
Label the pod outside kube-system and falco namespaces if a shell is started inside
match:
rules:
- Terminal shell in container
output_fields:
- k8s.ns.name!=kube-system, k8s.ns.name!=falco
actions:
- action: Terminate Pod
# - rule: Test invoke lambda
# match:
# rules:
# - Test invoke lambda
# actions:
# - action: Invoke Lambda function
# - rule: Test invoke GCP function
# match:
# rules:
# - Test invoke GCP function
# actions:
# - action: Invoke GCP function
- rule: Delete unknown namespace
match:
rules:
- K8s Namespace Created
output_fields:
- ka.target.namespace=todelete
actions:
- action: Delete the namespace
actionner: kubernetes:delete
- rule: Calico netpol
match:
rules:
- Unexpected outbound connection destination
output_fields:
- k8s.ns.name!=kube-system
actions:
- action: Disable outbound connections
parameters:
allow_cidr:
- "192.168.1.0/24"
- "172.17.0.0/16"
allow_namespaces:
- "green-ns"
- "blue-ns"
- action: Create Calico netpol
actionner: calico:networkpolicy
parameters:
order: 20
allow_cidr:
- "192.168.2.0/24"
allow_namespaces:
- "green-ns"
- rule: Test node drain
match:
rules:
- Test node drain
actions:
- action: Cordon node
actionner: kubernetes:cordon
- action: Drain node
actionner: kubernetes:drain
parameters:
force: true
ignore_daemonsets: true
ignore_statefulsets: true
max_wait_period: 90
- rule: Delete namespace
match:
rules:
- Test delete namespace
output_fields:
- ka.target.name=todelete
actions:
- action: Delete the resource
actionner: kubernetes:delete
- rule: Test exec
match:
rules:
- Test exec
output_fields:
- k8s.ns.name!=kube-system
actions:
- action: Test exec
actionner: kubernetes:exec
additional_contexts:
- k8snode
parameters:
command: echo "${NODE_HOSTNAME}"
- rule: Test download
match:
rules:
- Test download
actions:
- action: Test exec
actionner: kubernetes:exec
additional_contexts:
- k8snode
parameters:
shell: /bin/sh
command: uname -a
- action: Test log
actionner: kubernetes:log
output:
target: aws:s3
parameters:
bucket: falcosidekick-tests
prefix: logs/
- action: Test download
actionner: kubernetes:download
parameters:
file: "${FD_NAME}"
output:
target: minio:s3
parameters:
bucket: falco-talon
prefix: /files/
- rule: Test tcpdump
match:
rules:
- Test tcpdump
actions:
- action: Test tcpdump
actionner: kubernetes:tcpdump
parameters:
snaplen: 512
duration: 5
output:
target: aws:s3
parameters:
bucket: falcosidekick-tests
prefix: /tcpdump/
region: us-east-1
- rule: Test sysdig
match:
rules:
- Test sysdig
actions:
- action: Test sysdig
actionner: kubernetes:sysdig
parameters:
duration: 5
scope: pod
buffer_size: 4096
output:
target: local:file
parameters:
destination: /tmp/
- rule: Test log
match:
rules:
- Test log
actions:
- action: Test log
actionner: kubernetes:log
parameters:
tail_lines: 1
output:
target: aws:s3
parameters:
bucket: falcosidekick-tests
prefix: /logs/
region: us-east-1