Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to clone zip projects when using OpenShift trusted CA bundle #18654

Closed
l0rd opened this issue Dec 18, 2020 · 7 comments
Closed

Failure to clone zip projects when using OpenShift trusted CA bundle #18654

l0rd opened this issue Dec 18, 2020 · 7 comments
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.
Milestone

Comments

@l0rd
Copy link
Contributor

l0rd commented Dec 18, 2020

Describe the bug

Theia uses curl to download projects zip files. When a zip file is hosted on a server that uses a TLS cert signed by an untrusted CA curl fails to download the file. That's normal.

But if Che is running on OpenShift and the CA certificate is added into OpenShift CA trusted bundle (as described here) curl should not fail anymore. The certificates are correctly mounted in the container where curl runs (theia container) but curl doesn't take them into account.

This is the error:

Couldn't import https://devfile-registry-cip-crw-common.apps.xxxxx.com/resources/spring-boot-http-booster-spring-boot-http-booster-sb-2.3.x.zip:
curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not establish a secure connection
to it. To learn more about this situation and how to fix it,
please visit the web page mentioned above.

Che version

nightly

Steps to reproduce

N/A

Expected behavior

Currently Theia looks for an hardcoded crt file (/tmp/che/secret/ca.crt) and if it founds runs curl with the unsecure option -k. The problem is that crt files are currently mounted in folder /public-certs and we should avoid using curl option -k anyway.

Runtime

OpenShift

Installation method

OperatorHub

Environment

Cloud

@l0rd l0rd added the kind/bug Outline of a bug - must adhere to the bug report template. label Dec 18, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Dec 18, 2020
@l0rd
Copy link
Contributor Author

l0rd commented Dec 18, 2020

A workaround is to pre-create a secret in the workspace namespace so that Che will inject file /tmp/che/secret/ca.crt in every workspace container such as:

apiVersion: v1
kind: Secret
metadata:
  name: file-to-inject
  annotations:
    "che.eclipse.org/automount-workspace-secret": "true"
    "che.eclipse.org/mount-path": "/tmp/che/secret"
    "che.eclipse.org/mount-as": file
  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspace-secret
data:
  ca.crt: "bWlubmllCg=="

@vzhukovs
Copy link
Contributor

vzhukovs commented Dec 18, 2020

A workaround is to pre-create a secret in the workspace namespace so that Che will inject file /tmp/che/secret/ca.crt in every workspace container such as:

apiVersion: v1
kind: Secret
metadata:
  name: file-to-inject
  annotations:
    "che.eclipse.org/automount-workspace-secret": "true"
    "che.eclipse.org/mount-path": "/tmp/che/secret"
    "che.eclipse.org/mount-as": file
  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    app.kubernetes.io/component: workspace-secret
data:
  ca.crt: "bWlubmllCg=="

and then add --cacert /tmp/che/secret/ca.crt to the curl command to consume the certificate. I had similar problem when I was creating a simple sh script to track activity in Che for JetBrains related images[1].

[1] https://github.com/che-incubator/jetbrains-editor-images/blob/master/scripts/prevent-idle-timeout.sh#L22

@azatsarynnyy azatsarynnyy added area/plugins severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Dec 18, 2020
@azatsarynnyy
Copy link
Member

Related to the Welcome Plug-in, so triaged as area/plugins.
cc @ericwill

@l0rd l0rd added severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code. and removed severity/P1 Has a major impact to usage or development of the system. labels Dec 18, 2020
@vitaliy-guliy
Copy link
Contributor

vitaliy-guliy commented Dec 18, 2020

Probably it's not welcome, but workspace plugin.
@azatsarynnyy we will take a look at this.

@azatsarynnyy
Copy link
Member

Here's the example of how it was done for Task Plug-in:
https://github.com/eclipse/che-theia/blob/d504192faa6ad19eade8c5905fdc8cbdcf67a6c1/plugins/task-plugin/src/machine/websocket.ts#L203-L211
It might help as well.

@sunix
Copy link
Contributor

sunix commented Dec 18, 2020

Eventually, we need to have a common way to deal with certificates across all our plugins.

@vitaliy-guliy
Copy link
Contributor

The bug is reproducible.
In fact, there could be several certificates in /tmp/che directory. It needs also to take into account all certs in /public-certs/.
As an option is to pack all available certs into one bundle somewhere in /tmp directory and then give this bundle to curl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.
Projects
None yet
Development

No branches or pull requests

7 participants