如何: 使用秘钥的作用域限定
You can read guidance on setting up secret store components to configure a secret store for an application. 一旦配置完毕,默认情况下 任何 该仓库内定义的密钥都可以从 Dapr 应用程序访问。
要限制 Dapr 应用程序访问密钥的话, 您可以通过向应用程序配置添加密钥作用域政策并限制权限来定义密钥作用域。 Follow to define an application configuration.
The secret scoping policy applies to any secret store, whether that is a local secret store, a Kubernetes secret store or a public cloud secret store. For details on how to set up a read How To: Retrieve a secret
观看这个 演示如何让你的应用程序使用密钥作用域。
定义下面 配置,并使用命令 kubectl apply -f appconfig.yaml
到 Kubernetes 集群。
For applications that need to be denied access to the Kubernetes secret store, follow these instructions, and add the following annotation to the application pod.
定义后,应用程序不再能访问 Kubernetes 密钥仓库的任何密钥。
这个示例使用一个名为 vault
的密钥仓库。 例如,这可能是已经设置在您的应用程序上的 Hashicorp 密钥仓库组件。 允许 Dapr 应用程序只访问在 vault
密钥仓库的 secret1
和 密钥, 需要定义下面的 appconfig.yaml
:
定义以下 :
这个示例使用一个名为 vault
的密钥仓库。 上面的配置明确禁止从名为 vault 的密钥仓库访问 secret1
和 secret2
,但允许访问所有其他密钥。 Follow to apply configuration to the sidecar.
allowedSecrets
和列表值优先于defaultAccess
策略。
- Overview of secret stores
howto-secrets/