我正在尝试配置 Istio 身份验证策略来验证我们的 JWT。
我设置了策略,可以看到它生效了。但是,它不允许任何连接。应用策略时,如果我检查 istio-pilot 日志,我可以看到它无法检索签名密钥,从而给出证书错误。
2018-10-24T03:22:41.052354Z error model Failed to fetch pubkey from "https://iam.company.com.au/oauth2/jwks": Get https://iam.company.com.au/oauth2/jwks: x509: certificate signed by unknown authority
2018-10-24T03:22:41.052371Z warn Failed to fetch jwt public key from "https://iam.company.com.au/oauth2/jwks "
我认为这是由于该服务器使用了由我们公司CA签名的TLS证书。
如何让 istio-pilot 信任来自我们 CA 的证书?我尝试安装 CA 证书并将我们的 CA 公钥包含在 Ubuntu 证书中,但它仍然不起作用。
政策:
apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
name: "our-service-jwt-example"
spec:
targets:
- name: our-service
origins:
- jwt:
issuer: iam.company.com.au
audiences:
- YRhT8xWtcLrOQmqJUGPA1p6O6mUa
jwksUri: "https://iam.company.com.au/oauth2/jwks"
principalBinding: USE_ORIGIN
飞行员为特使解析jwks。在这种情况下,飞行员需要拥有 CA 证书。目前,除非您在 istio 中部署试点时添加证书,否则无法向试点添加 CA 证书。https://github.com/istio/istio/blob/master/pilot/pkg/model/jwks_resolver.go
这是从 Istio 1.4 开始添加的:
https://github.com//istio/istio/pull/17176
您可以在pilot.jwksResolverExtraRootCA
helm 图表值中提供 PEM 格式的额外根证书(也适用于IstioOperator
的最新版本的 Istio(,它将创建一个包含extra.pem
文件的ConfigMap
,该文件应作为/cacerts/extra.pem
挂载到 istio 试点容器中。从那里它应该被自动拾取。