This guide is for development only. Self-signed certificates should not be used in production.

The following section describes deployment and configuration of Eclipse Che for using in TLS mode with self-signed certificates. It consists of following steps:

Deploy Che with self signed TLS certificates on OpenShift 4 using operator

This section describes how to deploy Che with self-signed TLS certificates on OpenShift 4 container platform. We need to grab certificate generated by OpenShift and use it for Che and import it into browser.

Procedure

  1. Login into OpenShift default project

    $ oc login -u kubeadmin -p <password>
  2. Get OpenShift 4 self-signed certificate

    $ oc get secret router-ca -n openshift-ingress-operator -o jsonpath="{.data.tls\.crt}" | base64 -d > ca.crt
  3. Pre-create namespace for Che

    $ oc create namespace che
  4. Create secret from CA certificate

    $ oc create secret generic self-signed-certificate --from-file=ca.crt -n=che
  5. Deploy Che using chectl

    $ chectl server:start --platform=crc --installer=operator --tls --self-signed-cert

Deploy Che with self signed TLS certificates on Kubernetes

This section describes how to deploy Che with self-signed TLS certificates on Kubernetes platform.

Prerequisites

Procedure

  1. Pre-create namespace for Che

    $ kubectl create namespace che
  2. Create secret with domain key and certificate

    $ kubectl create secret tls che-tls --key=domain.key --cert=domain.crt -n che
  3. Create secret from CA certificate

    $ cp rootCA.crt ca.crt
    $ kubectl create secret generic self-signed-certificate --from-file=ca.crt -n che
  4. Deploy Che using chectl

    $ chectl server:start --platform=minikube --installer=helm --tls --self-signed-cert

Deploy Che with self signed TLS certificates on OpenShift using operator

This section describes how to deploy Che with self-signed TLS certificates on OpenShift platform.

Prerequisites

Procedure

  1. Login into OpenShift default project

    $ oc login -u system:admin --insecure-skip-tls-verify=true
    $ oc project default
  2. Re-configure router with generated certificate

    $ oc delete secret router-certs
    $ cat domain.crt domain.key > minishift.crt
    $ oc create secret tls router-certs --key=domain.key --cert=minishift.crt
    $ oc rollout latest router
  3. Pre-create namespace for Che

    $ oc create namespace che
  4. Create secret from CA certificate

    $ cp rootCA.crt ca.crt
    $ oc create secret generic self-signed-certificate --from-file=ca.crt -n=che
  5. Deploy Che using chectl

    $ chectl server:start --platform=minishift --installer=operator --tls --self-signed-cert

Generating self-signed TLS certificates

This section describes how to prepare self-signed TLS certificates to use with Che on different platforms.

Prerequisites

  • Find out expected domain name where Che deployment is planned

    # default for minishift
    $( minishift ip ).nip.io
    
    # default for minikube
    $( minikube ip ).nip.io
    
    # default for crc
    apps-crc.testing
  • Find out openssl.cnf file location on target machine

    # Fedora 31
    /etc/pki/tls/openssl.cnf

Procedure

  1. Set necessary environment variables

    $ CA_CN=eclipse-che-signer
    $ DOMAIN=*.<expected.domain.com>
    $ OPENSSL_CNF=<path_to_openssl.cnf>
    # Example with minikube on Fedora 31
    $ CA_CN=eclipse-che-signer
    $ DOMAIN=*.$( minikube ip ).nip.io
    $ OPENSSL_CNF=/etc/pki/tls/openssl.cnf
    
    # Example with crc on OSX
    $ export CA_CN=eclipse-che-signer
    $ export DOMAIN=*.apps-crc.testing
    $ export OPENSSL_CNF=/System/Library/OpenSSL/openssl.cnf
  2. Generate root CA key. Add -des3 parameter if passphrase is needed

    $ openssl genrsa -out rootCA.key 4096
  3. Generate root certificate.

    $ openssl req -x509 \
      -new -nodes \
      -key rootCA.key \
      -sha256 \
      -days 1024 \
      -out rootCA.crt \
      -subj /CN=${CA_CN} \
      -reqexts SAN \
      -extensions SAN \
      -config <(cat ${OPENSSL_CNF} \
          <(printf '[SAN]\nbasicConstraints=critical, CA:TRUE\nkeyUsage=keyCertSign, cRLSign, digitalSignature, keyEncipherment'))
  4. Generate domain key.

    $ openssl genrsa -out domain.key 2048
  5. Generate domain csr.

    $ openssl req -new -sha256 \
        -key domain.key \
        -subj "/O=EclipseChe/CN=${DOMAIN}" \
        -reqexts SAN \
        -config <(cat ${OPENSSL_CNF} \
            <(printf "\n[SAN]\nsubjectAltName=DNS:${DOMAIN}\nbasicConstraints=critical, CA:FALSE\nkeyUsage=keyCertSign, digitalSignature, keyEncipherment\nextendedKeyUsage=serverAuth")) \
        -out domain.csr
  6. Generate domain certificate.

    $ openssl x509 \
    -req \
    -sha256 \
    -extfile <(printf "subjectAltName=DNS:${DOMAIN}\nbasicConstraints=critical, CA:FALSE\nkeyUsage=keyCertSign,                       digitalSignature, keyEncipherment\nextendedKeyUsage=serverAuth") \
    -days 365 \
    -in domain.csr \
    -CA rootCA.crt \
    -CAkey rootCA.key \
    -CAcreateserial -out domain.crt

After executing those steps, it will be possible to use domain.crt and domain.key for Route/Ingress TLS and rootCA.crt for importing into browsers.

Che usage with TLS

This section describes how to import root certificate authority into the browser to use Che with self signed TLS.

Google Chrome

  1. Go to chrome://settings/certificates, Authorities tab, click import and find your generated rootCA.crt (or ca.crt for OpenShift 4) file.

    che tls chrome import 1
  2. Select Trust this certificate for identifying websites and click OK.

    che tls chrome import 2
  3. Browser is satisfied with Che certificate and is reporting secure connection.

    che tls chrome import 3

Firefox

  1. Go to about:preferences and search for certificates and click View Certificates

    che tls firefox import 1
  2. Go to Authorities tab, click Import and find your generated rootCA.crt (or ca.crt for OpenShift 4) file.

    che tls firefox import 2
  3. Select Trust this CA to identify websites and click OK.

    che tls firefox import 3
  4. Browser is satisfied with Che certificate and is reporting secure connection.

    che tls firefox import 4

OSX

  1. Open Keychain Access.

  2. Make sure you’re on System keychain and drop your rootCA.crt (or ca.crt for OpenShift 4) file there.

  3. Double-click your imported CA, go to Trust and select When using this certificate: Always Trust.

  4. If browser still report invalid certificate, try to restart it.

Tags: