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

How are TLS certificates propagated? #19318

Open
l0rd opened this issue Mar 18, 2021 · 11 comments
Open

How are TLS certificates propagated? #19318

l0rd opened this issue Mar 18, 2021 · 11 comments
Labels
area/doc Issues related to documentation area/editor/theia Issues related to the che-theia IDE of Che area/install Issues related to installation, including offline/air gap and initial setup kind/question Questions that haven't been identified as being feature requests or bugs. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P1 Has a major impact to usage or development of the system.

Comments

@l0rd
Copy link
Contributor

l0rd commented Mar 18, 2021

Summary

This is actually a clarification that replaces this issue. It may end up or not in a doc article.

Relevant information

In this doc article it's explained how to import custom TLS certificates in Che so that those are trusted: an admin needs to create configmaps from the CA public certs files and add the following labels:

  • app.kubernetes.io/part-of=che.eclipse.org
  • app.kubernetes.io/component=ca-bundle

but then it's not clear how Che propagates the certificates in the workspace pod.

  1. In what folder of the workspace containers are those certificates mounted?
  2. How do we specify TLS key and certificate to be used by Che ingress/routes (and to be trusted too)?
  3. How a che-theia plugin or a che editor can trust those certs?
  4. What's the self-signed-cert secret for?
@l0rd l0rd added the kind/question Questions that haven't been identified as being feature requests or bugs. label Mar 18, 2021
@l0rd
Copy link
Contributor Author

l0rd commented Mar 18, 2021

1. In what folder of the workspace containers are those certificates mounted?

image

When a new workspace is started the following happens:

  1. The certs of the ConfigMaps in the Che server namespace (labelled as mentioned above) are copied into a new ConfigMap in the workspace namespace (the new config map is named <workspace-id>-ca-certs)
  2. This new ConfigMap is used as a volume named che-ca-certs in the workspace pod
  3. The volume che-ca-certs is mounted in folder /public-certs in every container of the pod

@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 18, 2021
@tolusha tolusha added area/install Issues related to installation, including offline/air gap and initial setup area/doc Issues related to documentation area/editor/theia Issues related to the che-theia IDE of Che labels Mar 18, 2021
@tolusha
Copy link
Contributor

tolusha commented Mar 18, 2021

4. What's the self-signed-cert secret for?

For OpenShift

self-signed-certificate secret contains the certificate chain of trust of the OpenShift ingress controller only if self-signed certificate is used.

For Kubernetes

See #19318 (comment)

It is mounted as:

  • /tmp/che/secret/ca.crt file in every container of the workspace pod
  • CHE_SELF__SIGNED__CERT environment variable into che-server pod and imported into JAVA trust store [1]
  • CHE_SELF__SIGNED__CERT environment variable into keycloak pod and imported into keycloak trust store [2] [3]

[1] https://github.com/eclipse/che/blob/master/dockerfiles/che/entrypoint.sh#L325-L329
[2] https://github.com/eclipse-che/che-operator/blob/master/pkg/deploy/identity-provider/deployment_keycloak.go#L115-L118
[3] https://github.com/eclipse-che/che-operator/blob/master/pkg/deploy/identity-provider/deployment_keycloak.go#L162-L168

@tolusha
Copy link
Contributor

tolusha commented Mar 18, 2021

@l0rd
I am not sure If understood question 2

@azatsarynnyy
Question 3 is for your team.

@l0rd
Copy link
Contributor Author

l0rd commented Mar 19, 2021

@tolusha question n.2 is about what happens if an admin sets spec/k8s/tlsSecretName or /spec/server/cheHostTLSSecret:

  • Are those secrets propagated to the workspaces?
  • What's the difference between these 2 secrets?
  • Do they work for k8s only?
  • Are they related to self-signed-certificate?

@mmorhun
Copy link
Contributor

mmorhun commented Mar 19, 2021

2. How do we specify TLS key and certificate to be used by Che ingress/routes (and to be trusted too)?

spec.k8s.tlsSecretName

It is only used for Kubernetes platforms. The default value is che-tls.

1. If field is not empty

1.1. The secret defined in spec.k8s.tlsSecretName doesn't exist

All certificates are generated:

  • ca.key is a key file, it is needed to create ca.crt and sign child certificate tls.crt, dropped after the generation is finished.
  • ca.crt is a root CA certificate that should be added to user's browser(s).
  • tls.key private key that used by Che ingresses to encrypt the connection (should be only on ingress side, sharing it to users is a security risk).
  • tls.crt certificate which is shown to user side for the verification (if client has ca.crt then it will trust this endpoint).

The following secrets are created:

  • self-signed-certificate (name is hardcoded and cannot be changed) contains only ca.crt. It is mounted into Eclipse Che containers (see How are TLS certificates propagated? #19318 (comment)).
  • a secret defined in spec.k8s.tlsSecretName field. The secret contains tls.crt and tls.key. It Is specified in Eclipse Che ingresses config and isn't mounted into any containers.

1.2. The secret defined in spec.k8s.tlsSecretName exists

The secret is used to secure ingresses. It isn't mounted into any containers.
If commonly trusted certificate is NOT used then the self-signed-certificate secret should exist and must contain root CA certificate. It is mounted into Eclipse Che containers
(see #19318 (comment)). If self-signed-certificate secret doesn't exist then root CA certificate must be propagated into Eclipse Che via a configmap: described in docs.

2. If field is empty

All ingresses are secured with default certificates of the ingress controller.
self-signed-certificate secret is created automatically only if self-signed certificate is used (when commonly trusted certificate is used for Che ingresses, then this secret doesn't exists). It is mounted into Eclipse Che containers (see #19318 (comment)).

spec.server.cheHostTLSSecret

It works for both Kubernetes and OpenShift platforms. It is optional and used for user defined (beautified) Che url. It defines secret with similar structure as spec.k8s.tlsSecretName but intended for user defined Che ingress/route (beautiful Che url. It could have different domain, so the first certificate might not match the domain).

Kubernentes

It is supposed that the same root CA is used to created certificates that are stored in secrets defined in spec.k8s.tlsSecretName and spec.server.cheHostTLSSecret.

OpenShift

It is supposed that CA certificate from the certificate chain of trust from ingress controller is used generate certificates that are stored in secret defined in spec.server.cheHostTLSSecret

@nickboldt nickboldt 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 19, 2021
@nickboldt
Copy link
Contributor

I know nothing about the severity of this issue so I'll just set P1 so that the reporter or SMEs can comment and set the prio appropriately. Yaya round robin by nonSMEs!

@l0rd
Copy link
Contributor Author

l0rd commented Mar 22, 2021

@mmorhun thank you for the detailed explanation. This is useful.

You mentioned that when an administrator specifies spec/server/cheHostTLSSecret the certificate is not propagated to the workspace containers. That means that, in this scenario, communicating from a workspace to Che server components (registries, che-server, keycloak) using external URL will not work right?

@themr0c
Copy link
Contributor

themr0c commented Mar 22, 2021

@tolusha
Copy link
Contributor

tolusha commented Mar 22, 2021

@che-bot
Copy link
Contributor

che-bot commented Sep 20, 2021

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 20, 2021
@tolusha tolusha added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/doc Issues related to documentation area/editor/theia Issues related to the che-theia IDE of Che area/install Issues related to installation, including offline/air gap and initial setup kind/question Questions that haven't been identified as being feature requests or bugs. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

7 participants