theidserver

by Aguafrommars

Helm chartv4.8.1App 7.4.6Apache-2.0

TheIdServer cluster Helm chart for Kubernetes

About this chart

TheIdServer

TheIdServer is an OpenID/Connect, OAuth2 and WS-Federation server based on IdentityServer4.

Install

Add the repository to helm :

❯ helm repo add agua https://aguafrommars.github.io/helm
❯ helm install aguafrommars agua/theidserver --set mysql.auth.password=my-P@ssword

This install:

Certificates

They are stored in the k8s opaque secret <release name>-certs.

Get generated certificates

To get the list of secret in your namespace run:

kubectl get secret

ex:

❯ kubectl get secrets --namespace theidserver
NAME                                   TYPE                                  DATA   AGE
aguafrommars-mysql                     Opaque                                3      10h
aguafrommars-mysql-token-qsjc9         kubernetes.io/service-account-token   3      10h
aguafrommars-theidserver-certs             Opaque                                8      10h
aguafrommars-theidserver-opaque            Opaque                                4      10h
aguafrommars-theidserver-token-wq2rw       kubernetes.io/service-account-token   3      10h
aguafrommars-redis-token-9ckf2         kubernetes.io/service-account-token   3      10h

To get the list of a secret keys run:

kubectl describe secret <secret name>

ex:

❯ kubectl describe secret aguafrommars-theidserver-certs
Name:         aguafrommars-theidserver-certs
Namespace:    theidserver
Labels:       app.kubernetes.io/instance=aguafrommars
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=theidserver
              app.kubernetes.io/version=1.1.0
              helm.sh/chart=theidserver-0.1.0
Annotations:  meta.helm.sh/release-name: aguafrommars
              meta.helm.sh/release-namespace: theidserver

Type:  Opaque

Data
====
signingKey.crt:      1103 bytes
signingKey.key:      1679 bytes
tls.crt:             1326 bytes
tls.key:             1675 bytes
ca.crt:              1135 bytes
ca.key:              1679 bytes
dataProtection.crt:  1103 bytes
dataProtection.key:  1679 bytes

Use the command to get a secret value:

kubectl get secret <secret name> -o jsonpath="{.data['<secret key>']}"

ex:

❯ kubectl get secret theidserver-certs -o jsonpath="{.data['tls\.key']}" --namespace theidserver
LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBeW5mNVB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DZmMlJsVzdXV2RyCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

Test the installation

  1. Extract the ca certificate using the method above
    > kubectl get secret theidserver-certs -o jsonpath="{.data['ca\.crt']}" --namespace theidserver | base64 -d >> ca.cer
    
  2. Install the certificate in your Trusted Root Certification Authorities store
  3. forward port 5443 to the service
    ❯ kubectl port-forward service/theidserver 5443:https --namespace theidserver
     Forwarding from 127.0.0.1:5443 -> 5443
     Forwarding from [::1]:5443 -> 5443
    
  4. Open a browser and navigate to https://localhost:5443 You should be able to login with the user alice pwd Pass123$

Upgrade

To upgrade the solution you need to retrieve certificates generated by the installation and MySql passwords.

Configure certificates

The following table lists the configurable parameters of the TheIdServer chart and their default values for certificates configuration.

ParameterDescriptionDefaultRemarks
ssl.createIf true, creates Kestrel servers certificate.trueIf false, ssl.issuer must be enabled or ssl.crt and ssl.key must be defined.
ssl.cnThe common name used to create the Kestrel servers certificate.<Deployment name>
ssl.ipListThe IP list used to create the Kestrel servers certificate.["127.0.0.1"]
ssl.altNamesThe alternative name list used to create the Kestrel servers certificate.["<ssl.cn>", "<ssl.cn>:<service.port.https>", "localhost", "localhost:<service.port.https>"]if ingress.enabled=true and ssl.altNames is not defined, the chart add "<ingress.hosts.host>" and "<ingress.hosts.host>:<service.port.https>" to the alternative name list.
ssl.validationPeriodThe validation period in day to create the Kestrel servers certificate.365
ssl.crtThe Kestrel servers certificate.nilThis value is copied in <deployement name>-certs secret ssl.crt.
ssl.keyThe Kestrel servers certificate key.nilThis value is copied in <deployement name>-certs secret ssl.key.
ssl.ca.createIf true, creates Kestrel servers certification authority certificate.trueIf false, ssl.ca.crt and ssl.ca.key must be defined.
ssl.ca.trustIf true, add certification authority certificate in the tusted certificates repo.trueThe certification authority used to generate the Kestrel servers certificate must be trusted.
ssl.ca.issuerIssuer to create the certification authority certificate."<Deployment name> CA"
ssl.ca.validationPeriodThe validation period in day to create the certification authority certificate.3650
ssl.ca.crtThe certification authority certificate.nilThis value is copied in <deployement name>-certs secret ca.crt.
ssl.ca.keyThe certification authority certificate key.nilThis value is copied in <deployement name>-certs secret ca.key.
ssl.issuer.enabledEnable the certificate issuer.false
ssl.issuer.refThe name of the cerificate issuer to use.nil
ssl.issuer.kindThe kind of the cerificate issuer.nilCan be Issuer or ClusterIssuer
ssl.issuer.durationThe certicate lifetime.2160h (90d)Must be specified using a Go time.Duration string format, which does not allow the d (days) suffix. You must specify these values using s, m, and h suffixes instead
ssl.issuer.renewBeforeDuration to renew the certificate before its expiration.360h (15d)Must be specified using a Go time.Duration string format, which does not allow the d (days) suffix. You must specify these values using s, m, and h suffixes instead
dataProtection.createIf true, creates the certificate to crypt data protection keys at rest.trueIf false, dataProtection.crt and dataProtection.key must be defined.
dataProtection.cnThe common name used to create the certificate to crypt data protection keys at rest.Deployment name
dataProtection.ipListThe IP list used to create thethe certificate to crypt data protection keys at rest.nil
dataProtection.altNamesThe alternative name list used to create the certificate to crypt data protection keys at rest.nil
dataProtection.crtThe the certificate to crypt data protection keys at rest.nilRequired for upgrade. This value is copied in <deployement name>-certs secret dataProtection.crt.
dataProtection.keyThe the certificate key to crypt data protection keys at rest.nilRequired for upgrade. This value is copied in <deployement name>-certs secret dataProtection.key.
signingKey.createIf true, creates the certificate to crypt signing keys at rest.trueIf false, dataProtection.crt and dataProtection.key must be defined.
signingKey.cnThe common name used to create the certificate to crypt signing keys at rest.Deployment name
signingKey.ipListThe IP list used to create thethe certificate to crypt signing keys at rest.nil
signingKey.altNamesThe alternative name list used to create the certificate to crypt signing keys at rest.nil
signingKey.crtThe the certificate to crypt signing keys at rest.nilRequired for upgrade. This value is copied in <deployement name>-certs secret signingKey.crt.
signingKey.keyThe the certificate key to crypt signing keys at rest.nilRequired for upgrade. This value is copied in <deployement name>-certs secret signingKey.key.

Ssl and ca certificates can be regenerated at each upgrade but we recommand to not regenerate the ca certficate.

MySQL passwords

Passwords are store in <release name>-mysql secret

To get the list of a secret keys run:

kubectl describe secret <release name>-mysql

ex:

❯ kubectl describe secrets aguafrommars-mysql --namespace theidserver
Name:         aguafrommars-mysql
Namespace:    theidserver
Labels:       app=mysql
              app.kubernetes.io/managed-by=Helm
              chart=mysql-6.14.10
              heritage=Helm
              release=aguafrommars
Annotations:  meta.helm.sh/release-name: aguafrommars
              meta.helm.sh/release-namespace: theidserver

Type:  Opaque

Data
====
mysql-password:              16 bytes
mysql-replication-password:  16 bytes
mysql-root-password:         16 bytes

Use the command to get a secret value:

kubectl get secret <secret name> -o jsonpath="{.data.<secret key>}" | base64 -d

ex:

❯ kubectl get secrets aguafrommars-mysql -o jsonpath="{.data.mysql-password}" --namespace theidserver | base64 -d
Th€IdS€rv€r-2o2o

Create the upgrade.yaml file

With values retrieve from certificates and password secrets, create a file to configure an upgrade.

ex:

# Default values for TheIdServer.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
  tag: "4.5.0"

# Dependencies configuration
mysql:
  auth:
    password: "Th€IdS€rv€r-2o2o" # The mysql user password is required    
    rootPassword: "My$ql-8.o.21" # The mysql root password is required
  
# Kestrel servers cerificates
ssl:
  create: true
  crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURwekNDQW8rZ0F3SUJBZ0lSQUxVbkJUSzJxcDJUdEZqSTlIYzNQcGd3RFFZSktvWklodmNOQVFFTEJRQXcKSmpFa01DSUdBMVVFQXhNYllXZDFZV1p5YjIxdFlYSnpMWFJvWldsa2MyVnlkbVZ5SUVOQk1CNFhEVEl3TVRBeApPVEEyTkRZeE0xb1hEVEl4TVRBeE9UQTJORFl4TTFvd0l6RWhNQjhHQTFVRUF4TVlZV2QxWVdaeWIyMXRZWEp6CkxYUm9aV2xrYzJWeWRtVnlNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXlUS1IKRzZlb3REZE0zYzg3WTVyazYrZlVIb2kzWDlGb0FyOU03bnF2SFdRVWN6ZU53dGQ2cmVUQjhIOE83N2FrUXEv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Ickp2bnAwVk02MnJ5NTB3UklwT2RablFrU1R4c3BOWGsvNWZPcVk0djJ0S1BGCjVsK3BNWW5uUGo1cUZjV2xmc3k5eGk0Lzh5RW41aE1WUHQwamkyQjZrdE9jS0w5SkdrTlNPbGM2cFp6N0pkUHMKbUNaNk5aTG96aDMxU1VxOUVvdi9OOG9DdTZaZWpvallZQWNwCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
  key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBeV

Deploy theidserver with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has theidserver on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttheidserver is pinned at v4.8.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply