Skip to main content

Custom CA certificates

For every HTTPS request that osie-api Pod does to an external system, it needs to trust it's SSL certificate.
One of the most common requests is fetching the JWKS (JSON Web Key Sets) from Keycloak, to validate the JWT Tokens.
It trusts by default all the known Certificate Authorities in the JVM, however, if Keycloak was deployed with your own self-signed certificate, osie-api needs to trust it's Certificate Authority. For this, you can add your Certificate Authority's public certificate (in PEM format) to the osie-api trust list.

Upload the CA certificate to Kubernetes​

Add your CA certificate as a Kubernetes secret, in the same Namespace where OSIE is installed.

kubectl --namespace osie create secret generic ca-root-secret --from-file=ca.crt=/path/to/ca.crt

This secret will be later on mounted into the osie-api container, as exemplified below.

Note in case you've generated the self-signed certificates using cert-manager, this Secret should already exist in your Kubernetes envionment. Just make sure it's also present in your osie namespace.

Modify values.yml (api section)​

Below example is mounting the ca.crt content into the osie-api container, and it specifies its path via the SSL_TRUST_CA_CERTS environment variable.
OSIE will read the certificate and trust it, additional to the already trusted system certificates.

api:
extraEnvVars:
- name: SSL_TRUST_CA_CERTS
value: /opt/osie/api/ca.crt

extraVolumes:
- name: ca-cert-volume
secret:
items:
- key: ca.crt
path: ca.crt
secretName: ca-root-secret

extraVolumeMounts:
- mountPath: /opt/osie/api/ca.crt
name: ca-cert-volume
subPath: ca.crt