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

Theia cannot reach the API server with both TLS and proxy enabled #16356

Closed
5 of 23 tasks
davidfestal opened this issue Mar 13, 2020 · 10 comments
Closed
5 of 23 tasks

Theia cannot reach the API server with both TLS and proxy enabled #16356

davidfestal opened this issue Mar 13, 2020 · 10 comments
Assignees
Labels
area/editor/theia Issues related to the che-theia IDE of Che 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.

Comments

@davidfestal
Copy link
Contributor

Describe the bug

When both TLS and http proxy are enabled, it seems that Theia cannot reach the Che server API endpoint by its external URL.

This becomes critical now that TLS is enabled by default to have webviews working.

This might be related to this Axios bug: axios/axios#925 (comment)

Che version

  • latest
  • nightly
  • other: please specify

Steps to reproduce

  1. Configure a Che server installation with a proxy and without TLS: Che-theia workspace should be able to start correctly (with webview problems though)
  2. Configure a Che server installation with a proxy and with TLS: You should see some errors in the Che-theia logs and Che-theia would be able to fetch the workspace definition from the Che API server

Expected behavior

http proxy configuration should work even when TLS is enabled (which is the default case now)

Runtime

  • kubernetes (include output of kubectl version)
  • Openshift (include output of oc version)
  • minikube (include output of minikube version and kubectl version)
  • minishift (include output of minishift version and oc version)
  • docker-desktop + K8S (include output of docker version and kubectl version)
  • other: (please specify)

Installation method

  • chectl
  • che-operator
  • minishift-addon
  • I don't know

Environment

  • my computer
    • Windows
    • Linux
    • macOS
  • Cloud
    • Amazon
    • Azure
    • GCE
    • other (please specify)
  • other: please specify

Eclipse Che Logs

Additional context

This might be critical for CRW 2.1 and possibly to include into the 7.9.2 release

@davidfestal davidfestal added the kind/bug Outline of a bug - must adhere to the bug report template. label Mar 13, 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 Mar 13, 2020
@davidfestal
Copy link
Contributor Author

One possible way to fix it might be to use the solution proposed here: axios/axios#925 (comment) in the che-workspace-client, in case https_proxy env variable is set and TLS mode is enabled (API URL starts with https)
cc @vinokurig

@sleshchenko sleshchenko added area/editor/theia Issues related to the che-theia IDE of Che area/workspace-client-lib labels Mar 13, 2020
@tolusha tolusha added 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 Mar 13, 2020
@davidfestal
Copy link
Contributor Author

@dmytro-ndp @RickJWagner seemed to think it should be considered as a blocker for CRW 2.1

@rhopp @l0rd do you confirm ?

@rhopp
Copy link
Contributor

rhopp commented Mar 13, 2020

I tend to agree... Running without tls or without proxy is imo no-go for lot of production environments.

@davidfestal
Copy link
Contributor Author

I assigned it me since I'm currently investigating it in the context of the restricted environment tests (required to continue the tests until the end), and @ivinokur (who knows this codebase) kindly proposed his help to implement a potential fix in a temporary 7.9.x-based che-teia docker image (already available). So as soon as I've tested this image and confirmed it can fix the issue, I assume we would propose a PR for the controller team to review, in order to possibly finally update the generated NPM package in the 7.9.x branch of che-theia

@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 Mar 15, 2020
@vinokurig
Copy link
Contributor

vinokurig commented Mar 16, 2020

@davidfestal Did my fix helped? I can open a PR based on that fix. Would it be useful?

@davidfestal
Copy link
Contributor Author

I tested the docker image provided by @vinokurig based on this proposed fix: axios/axios#925 (comment) But it doesn't seem to fix the problem.

@vinokurig vinokurig self-assigned this Mar 17, 2020
@davidfestal
Copy link
Contributor Author

After a bunch of tests done with the axios library inside the che-theia container of a Che workspace running in a disconnected environment behind a proxy*, here is the current analysis of the problem:
The error was coming from the fact that axios implementation of https requests through a http proxy is limited. In particular, it seems it doesn't correctly use the CONNECT method that allows tunneling a https request inside a http proxy.
A consequence of this is that the underlying socket connection opened to finally reach the target endpoint is not a ssl socket. This finally results in an error from the Proxy, especially with self-signed certificates.

The good news of this is that Axios is configurable / customizable enough, so that, when a https request needs a http proxy, we should be able to override the request config to change the httpsAgent and use one created by the tunnel module.

I already tested the tunnel module solution and was able to reach the Che API server through the proxy even with TLS and self-signed certificates.

I'll further propose a PR to include this into the existing che-workspae-client package.

@davidfestal
Copy link
Contributor Author

The possible fix mentioned in previous comment has been implemented and tested with the help of @ivinokur and it seems to correctly fix the bug on a disconnected environment cluster with a proxy.
I was able to start a workspace and use a terminal as shown in the screen capture.

image

Only remaining problem is the loading of the project zip through the proxy by wget . That a completely different problem though.

@davidfestal
Copy link
Contributor Author

Main bug will be fixed by PR eclipse-che/che-workspace-client#28 as soon as the built MPN package is updated in che-theia.

@disaster37
Copy link

Hi, I have started che 7.17.0 and I have the same matter when deploy it with tls and use enterprise proxy.
All start right on kubernetes, and my browser access to teiga, but all is blank and nothing work.

How I can mitigate this ?

Best Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/theia Issues related to the che-theia IDE of Che 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

8 participants