【问题标题】:What is meaning of Kubernetes webhook user client-certificate config?Kubernetes webhook 用户客户端证书配置是什么意思?
【发布时间】:2018-05-10 16:48:26
【问题描述】:

我需要为 Kubernetes 实现一个自定义的身份验证和授权模块。这必须通过网络挂钩来完成。

authenticationauthorisation webhook 的文档描述了 API 服务器需要启动的配置文件。

身份验证和授权的配置文件看起来相同,如下所示:

# clusters refers to the remote service.
clusters:
  - name: name-of-remote-authn-service
    cluster:
      certificate-authority: /path/to/ca.pem         # CA for verifying the remote service.
      server: https://authn.example.com/authenticate # URL of remote service to query. Must use 'https'.

# users refers to the API server's webhook configuration.
users:
  - name: name-of-api-server
    user:
      client-certificate: /path/to/cert.pem # cert for the webhook plugin to use
      client-key: /path/to/key.pem          # key matching the cert

# kubeconfig files require a context. Provide one for the API server.
current-context: webhook
contexts:
- context:
    cluster: name-of-remote-authn-service
    user: name-of-api-sever
  name: webhook

我可以看到clusters 部分指的是远程服务,即它定义了 webhook,从而回答了 API 服务器需要回答的问题:“当 authn/authz 决定时要命中的 URL 端点是什么是必需的,当我通过 HTTPS 连接时,谁是 webhook 的 TLS 证书的 CA 机构,以便我知道我可以信任远程 webhook?"

我不确定users 部分。 client-certificateclient-key 字段的用途是什么?文件中的注释说“要使用的 webhook 插件的证书”,但是由于这个配置文件是给 API 服务器的,而不是 web 钩子,我不明白这是什么意思。这是一个允许 webhook 服务验证 API 服务器将使用它启动的连接的证书吗?即客户端证书需要进入 webhook 服务器的信任库?

这两个假设都正确吗?

【问题讨论】:

    标签: kubernetes kubernetes-security


    【解决方案1】:

    Kubernetes webhook 使用two-way SSL authentication,因此users 部分的字段用于配置“客户端身份验证”的证书。

    clusters 部分配置只是正常工作的一种 SSL 身份验证方式,即服务器(这里是您的 webhook 模块)将使用配置的证书验证客户端(这里是 Kubernetes)的请求。

    只要您在 users 部分配置证书,客户端 (Kubernetes) 就可以验证服务器(webhook 模块)的响应,就像单向 SSL 的反向 CA 身份验证一样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-27
      • 2018-07-01
      • 2018-08-11
      • 2012-11-19
      • 2010-12-22
      • 1970-01-01
      • 2018-08-11
      • 2018-09-16
      相关资源
      最近更新 更多