istio.io/content/zh/blog/2019/webhook/index.md

30 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 安全管理 Webhook
description: 一种更安全管理 Istio webhook 的方法。
publishdate: 2019-11-14
attribution: Lei Tang (Google)
keywords: [security, kubernetes, webhook]
target_release: 1.4
---
`Istio` 有两个 `webhook`,分别是 `Galley``sidecar injector`
`Galley` 负责验证 `Kubernetes` 资源,`sidecar injector` 负责将 `sidecar` 中注入 `Istio`
默认情况下,`Galley` 和 `sidecar injector` 管理它们自己 `Webhook` 的配置。如果出现漏洞(例如,缓冲区溢出)它们便会受到威胁,可能会带来一些安全隐患。所以,配置 `Webhook` 是一项权限很高的操作,因为 `Webhook` 会监控和更改所有 `Kubernetes secrets`
在以下示例中,攻击者破坏了 `Galley` 并修改了 `Galley``webhook` 配置,以便于窃听所有 `Kubernetes` 机密(`clientConfig` 攻击者对其进行了修改,将 `secrets` 资源改变为攻击者自己所拥有的服务)。
{{< image width="70%"
link="./example_attack.png"
caption="攻击示例"
>}}
为了防止这种攻击,`Istio` 1.4 引入了一项新功能,可以使用 `istioctl` 更安全地管理 `Webhook`
1. `istioctl` 替代 `Galley``sidecar injector` 去管理 `Webhook` 配置。
`Galley``sidecar injector` 已经被解除特殊权限,因此即便受到侵入,它们也无法更改 `Webhook` 的配置。
1. 在配置 `Webhook` 前, `istioctl` 将验证 `Webhook` 服务器是否已启动和该 `Webhook` 服务器使用的证书链是否有效。这样可以减少在服务器就绪之前或服务器证书失效时可能发生的错误。
要尝试此新功能,请参阅 [Istio Webhook 管理内容](https://archive.istio.io/1.4/zh/docs/tasks/security/webhook)。