"Peer's certificate issuer has been marked as not trusted by the user" 在 Openshift3 中

"Peer's certificate issuer has been marked as not trusted by the user" in Openshift3

如果 Openshift3 中的 S2I - "Source-to-image" 资源尝试连接到 TLS Gitlab 存储库,则显示以下消息:"Peer's certificate issuer has been marked as not trusted by the user".

我如何指示 Openshift3 可以在那里使用哪些证书颁发机构?有什么config/option可以绕过这个错误吗?

输入的命令是:

oc new-app tomcat~https://gitlab.xxx/test/test.git --name=test --strategy=docker

出于安全原因,您应该添加 trusted CA source secret to the BuildConfig. To answer your question, you can disable TLS verification by setting an environment variable GIT_SSL_NO_VERIFY to false in the BuildConfig. Checks the docs here 以获取更多信息。

将其直接传递给 oc new-app 命令 运行 oc new-app --build-env GIT_SSL_NO_VERIFY=false

或者,我建议只导入根 CA,以便 TLS 验证有效。不会试图说明为什么这应该是 必须 的所有原因,但您可以这样做:

1) 获取根证书文件。

如果您是 运行 内部 Gitlab 实例,那么设置它的人应该能够将您指向他们正在使用的根 CA。

2) 使用证书文件创建新密钥

#oc secrets new [secret name] ca.crt=[local .crt file]
oc secrets new tls-root-ca ca.crt=my-it-ca.crt

3) 将您新创建的密钥附加到构建配置

    #oc patch bc/[build config name] --patch '{ "spec": {"source": { "sourceSecret": { "name": "[secret name]" } } } }'
    oc patch bc/my-build --patch '{ "spec": {"source": { "sourceSecret": { "name": "tls-root-ca" } } } }'

如果您不熟悉 patch 命令,这只是添加一个 "sourceSecret" 块,如下所示:

  source:
    git:
      uri: https://your.gitlab.org/your-app
    sourceSecret:
      name: tls-root-ca

另见 openshift guide on build input secrets