10

If S2I - "Source-to-image" resource in Openshift3 tries to connect to a TLS Gitlab repository shows the following message: "Peer's certificate issuer has been marked as not trusted by the user".

How can I instruct Openshift3 which certificates authorities are able to use there? Is there any config/option to bypass this error?

The command entered was:

oc new-app tomcat~https://gitlab.xxx/test/test.git --name=test --strategy=docker
blong
  • 2,815
  • 8
  • 44
  • 110
Carlos Alberto
  • 7,761
  • 13
  • 52
  • 72

2 Answers2

12

For security reasons, you should add a 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 for more info.

To pass this directly to the oc new-app command run oc new-app --build-env GIT_SSL_NO_VERIFY=false

PhilipGough
  • 1,709
  • 1
  • 13
  • 18
0

Alternatively, I'd suggest just importing the root CA such that TLS validation works. Won't attempt to speak to all the reasons why this should be a must, but here's how you'd do it:

1) Grab the root certificate file.

If you're running an internal Gitlab instance, whoever set it up should be able to point you to the root CA they're using.

2) Create a new secret with the certificate file

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

3) Attach your newly created secret to the build config

    #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" } } } }'

In case you're not familiar with the patch command, this is just adding a "sourceSecret" block like this:

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

See also the openshift guide on build input secrets

josh-cain
  • 4,997
  • 7
  • 35
  • 55