Change TLS settings between application and CRDP
Note
It is recommended to keep your registration token and certificates in secret.
It is recommended to keep your secrets in a safe vault.
Steps to enable TLS with mandatory client authentication
Create a secret, if it doesn't exist.
kubectl create secret generic <crdp secret name> --from-file=cert=<certificate file path> --from-file=key=<key file path> --from-file=ca=<ca certificate path>
In the CRDP deployment file (for example,
<crdp-deployment.yaml>
), add/update the below lines in theenv
section.env: - name: SERVER_MODE value: "tls-cert" - name: CERT_VALUE valueFrom: secretKeyRef: name: <crdp secret name> key: cert - name: KEY_VALUE valueFrom: secretKeyRef: name: <crdp secret name> key: key - name: TRUSTED_CA valueFrom: secretKeyRef: name: <crdp secret name> key: ca
Update your CRDP deployment.
helm upgrade <release-name> <path of helm chart/chart-name> .
Example
helm upgrade crdp <path of helm chart/chart-name> .
Create a secret, if it doesn't exist.
kubectl create secret generic <crdp secret name> --from-file=cert=<certificate file path> --from-file=key=<key file path> --from-file=ca=<ca certificate path> --from-literal=regtoken=<registration token>
Note
If your secret already exists with
<registration token>
:Update the values of
cert
,key
, andca
in the secret, ORCreate a new secret using the
kubectl create secret
command as described above
In the CRDP deployment file (for example,
<crdp-deployment.yaml>
), add/update the below lines in theenv
section.env: - name: SERVER_MODE value: "tls-cert" - name: CERT_VALUE valueFrom: secretKeyRef: name: <crdp secret name> key: cert - name: KEY_VALUE valueFrom: secretKeyRef: name: <crdp secret name> key: key - name: TRUSTED_CA valueFrom: secretKeyRef: name: <crdp secret name> key: ca
Update your CRDP deployment.
kubectl replace -f <deployment_filename>
Stop the existing container.
Start the container with the updated configuration, as below.
docker run -e KEY_MANAGER_HOST=<IP address or host name> -e REGISTRATION_TOKEN=<registration token> -p <host port>:<CRDP_port> -e SERVER_MODE=tls-cert -e CERT_VALUE="<certificate value>" -e KEY_VALUE="<key value>" -e TRUSTED_CA="<trusted ca>" <crdp image name>
In the command,
SERVER_MODE
istls-cert
CERT_VALUE
: Value of the client certificate.KEY_VALUE
: Value of the key associated with the client certificate.TRUSTED_CA
: Value of the CA certificate.
Now, CRDP will verify the certificate presented by the client.
Steps to enable TLS without client authentication
In the
values.yaml
file, underconfiguration
, update the value ofservermode
totls-cert-opt
.In the CRDP deployment file (for example,
<crdp-deployment.yaml>
), add the below lines to thedata
section ofkind:Secret
.data: server.crt: {{.Values.configuration.servercrt}} server.key: {{.Values.configuration.serverkey}}
Update your CRDP deployment.
helm upgrade <helm chart name> <path of helm chart>
In the CRDP deployment file (for example,
<crdp-deployment.yaml>
), in thedata
section ofConfigMap
, setSERVER_MODE
totls-cert-opt
.Add the following lines to the
data
section ofkind:Secret
.data: server.crt: {{.Values.configuration.servercrt}} server.key: {{.Values.configuration.serverkey}} trustedca: {{.Values.configuration.trustedca}}
Update your CRDP deployment.
kubectl replace -f <deployment_filename>
Stop the existing container.
In the environment variable, set the
SERVER_MODE
field totls-cert-opt
.Specify the environment variables:
CERT_VALUE
: Value of the client certificate.KEY_VALUE
: Value of the key associated with the client certificate.
Start the container.
docker run -e KEY_MANAGER_HOST=<IP address or host name> -e REGISTRATION_TOKEN=<registration token> -p <host port>:<CRDP_port> -e SERVER_MODE=tls-cert-opt -e CERT_VALUE="<certificate value>" -e KEY_VALUE="<key value>" <crdp image name>
Steps to disable TLS
In the
values.yaml
file, underconfiguration
, update the value ofservermode
tono-tls
.Update your CRDP deployment.
helm upgrade <helm chart name> <path of helm chart>
In your deployment file, in the
data
section ofConfigMap
, setSERVER_MODE
tono-tls
.Update your CRDP deployment.
kubectl replace -f <deployment_filename>
Stop the existing container.
In the environment variable, set the
SERVER_MODE
field tono-tls
.Start the container.
docker run -e KEY_MANAGER_HOST=<IP address or host name> -e REGISTRATION_TOKEN=<registration token> -p <host port>:<CRDP_port> -e SERVER_MODE=no-tls <crdp image name>