Spinnaker 和 Okta 集成失败

Spinnaker & Okta integration failing

场景: 将 Spinnaker 升级到 1.12.0。没有其他会影响此集成的配置更改(我们不得不修改 s3 IAM,因为它停止工作)。 Okta 集成停止工作。 Public 入口的安装过程中重新发布了密钥,可能是相关的?

SAML-TRACE 显示负载到达 okta 并返回

Spinnaker 根据浏览器和我到达那里的方式抛出两个不同的错误。

直接 link 到 deck url:(500) 没有配置 IDP,请使用至少一个 IDP 更新包含的元数据(在浏览器和网关中看到)

Okta "chicklet" 在 okta 仪表板中:(401) 身份验证失败:传入的 SAML 消息无效

配置详细信息(同样 none 已更改): 直接下载元数据 JKS 正在杠杆化且有效 服务 url 已确认 JKS 的别名已确认

我在从 1.10.13 升级到 1.12.2 时也遇到了这个问题。我在 Gate 的日志中发现了很多这样的错误信息:

2019-02-19 05:31:30.421 ERROR 1 --- [.0-8084-exec-10] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw e
xception [org.opensaml.saml2.metadata.provider.MetadataProviderException: No IDP was configured, please update included metadata with at least one IDP] with root cause

org.opensaml.saml2.metadata.provider.MetadataProviderException: No IDP was configured, please update included metadata with at least one IDP
        at org.springframework.security.saml.metadata.MetadataManager.getDefaultIDP(MetadataManager.java:795) ~[spring-security-saml2-core-1.0.2.RELEASE.jar:1.0.2.RELEASE]
        at org.springframework.security.saml.context.SAMLContextProviderImpl.populatePeerEntityId(SAMLContextProviderImpl.java:157) ~[spring-security-saml2-core-1.0.2.RELEASE.jar
:1.0.2.RELEASE]
        at org.springframework.security.saml.context.SAMLContextProviderImpl.getLocalAndPeerEntity(SAMLContextProviderImpl.java:127) ~[spring-security-saml2-core-1.0.2.RELEASE.ja
r:1.0.2.RELEASE]
        at org.springframework.security.saml.SAMLEntryPoint.commence(SAMLEntryPoint.java:146) ~[spring-security-saml2-core-1.0.2.RELEASE.jar:1.0.2.RELEASE]
        at org.springframework.security.web.access.ExceptionTranslationFilter.sendStartAuthentication(ExceptionTranslationFilter.java:203) ~[spring-security-web-4.2.9.RELEASE.jar
:4.2.9.RELEASE]
...

降级回 1.10.13 后,我升级到下一个版本 1.11.0,发现问题就是从那时开始的。最终,我查看了容器启动后 Gate 的日志,发现:

2019-02-20 22:31:40.132 ERROR 1 --- [0.0-8084-exec-3] o.o.s.m.provider.HTTPMetadataProvider    : Error retrieving metadata from https://000000000000.okta.com/app/00000000000000000/sso/saml/metadata

javax.net.ssl.SSLException: Error in hostname verification
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.verifyHostname(TLSProtocolSocketFactory.java:241) ~[openws-1.5.4.jar:na]
        at org.opensaml.ws.soap.client.http.TLSProtocolSocketFactory.createSocket(TLSProtocolSocketFactory.java:186) ~[openws-1.5.4.jar:na]
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) ~[commons-httpclient-3.1.jar:na]
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) ~[commons-httpclient-3.1.jar:na]
...

这让我意识到 TLS 证书被 Gate 拒绝了。不知道为什么它突然开始无法通过检查。到目前为止,我将其配置为:

$ hal config security authn saml edit --metadata https://000000000000.okta.com/app/00000000000000000/sso/saml/metadata

我最终下载了元数据文件并使用 halyard 重新部署。

$ wget https://000000000000.okta.com/app/00000000000000000/sso/saml/metadata
$ hal config security authn saml edit --metadata "${PWD}/metadata"
$ hal config version edit --version 1.12.2
$ hal deploy apply

按照 Spinnaker 文档的建议打开了私人浏览器 window,Gate 再次开始正确重定向到 Okta。

问题已提交,https://github.com/spinnaker/spinnaker/issues/4017

所以我最终找到了答案。 tomcat 配置在后来的 gate 版本中在 spinnaker 中发生了明显变化。

我在 ~/.hal/default/profiles/gate-local.yml

中创建了这个片段
server:
  tomcat:
    protocolHeader: X-Forwarded-Proto
    remoteIpHeader: X-Forwarded-For
    internalProxies: .*

已部署 spinnaker,它已恢复工作。