@@ -4,7 +4,7 @@ reviewers:
4
4
- sttts
5
5
- ericchiang
6
6
content_type : concept
7
- title : 使用 Falco 审计
7
+ title : 使用 Falco 审核
8
8
---
9
9
<!--
10
10
---
@@ -16,47 +16,31 @@ content_type: concept
16
16
title: Auditing with Falco
17
17
---
18
18
-->
19
- <!-- overview -->
20
19
<!--
20
+
21
21
### Use Falco to collect audit events
22
- -->
23
- ### 使用 Falco 采集审计事件
24
22
25
- <!--
26
- [Falco](https://falco.org/) is an open source project for intrusion and abnormality detection for Cloud Native platforms.
27
- This section describes how to set up Falco, how to send audit events to the Kubernetes Audit endpoint exposed by Falco, and how Falco applies a set of rules to automatically detect suspicious behavior.
28
- -->
29
- [ Falco] ( https://falco.org/ ) 是一个开源项目,用于为云原生平台提供入侵和异常检测。本节介绍如何设置 Falco、如何将审计事件发送到 Falco 公开的 Kubernetes Audit 端点、以及 Falco 如何应用一组规则来自动检测可疑行为。
23
+ [Falco](https://falco.org/) is an open source project for intrusion and abnormality detection for Cloud Native platforms. This section describes how to set up Falco, how to send audit events to the Kubernetes Audit endpoint exposed by Falco, and how Falco applies a set of rules to automatically detect suspicious behavior.
30
24
25
+ -->
31
26
27
+ ### 使用 Falco 收集审核事件
32
28
33
- <!-- body -->
29
+ Falco 是一个用于云原生平台入侵和异常检测的开源项目。 本节介绍如何设置 Falco,如何将审核事件发送到Falco公开的 Kubernetes Audit 端点以及 Falco 如何用一组规则来自动检测可疑行为。
34
30
35
31
<!--
32
+
36
33
#### Install Falco
37
- -->
38
- #### 安装 Falco
39
34
40
- <!--
41
35
Install Falco by using one of the following methods:
42
- -->
43
- 使用以下方法安装 Falco :
44
36
45
- <!--
46
37
- [Standalone Falco][falco_installation]
47
38
- [Kubernetes DaemonSet][falco_installation]
48
39
- [Falco Helm Chart][falco_helm_chart]
49
- -->
50
- - [ 独立安装 Falco] [ falco_installation ]
51
- - [ Kubernetes DaemonSet] [ falco_installation ]
52
- - [ Falco Helm Chart] [ falco_helm_chart ]
53
40
54
- <!--
55
41
Once Falco is installed make sure it is configured to expose the Audit webhook. To do so, use the following configuration:
56
- -->
57
- 安装完成 Falco 后,请确保将其配置为公开 Audit Webhook。为此,请使用以下配置:
58
42
59
- ``` yaml
43
+ ```
60
44
webserver:
61
45
enabled: true
62
46
listen_port: 8765
@@ -65,85 +49,103 @@ webserver:
65
49
ssl_certificate: /etc/falco/falco.pem
66
50
```
67
51
68
- <!--
69
52
This configuration is typically found in the `/etc/falco/falco.yaml` file. If Falco is installed as a Kubernetes DaemonSet, edit the `falco-config` ConfigMap and add this configuration.
70
- -->
71
- 此配置通常位于 `/etc/falco/falco.yaml` 文件中。如果 Falco 作为 Kubernetes DaemonSet 安装,请编辑 `falco-config` ConfigMap 并添加此配置。
72
- <!--
73
- # ### Configure Kubernetes Audit
74
- -->
75
- # ### 配置 Kubernetes 审计
76
53
77
- <!--
78
- 1. Create a [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/) for the [kube-apiserver][kube-apiserver] webhook audit backend.
79
-
80
- cat <<EOF > /etc/kubernetes/audit-webhook-kubeconfig
81
- apiVersion : v1
82
- kind : Config
83
- clusters :
84
- - cluster :
85
- server : http://<ip_of_falco>:8765/k8s_audit
86
- name : falco
87
- contexts :
88
- - context :
89
- cluster : falco
90
- user : " "
91
- name : default-context
92
- current-context : default-context
93
- preferences : {}
94
- users : []
95
- EOF
96
54
-->
97
- 1. 为 [kube-apiserver][kube-apiserver] webhook 审计后端创建一个[kubeconfig](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)文件。
98
-
99
- cat <<EOF > /etc/kubernetes/audit-webhook-kubeconfig
100
- apiVersion : v1
101
- kind : Config
102
- clusters :
103
- - cluster :
104
- server : http://<ip_of_falco>:8765/k8s_audit
105
- name : falco
106
- contexts :
107
- - context :
108
- cluster : falco
109
- user : " "
110
- name : default-context
111
- current-context : default-context
112
- preferences : {}
113
- users : []
114
- EOF
55
+
56
+ #### 安装 Falco
57
+
58
+ 您可通过以下方式安装 Falco:
59
+
60
+ - [ 单机版 Falco] [ falco_installation ]
61
+ - [ Kubernetes DaemonSet] [ falco_installation ]
62
+ - [ Falco Helm Chart] [ falco_helm_chart ]
63
+
64
+ 安装Falco后,请确保将其配置成公开Audit Webhook。为此,请使用以下配置:
65
+
66
+ ```
67
+ webserver:
68
+ enabled: true
69
+ listen_port: 8765
70
+ k8s_audit_endpoint: /k8s_audit
71
+ ssl_enabled: false
72
+ ssl_certificate: /etc/falco/falco.pem
73
+ ```
74
+
75
+ 主要在 ` /etc/falco/falco.yaml ` 文件进行配置。如果 Falco 以 Kubernetes DaemonSet 方式安装,编辑 ` falco-config ` 配置文件并添加这个配置。
76
+
115
77
<!--
116
- 1. Start [kube-apiserver][kube-apiserver] with the following options :
117
78
118
- ` ` ` shell
119
- --audit-policy-file=/etc/kubernetes/audit-policy.yaml --audit-webhook-config-file=/etc/kubernetes/audit-webhook-kubeconfig
120
- ` ` `
121
- -->
122
- 2. 使用以下选项启动 [kube-apiserver][kube-apiserver]:
79
+ #### Configure Kubernetes Audit
80
+
81
+ 1. Create a [kubeconfig file](https://github.com/kubernetes/website/blob/release-1.16/docs/concepts/configuration/organize-cluster-access-kubeconfig) for the [kube-apiserver](https://github.com/kubernetes/website/blob/release-1.16/docs/admin/kube-apiserver) webhook audit backend.
82
+
83
+ ```
84
+ cat <<EOF > /etc/kubernetes/audit-webhook-kubeconfig
85
+ apiVersion: v1
86
+ kind: Config
87
+ clusters:
88
+ - cluster:
89
+ server: http://<ip_of_falco>:8765/k8s_audit
90
+ name: falco
91
+ contexts:
92
+ - context:
93
+ cluster: falco
94
+ user: ""
95
+ name: default-context
96
+ current-context: default-context
97
+ preferences: {}
98
+ users: []
99
+ EOF
100
+ ```
101
+
102
+ 2. Start [kube-apiserver](https://github.com/kubernetes/website/blob/release-1.16/docs/admin/kube-apiserver) with the following options:
103
+
104
+ ```
105
+ --audit-policy-file=/etc/kubernetes/audit-policy.yaml --audit-webhook-config-file=/etc/kubernetes/audit-webhook-kubeconfig
106
+ ```
107
+
108
+ -->
109
+
110
+ #### 配置 Kubernetes 审核
111
+
112
+ 1 . 为 [ kube-apiserver] ( https://github.com/kubernetes/website/blob/release-1.16/docs/admin/kube-apiserver ) webhook 审核后台创建一个 [ kubeconfig 配置文件] ( https://github.com/kubernetes/website/blob/release-1.16/docs/concepts/configuration/organize-cluster-access-kubeconfig ) 。
113
+
114
+ ```
115
+ cat <<EOF > /etc/kubernetes/audit-webhook-kubeconfig
116
+ apiVersion: v1
117
+ kind: Config
118
+ clusters:
119
+ - cluster:
120
+ server: http://<ip_of_falco>:8765/k8s_audit
121
+ name: falco
122
+ contexts:
123
+ - context:
124
+ cluster: falco
125
+ user: ""
126
+ name: default-context
127
+ current-context: default-context
128
+ preferences: {}
129
+ users: []
130
+ EOF
131
+ ```
132
+
133
+ 2 . 以如下配置启动 [ kube-apiserver] ( https://github.com/kubernetes/website/blob/release-1.16/docs/admin/kube-apiserver ) :
134
+
135
+ ```
136
+ --audit-policy-file=/etc/kubernetes/audit-policy.yaml --audit-webhook-config-file=/etc/kubernetes/audit-webhook-kubeconfig
137
+ ```
123
138
124
- ` ` ` shell
125
- --audit-policy-file=/etc/kubernetes/audit-policy.yaml --audit-webhook-config-file=/etc/kubernetes/audit-webhook-kubeconfig
126
- ` ` `
127
139
<!--
140
+
128
141
#### Audit Rules
129
- -->
130
- # ### 审计规则
131
142
132
- <!--
133
143
Rules devoted to Kubernetes Audit Events can be found in [k8s_audit_rules.yaml][falco_k8s_audit_rules]. If Audit Rules is installed as a native package or using the official Docker images, Falco copies the rules file to `/etc/falco/`, so they are available for use.
134
144
135
145
There are three classes of rules.
136
146
137
147
The first class of rules looks for suspicious or exceptional activities, such as:
138
- -->
139
-
140
- 专门用于 Kubernetes 审计事件的规则可以在 [k8s_audit_rules.yaml][falco_k8s_audit_rules] 中找到。如果审计规则是作为本机软件包安装或使用官方 Docker 镜像安装的,则 Falco 会将规则文件复制到 `/etc/falco/` 中以便使用。
141
-
142
- 共有三类规则。
143
-
144
- 第一类规则用于查找可疑或异常活动,例如:
145
148
146
- <!--
147
149
- Any activity by an unauthorized or anonymous user.
148
150
- Creating a pod with an unknown or disallowed image.
149
151
- Creating a privileged pod, a pod mounting a sensitive filesystem from the host, or a pod using host networking.
@@ -154,23 +156,9 @@ The first class of rules looks for suspicious or exceptional activities, such as
154
156
- Creating a pod or service account in the kube-system or kube-public namespaces.
155
157
- Trying to modify or delete a system ClusterRole.
156
158
- Creating a ClusterRoleBinding to the cluster-admin role.
157
- - Creating a ClusterRole with wildcarded verbs or resources. For example, overly permissive.
159
+ - Creating a ClusterRole with wildcarded verbs or resources. For example, overly permissive.
158
160
- Creating a ClusterRole with write permissions or a ClusterRole that can execute commands on pods.
159
- -->
160
- -未经授权或匿名用户的任何活动。
161
- -创建使用未知或不允许的镜像的 pod。
162
- -创建特权 Pod,从主机安装敏感文件系统的 Pod 或使用主机网络的 Pod。
163
- -创建 NodePort 服务。
164
- -创建包含私有证书(例如密码和云提供商 secrets )的 ConfigMap。
165
- -在正在运行的 Pod 上附加或执行命令。
166
- -在一组允许的名称空间之外创建一个名称空间。
167
- -在 kube-system 或 kube-public 命名空间中创建 pod 或服务帐户。
168
- -尝试修改或删除系统 ClusterRole。
169
- -创建一个 ClusterRoleBinding 到 cluster-admin 角色。
170
- -创建 ClusterRole 时在动词或资源中使用通配符。 例如,过度赋权。
171
- -创建具有写权限的 ClusterRole 或可以在 Pod 上执行命令的 ClusterRole。
172
161
173
- <!--
174
162
A second class of rules tracks resources being created or destroyed, including:
175
163
176
164
- Deployments
@@ -180,60 +168,48 @@ A second class of rules tracks resources being created or destroyed, including:
180
168
- Service accounts
181
169
- Role/ClusterRoles
182
170
- Role/ClusterRoleBindings
183
- -->
184
- 第二类规则跟踪正在创建或销毁的资源,包括:
185
171
186
- - Deployments
187
- - Services
188
- - ConfigMaps
189
- - Namespaces
190
- - Service accounts
191
- - Role/ClusterRoles
192
- - Role/ClusterRoleBindings
193
-
194
- <!--
195
172
The final class of rules simply displays any Audit Event received by Falco. This rule is disabled by default, as it can be quite noisy.
196
173
197
174
For further details, see [Kubernetes Audit Events][falco_ka_docs] in the Falco documentation.
175
+
176
+ [auditing-api]: [https://github.com/kubernetes/kubernetes/blob/{{](https://github.com/kubernetes/kubernetes/blob/%7B%7B)< param "githubbranch" >}}/staging/src/k8s.io/apiserver/pkg/apis/audit/v1/types.go [gce-audit-profile]: [https://github.com/kubernetes/kubernetes/blob/{{](https://github.com/kubernetes/kubernetes/blob/%7B%7B)< param "githubbranch" >}}/cluster/gce/gci/configure-helper.sh#L735 [kubeconfig]: /docs/tasks/access-application-cluster/configure-access-multiple-clusters/ [fluentd]: <http://www.fluentd.org/> [fluentd_install_doc]: <https://docs.fluentd.org/v1.0/articles/quickstart#step-1:-installing-fluentd> [fluentd_plugin_management_doc]: <https://docs.fluentd.org/v1.0/articles/plugin-management> [logstash]: <https://www.elastic.co/products/logstash> [logstash_install_doc]: <https://www.elastic.co/guide/en/logstash/current/installing-logstash.html> [kube-aggregator]: /docs/concepts/api-extension/apiserver-aggregation [falco_website]: [https://www.falco.org](https://www.falco.org/) [falco_k8s_audit_rules]: <https://github.com/falcosecurity/falco/blob/master/rules/k8s_audit_rules.yaml> [falco_ka_docs]: <https://falco.org/docs/event-sources/kubernetes-audit> [falco_installation]: <https://falco.org/docs/installation> [falco_helm_chart]: <https://github.com/helm/charts/tree/master/stable/falco>
177
+
198
178
-->
199
179
200
- 最后一类规则仅负责显示 Falco 收到的所有审核事件。默认情况下,此规则是禁用的,因为它可能会很吵。
180
+ #### 审核规则
201
181
202
- 有关更多详细信息,请参阅 Falco 文档中的[Kubernetes审计事件][falco_ka_docs] 。
182
+ 用于 Kubernetes 审核事件的规则可以在 [ k8s_audit_rules.yaml ] [ falco_k8s_audit_rules ] 文件中找到。如果审核规则作为本地软件包安装或使用官方 Docker 镜像安装,则 Falco 会将规则文件复制到 ` /etc/falco/ ` 中,以便可以使用它们 。
203
183
204
- <!--
205
- [kube-apiserver] : /docs/admin/kube-apiserver
206
- [auditing-proposal] : https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/auditing.md
207
- [auditing-api] : https://github.com/kubernetes/kubernetes/blob/{{< param "githubbranch" >}}/staging/src/k8s.io/apiserver/pkg/apis/audit/v1/types.go
208
- [gce-audit-profile] : https://github.com/kubernetes/kubernetes/blob/{{< param "githubbranch" >}}/cluster/gce/gci/configure-helper.sh#L735
209
- [kubeconfig] : /docs/tasks/access-application-cluster/configure-access-multiple-clusters/
210
- [fluentd] : http://www.fluentd.org/
211
- [fluentd_install_doc] : https://docs.fluentd.org/v1.0/articles/quickstart#step-1:-installing-fluentd
212
- [fluentd_plugin_management_doc] : https://docs.fluentd.org/v1.0/articles/plugin-management
213
- [logstash] : https://www.elastic.co/products/logstash
214
- [logstash_install_doc] : https://www.elastic.co/guide/en/logstash/current/installing-logstash.html
215
- [kube-aggregator] : /docs/concepts/api-extension/apiserver-aggregation
216
- [falco_website] : https://www.falco.org
217
- [falco_k8s_audit_rules] : https://github.com/falcosecurity/falco/blob/master/rules/k8s_audit_rules.yaml
218
- [falco_ka_docs] : https://falco.org/docs/event-sources/kubernetes-audit
219
- [falco_installation] : https://falco.org/docs/installation
220
- [falco_helm_chart] : https://github.com/helm/charts/tree/master/stable/falco
221
- -->
222
- [kube-apiserver] : /docs/admin/kube-apiserver
223
- [auditing-proposal] : https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/auditing.md
224
- [auditing-api] : https://github.com/kubernetes/kubernetes/blob/{{< param "githubbranch" >}}/staging/src/k8s.io/apiserver/pkg/apis/audit/v1/types.go
225
- [gce-audit-profile] : https://github.com/kubernetes/kubernetes/blob/{{< param "githubbranch" >}}/cluster/gce/gci/configure-helper.sh#L735
226
- [kubeconfig] : /docs/tasks/access-application-cluster/configure-access-multiple-clusters/
227
- [fluentd] : http://www.fluentd.org/
228
- [fluentd_install_doc] : https://docs.fluentd.org/v1.0/articles/quickstart#step-1:-installing-fluentd
229
- [fluentd_plugin_management_doc] : https://docs.fluentd.org/v1.0/articles/plugin-management
230
- [logstash] : https://www.elastic.co/products/logstash
231
- [logstash_install_doc] : https://www.elastic.co/guide/en/logstash/current/installing-logstash.html
232
- [kube-aggregator] : /docs/concepts/api-extension/apiserver-aggregation
233
- [falco_website] : https://www.falco.org
234
- [falco_k8s_audit_rules] : https://github.com/falcosecurity/falco/blob/master/rules/k8s_audit_rules.yaml
235
- [falco_ka_docs] : https://falco.org/docs/event-sources/kubernetes-audit
236
- [falco_installation] : https://falco.org/docs/installation
237
- [falco_helm_chart] : https://github.com/falcosecurity/charts/tree/master/falco
184
+ 共有三类规则。
185
+
186
+ 第一类规则用于查找可疑或异常活动,例如:
187
+
188
+ - 未经授权或匿名用户的任何活动。
189
+ - 使用未知或不允许的镜像创建 Pod。
190
+ - 创建特权 Pod,从主机安装敏感文件系统的 Pod 或使用主机联网的 Pod。
191
+ - 创建一个 NodePort 服务。
192
+ - 创建一个包含私有凭证(例如密码和云提供商机密)的 ConfigMap。
193
+ - 在正在运行的 Pod 上附加或执行命令。
194
+ - 在一组允许的命名空间外部创建一个命名空间。
195
+ - 在 kube-system 或 kube-public 命名空间中创建 Pod 或服务帐户。
196
+ - 试图修改或删除系统 ClusterRole。
197
+ - 给 cluster-admin 角色创建一个 ClusterRoleBinding。
198
+ - 使用通配动词或资源创建 ClusterRole,例如 overly permissive。
199
+ - 创建具有写权限的 ClusterRole 或可以在 Pod 上执行命令的 ClusterRole。
200
+
201
+ 第二类规则跟踪正在创建或销毁的资源,包括:
202
+
203
+ - 部署
204
+ - 服务
205
+ - 配置
206
+ - 命名空间
207
+ - 服务账户
208
+ - 角色/集群角色
209
+ - 角色/集群角色绑定
210
+
211
+ 最后一类规则仅显示 Falco 收到的所有审核事件。默认情况下,此规则是禁用的,因为它可能会很琐碎。
238
212
213
+ 更多详细信息,请参考 Falco 文档中的 [ Kubernetes Audit Events] [ falco_ka_docs ] 。
239
214
215
+ [auditing-api]: [https://github.com/kubernetes/kubernetes/blob/{{](https://github.com/kubernetes/kubernetes/blob/%7B%7B)< param "githubbranch" >}}/staging/src/k8s.io/apiserver/pkg/apis/audit/v1/types.go [gce-audit-profile]: [https://github.com/kubernetes/kubernetes/blob/{{](https://github.com/kubernetes/kubernetes/blob/%7B%7B)< param "githubbranch" >}}/cluster/gce/gci/configure-helper.sh#L735 [kubeconfig]: /docs/tasks/access-application-cluster/configure-access-multiple-clusters/ [fluentd]: <http://www.fluentd.org/> [fluentd_install_doc]: <https://docs.fluentd.org/v1.0/articles/quickstart#step-1:-installing-fluentd> [fluentd_plugin_management_doc]: <https://docs.fluentd.org/v1.0/articles/plugin-management> [logstash]: <https://www.elastic.co/products/logstash> [logstash_install_doc]: <https://www.elastic.co/guide/en/logstash/current/installing-logstash.html> [kube-aggregator]: /docs/concepts/api-extension/apiserver-aggregation [falco_website]: [https://www.falco.org](https://www.falco.org/) [falco_k8s_audit_rules]: <https://github.com/falcosecurity/falco/blob/master/rules/k8s_audit_rules.yaml> [falco_ka_docs]: <https://falco.org/docs/event-sources/kubernetes-audit> [falco_installation]: <https://falco.org/docs/installation> [falco_helm_chart]: <https://github.com/helm/charts/tree/master/stable/falco
0 commit comments