|
12 | 12 |
|
13 | 13 | # Or override any rule, macro, or list from the Default Rules |
14 | 14 | --- |
15 | | -- macro: "user_known_k8s_client_container" |
16 | | - condition: "container.image.repository=\"k8s.gcr.io/fluentd-gcp-scaler\" or container.image.repository=\"\ |
17 | | - fluxcd/flux\" or container.image.repository=\"sysdig/agent\" or container.image.repository=\"\ |
18 | | - fluxcd/helm-operator\" or (container.image.repository=\"google/cloud-sdk\")" |
19 | | - append: false |
20 | | - |
21 | | -- macro: "user_known_write_below_root_activities" |
22 | | - condition: "(container.image.repository startswith \"bbcdocker/go-synapse\" and\ |
23 | | - \ fd.name=\"/haproxy.conf\") or (container.image.repository=\"cassandra\" and\ |
24 | | - \ fd.name startswith \"/root/.cassandra/\") or (container.id=host and fd.name\ |
25 | | - \ startswith /root/.kube/) or (container.image.repository=\"mariadb\" and proc.name=\"\ |
26 | | - mysqld\") or (container.image.repository=\"mariadb\" and proc.name=\"mysql\")" |
27 | | - append: false |
28 | | - |
29 | 15 | - macro: "user_known_network_tool_client_container" |
30 | 16 | condition: "container.image.repository=\"bbcdocker/go-synapse\" or container.image.repository=\"\ |
31 | 17 | strimzi/kafka\" or container.image.repository=\"landoop/fast-data-dev\"" |
|
50 | 36 | source: "syscall" |
51 | 37 | append: false |
52 | 38 |
|
53 | | -- macro: "user_known_write_below_etc_activities" |
54 | | - condition: "(container.image.repository=\"quay.io/thanos/thanos\" and fd.name=\"\ |
55 | | - /etc/prom/prometheus.yaml.tmp\" or (container.image.repository=\"eu.gcr.io/bbc-registry/comuto3\"\ |
56 | | - \ and fd.name startswith \"/etc/nginx/\"))" |
57 | | - append: false |
58 | | - |
59 | 39 | - rule: "The docker client is executed in a container" |
60 | 40 | desc: "Detect a k8s client tool executed inside a container" |
61 | 41 | condition: "spawned_process and container and not user_known_k8s_client_container\ |
|
85 | 65 | - "users" |
86 | 66 | append: false |
87 | 67 |
|
88 | | -- macro: "user_known_write_etc_conditions" |
89 | | - condition: "proc.name=confd or (container.image.repository=\"confluentinc/cp-schema-registry\"\ |
90 | | - \ and fd.name startswith \"/etc/schema-registry/\") or (container.image.repository=\"\ |
91 | | - eu.gcr.io/bbc-registry/communication\" and fd.name startswith \"/etc/nginx/\"\ |
92 | | - ) or (container.image.repository=\"eu.gcr.io/bbc-registry/redirector\" and fd.name\ |
93 | | - \ startswith \"/etc/nginx/\") or (container.image.repository=\"eu.gcr.io/bbc-registry/webhooks\"\ |
94 | | - \ and fd.name startswith \"/etc/nginx/\")or (container.image.repository=\"thanosio/thanos\"\ |
95 | | - \ and fd.name startswith \"/etc/prom/\") or (container.image.repository=\"eu.gcr.io/bbc-registry/insurance-backoffice\"\ |
96 | | - \ and fd.name startswith \"/etc/nginx/\") or (container.id=\"host\" and proc.name=\"\ |
97 | | - exe\" and proc.pname=\"dockerd\")" |
98 | | - append: false |
99 | | - |
100 | | -- macro: "user_known_package_manager_in_container" |
101 | | - condition: "(container.image.repository=\"confluentinc/cp-schema-registry\" and\ |
102 | | - \ proc.name=\"pip\") or (container.image.repository=sysdig/node-image-analyzer\ |
103 | | - \ and proc.name=rpm)" |
104 | | - append: false |
105 | | - |
106 | | -- macro: "user_privileged_containers" |
107 | | - condition: "(container.image.repository endswith sysdig/agent) or (container.image.repository=weaveworks/scope)\ |
108 | | - \ or (container.image.repository=docker.io/weaveworks/scope) or (container.image.repository=gcr.io/google-containers/startup-script)\ |
109 | | - \ or (container.image.repository=gke.gcr.io/kube-proxy) or (container.image.repository=sysdig/node-image-analyzer)" |
110 | | - append: false |
111 | | - |
112 | | -- macro: "user_sensitive_mount_containers" |
113 | | - condition: "(container.image.repository = docker.io/sysdig/agent) or (container.image.repository=quay.io/prometheus/node-exporter)\ |
114 | | - \ or (container.image.repository=weaveworks/scope) or (container.image.repository=datadog/agent)" |
115 | | - append: false |
116 | | - |
117 | | -- macro: "user_known_change_thread_namespace_activities" |
118 | | - condition: "container.image.repository=gcr.io/google-containers/startup-script" |
119 | | - append: false |
120 | | - |
121 | 68 | - list: "user_known_hostnetwork_images" |
122 | 69 | items: |
123 | 70 | - "gke.gcr.io/kube-proxy" |
|
168 | 115 | tags: [] |
169 | 116 | append: true |
170 | 117 |
|
171 | | -- macro: "user_shell_container_exclusions" |
172 | | - condition: "((container.image.repository=bitnami/rabbitmq and proc.pname=erl) or\ |
173 | | - \ (container.image.repository=bitnami/rabbitmq and proc.pname=\"beam.smp\"))" |
174 | | - append: false |
175 | | - |
176 | | -- macro: "user_known_write_root_conditions" |
177 | | - condition: "(fd.name=/root/.bash_history) or (container.image.repository=\"cassandra\"\ |
178 | | - \ and fd.name startswith \"/root/.cassandra/\") or (container.image.repository=\"\ |
179 | | - bbcdocker/go-synapse\" and fd.name=\"/haproxy.conf\") or (container.id=\"host\"\ |
180 | | - \ and proc.name=\"exe\" and proc.pname=\"dockerd\")" |
181 | | - append: false |
182 | | - |
183 | | -- macro: "exe_running_docker_save" |
184 | | - condition: "((proc.cmdline startswith \"exe /var/lib/docker\" or proc.cmdline startswith\ |
185 | | - \ \"exe / /var/lib/docker\") and proc.pname in (dockerd, docker))" |
186 | | - append: false |
187 | | - |
188 | 118 | - rule: "Update Package Repository" |
189 | 119 | condition: "and not exe_running_docker_save" |
190 | 120 | tags: [] |
|
201 | 131 | tags: [] |
202 | 132 | append: true |
203 | 133 |
|
204 | | -- macro: "allowed_clear_log_files" |
205 | | - condition: "(container.image.repository=\"landoop/fast-data-dev\" and fd.name=\"\ |
206 | | - /var/log/broker.log\")" |
207 | | - append: false |
208 | | - |
209 | 134 | - list: "user_known_gke_metadata_images" |
210 | 135 | items: |
211 | 136 | - "gke.gcr.io/kube-proxy-amd64" |
|
225 | 150 |
|
226 | 151 | - macro: "mariadb_snapshots_validator" |
227 | 152 | condition: "(container.image.repository=\"google/cloud-sdk\" and container.name\ |
228 | | - \ contains\"snapshot-validator\")" |
| 153 | + \ contains \"snapshot-validator\")" |
229 | 154 | append: false |
230 | 155 |
|
231 | 156 | - macro: "bbc_java_app_proc" |
|
286 | 211 | tags: [] |
287 | 212 | append: true |
288 | 213 |
|
289 | | -- macro: "user_shell_container_exclusions" |
290 | | - condition: "(container.image.repository=\"kong\" and proc.pname=\"nginx\")" |
291 | | - append: false |
292 | | - |
293 | 214 | - list: "user_known_privilged_k8s_roles" |
294 | 215 | items: |
295 | 216 | - "mariadb-moderation-snapshot-validated" |
|
319 | 240 | tags: [] |
320 | 241 | append: true |
321 | 242 |
|
322 | | -- macro: "user_known_network_tool_activities" |
323 | | - condition: "(container.image.repository=\"mariadb\" and (proc.pname=\"wsrep_sst_maria\"\ |
324 | | - \ or proc.pname=\"timeout\") and proc.name=\"socat\")" |
325 | | - append: false |
326 | | - |
327 | | -- macro: "user_shell_container_exclusions" |
328 | | - condition: "(container.image.repository=\"mariadb\" and proc.pname=\"mysqld\" and\ |
329 | | - \ proc.name=\"sh\")" |
330 | | - append: false |
331 | | - |
332 | | -- macro: "user_known_remote_file_copy_activities" |
333 | | - condition: "(container.image.repository=\"eu.gcr.io/bbc-registry/command-export-russian-user\"\ |
334 | | - \ and proc.name=\"sftp\")" |
335 | | - append: false |
336 | | - |
337 | 243 | - rule: "Launch Remote File Copy Tools in Container" |
338 | 244 | condition: "and not user_known_remote_file_copy_activities" |
339 | 245 | tags: [] |
|
349 | 255 | tags: [] |
350 | 256 | append: true |
351 | 257 |
|
352 | | -- macro: "user_known_container_drift_activities" |
353 | | - condition: "((container.image.repository=\"fluxcd/helm-operator\" and proc.name=\"\ |
354 | | - git\" and evt.arg.filename endswith \"/.git/config\") or (container.image.repository=\"\ |
355 | | - fluxcd/flux\" and proc.name=\"git\" and evt.arg.filename endswith \"/.git/config\"\ |
356 | | - ) or (container.image.repository=\"k8s.gcr.io/fluentd-gcp-scaler\" and proc.name=\"\ |
357 | | - kubectl\" and evt.arg.filename startswith \"/root/.kube/cache/discovery/\") or\ |
358 | | - \ (container.image.repository=\"eu.gcr.io/bbc-registry/command-bnp-payout-report\"\ |
359 | | - \ and proc.name=\"gpg-agent\" and evt.arg.filename startswith \"/root/.gnupg/\"\ |
360 | | - ) or (container.image.repository=\"gcr.io/stackdriver-agents/stackdriver-logging-agent\"\ |
361 | | - \ and evt.arg.filename startswith \"/var/run/google-fluentd/\") or (container.image.repository=\"\ |
362 | | - weaveworks/prom-aggregation-gateway\" and proc.name=\"prom-aggregatio\" and evt.arg.filename\ |
363 | | - \ startswith \"/var/lib/docker/\") or (container.image.repository=\"datadog/agent\"\ |
364 | | - \ and proc.name=\"system-probe\" and evt.arg.filename startswith \"/var/run/sysprobe/\"\ |
365 | | - ) or (container.image.repository=\"docker.elastic.co/elasticsearch/elasticsearch\"\ |
366 | | - \ and proc.name=\"java\" and evt.arg.filename startswith \"/usr/share/elasticsearch/plugins/\"\ |
367 | | - ) or (container.image.repository=\"docker.elastic.co/elasticsearch/elasticsearch\"\ |
368 | | - \ and proc.name=\"cp\" and evt.arg.filename startswith \"/mnt/elastic-internal/elasticsearch-config-local/\"\ |
369 | | - ) or (container.image.repository=\"istio/proxyv2\" and proc.name=\"pilot-agent\"\ |
370 | | - \ and evt.arg.filename startswith \"/var/lib/docker/overlay2/\"))" |
371 | | - append: false |
372 | | - |
373 | 258 | - macro: "test_foo_bar" |
374 | 259 | condition: "never_true" |
375 | 260 | append: false |
0 commit comments