@@ -224,6 +224,56 @@ or **Restricted** Pod Security Standard.
224
224
类似地,希望阻止客户端应用程序从其容器中逃逸的管理员,应该应用 ** Baseline**
225
225
或 ** Restricted** Pod 安全标准。
226
226
227
+
228
+ <!--
229
+ ### Preventing containers from loading unwanted kernel modules
230
+ -->
231
+ ### 防止容器加载不需要的内核模块 {#preventing-containers-from-loading-unwanted-kernel-modules}
232
+ <!--
233
+ The Linux kernel automatically loads kernel modules from disk if needed in certain
234
+ circumstances, such as when a piece of hardware is attached or a filesystem is mounted. Of
235
+ particular relevance to Kubernetes, even unprivileged processes can cause certain
236
+ network-protocol-related kernel modules to be loaded, just by creating a socket of the
237
+ appropriate type. This may allow an attacker to exploit a security hole in a kernel module
238
+ that the administrator assumed was not in use.
239
+ -->
240
+ 如果在某些情况下,Linux 内核会根据需要自动从磁盘加载内核模块,
241
+ 这类情况的例子有挂接了一个硬件或挂载了一个文件系统。
242
+ 与 Kubernetes 特别相关的是,即使是非特权的进程也可能导致某些网络协议相关的内核模块被加载,
243
+ 而这只需创建一个适当类型的套接字。
244
+ 这就可能允许攻击者利用管理员假定未使用的内核模块中的安全漏洞。
245
+
246
+ <!--
247
+ To prevent specific modules from being automatically loaded, you can uninstall them from
248
+ the node, or add rules to block them. On most Linux distributions, you can do that by
249
+ creating a file such as `/etc/modprobe.d/kubernetes-blacklist.conf` with contents like:
250
+ -->
251
+ 为了防止特定模块被自动加载,你可以将它们从节点上卸载或者添加规则来阻止这些模块。
252
+ 在大多数 Linux 发行版上,你可以通过创建类似 ` /etc/modprobe.d/kubernetes-blacklist.conf `
253
+ 这种文件来做到这一点,其中的内容如下所示:
254
+
255
+ ```
256
+ # DCCP is unlikely to be needed, has had multiple serious
257
+ # vulnerabilities, and is not well-maintained.
258
+ blacklist dccp
259
+
260
+ # SCTP is not used in most Kubernetes clusters, and has also had
261
+ # vulnerabilities in the past.
262
+ blacklist sctp
263
+ ```
264
+
265
+ <!--
266
+ To block module loading more generically, you can use a Linux Security Module (such as
267
+ SELinux) to completely deny the `module_request` permission to containers, preventing the
268
+ kernel from loading modules for containers under any circumstances. (Pods would still be
269
+ able to use modules that had been loaded manually, or modules that were loaded by the
270
+ kernel on behalf of some more-privileged process.)
271
+ -->
272
+ 为了更大范围地阻止内核模块被加载,你可以使用 Linux 安全模块(如 SELinux)
273
+ 来彻底拒绝容器的 ` module_request ` 权限,从而防止在任何情况下系统为容器加载内核模块。
274
+ (Pod 仍然可以使用手动加载的模块,或者使用由内核代表某些特权进程所加载的模块。)
275
+
276
+
227
277
<!--
228
278
### Restricting network access
229
279
0 commit comments