Configuring Trusted TLS Flashcards
(42 cards)
Where are the certs used?
1) wildcard cert in ingress controller operator (all .apps subdomains)
2) API certificate.
3) Edge route that uses a wildcard certificate.
What are requirements for wildcard cert
1) PEM format
2) Extension subjectAltName with value: *.apps./OPENSHIFT-DOMAIN/
Changing the certificate used by the ingress controller operator does affect certificates signed by the internal OpenShift certificate authority. True or False
False
Steps to setup ingres controler cert
1) create a new ccm in the openshift-config namespace
2) Configure the cluster proxy to use the new cm
3) Create a new TLS secret in the openshift-ingress namespace
4) Modify the default ingress controller operator in the openshift-ingress-operator namespace so that defaultCertificate uses the newly created secret
Create a cm to setup ingres controler wildcard domain
oc create configmap <CONFIGMAP-NAME> \
--from-file ca-bundle.crt=<PATH-TO-CERTIFICATE> \
-n openshift-config</PATH-TO-CERTIFICATE></CONFIGMAP-NAME>
Configure cluster proxy to use a new cm to setup ingres controler wildcard domain
oc patch proxy/cluster –type=merge \
–patch=’{“spec”:{“trustedCA”:{“name”:”<CONFIGMAP-NAME>"}}}'</CONFIGMAP-NAME>
Create TLS secret to setup ingres controler wildcard domain
oc create secret tls <SECRET-NAME> \
--cert <PATH-TO-CERTIFICATE> \
--key <PATH-TO-KEY> \
-n openshift-ingress</PATH-TO-KEY></PATH-TO-CERTIFICATE></SECRET-NAME>
Modify the default ingress controller operator in the openshift-ingress-operator namespace so that defaultCertificate uses the newly created secret
oc patch ingresscontroller.operator/default \
-n openshift-ingress-operator –type=merge \
–patch=’{“spec”: {“defaultCertificate”: {“name”: “<SECRET-NAME>"}}}'</SECRET-NAME>
Check the progress of setting up ingres controller wildcard domain
watch oc get pods -n openshift-ingress
What is the impact of changing the OpenShift master API?
allows users to log in securely using the oc command
Requirements to change the master API certificate
1) PEM format.
2) The certificate is issued through master API, such as api.ocp4.example.com.
3) subjectAltName extension contains the URL used to access the master API, such as DNS: api.ocp4.example.com.
Steps to change the master API cert
1) Create TLS secret in the openshift-config namespace using the master API certificate and key
2) Modify the cluster API server to use the new secret
Check that master api change is taking effect
1) oc get clusteroperator/kube-apiserver
2) oc get pods -l app=openshift-kube-apiserver \
-n openshift-kube-apiserver”
Create TLS secret in the openshift-config namespace using the master API certificate and key
oc create secret tls <SECRET-NAME> \
--cert <PATH-TO-CERTIFICATE> \
--key <PATH-TO-KEY> \
-n openshift-config</PATH-TO-KEY></PATH-TO-CERTIFICATE></SECRET-NAME>
Modify the cluster API server to use the new secret
oc patch apiserver cluster –type=merge \
-p ‘{“spec”: {“servingCerts”: {“namedCertificates”:’\
‘[{“names”: [“<API-SERVER-URL>"],'\
'"servingCertificate": {"name": "<SECRET-NAME>"}}]}}}'</SECRET-NAME></API-SERVER-URL>
Configure your system can be to trust your enterprise CA
1) Copy your enterprise CA certificate to the /etc/pki/ca-trust/source/anchors
2) Run the update-ca-trust extract command
Why include the enterprise CA cert in a trusted CA bundle
Useful when apps running in OpenShift must communicate with URLs signed by your enterprise CA
By default, applications do trust the enterprise CA. True or False
False
How do you check if your enterprise CA cert is already included in the CA bundle?
1) oc get proxy/cluster \
-o jsonpath=’{.spec.trustedCA.name}{“\n”}’
<CONFIGMAP-NAME>
2) oc extract configmap <CONFIGMAP-NAME> \
-n openshift-config --confirm
</CONFIGMAP-NAME></CONFIGMAP-NAME>
You realize cm does not contain the enterprise CA certificate. what do you do?
1) Combine the wildcard cert and the enterprise CA cert in a new PEM file
2) Add comments, # Wildcard Cert above the wildcard cert and # Enterprise CA, above the enterprise CA cert
3) Replace the configuration map with the new cert
How do you replace the CA cert cm
oc set data configmap <CONFIGMAP-NAME> \
--from-file ca-bundle.crt=<PATH-TO-NEW-CERTIFICATE> -n openshift-config</PATH-TO-NEW-CERTIFICATE></CONFIGMAP-NAME>
How do you use the trusted CA bundle in a pod?
1) create an empty configuration map
2) label the cm with config.openshift.io/inject-trusted-cabundle=true label
3) Mount the cm into the pod:
oc set volume dc/<DC-NAME> -t configmap \
--name trusted-ca --add --read-only=true \
--mount-path /etc/pki/ca-trust/extracted/pem \
--configmap-name <CONFIGMAP-NAME></CONFIGMAP-NAME></DC-NAME>
4) edit the dc so the pod mounts the certificate bundle
edit the dc so the pod mounts the certificate bundle
verify that an app trusts certs signed by your enterprise CA
1) oc rsh hello-3-65qs7
2) ls /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
3) curl https://hello.apps.ocp4.example.com