Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Adding additional Certificate Authorities for Red Hat Quay
Certificate Authorities (CAs) are used by Red Hat Quay to verify SSL/TLS connections with external services, like ODIC providers, LDAP providers, storage providers, and so on.
The following sections provide information about uploading additional CAs to Red Hat Quay depending on your deployment type.
3.1. Adding additional Certificate Authorities to the Red Hat Quay container
				The extra_ca_certs directory is the directory where additional Certificate Authorities (CAs) can be stored to extend the set of trusted certificates. These certificates are used by Red Hat Quay to verify SSL/TLS connections with external services. When deploying Red Hat Quay, you can place the necessary CAs in this directory to ensure that connections to services like LDAP, OIDC, and storage systems are properly secured and validated.
			
For standalone Red Hat Quay deployments, you must create this directory and copy the additional CA certificates into that directory.
Prerequisites
- You have a CA for the desired service.
Procedure
- View the certificate to be added to the container by entering the following command: - cat storage.crt - $ cat storage.crt- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - -----BEGIN CERTIFICATE----- MIIDTTCCAjWgAwIBAgIJAMVr9ngjJhzbMA0GCSqGSIb3DQEBCwUAMD0xCzAJBgNV... -----END CERTIFICATE----- - -----BEGIN CERTIFICATE----- MIIDTTCCAjWgAwIBAgIJAMVr9ngjJhzbMA0GCSqGSIb3DQEBCwUAMD0xCzAJBgNV... -----END CERTIFICATE------ Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create the - extra_ca_certsin the- /configfolder of your Red Hat Quay directory by entering the following command:- mkdir -p /path/to/quay_config_folder/extra_ca_certs - $ mkdir -p /path/to/quay_config_folder/extra_ca_certs- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Copy the CA file to the - extra_ca_certsfolder. For example:- cp storage.crt /path/to/quay_config_folder/extra_ca_certs/ - $ cp storage.crt /path/to/quay_config_folder/extra_ca_certs/- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Ensure that the - storage.crtfile exists within the- extra_ca_certsfolder by entering the following command:- tree /path/to/quay_config_folder/extra_ca_certs - $ tree /path/to/quay_config_folder/extra_ca_certs- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - /path/to/quay_config_folder/extra_ca_certs ├── storage.crt---- - /path/to/quay_config_folder/extra_ca_certs ├── storage.crt----- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Obtain the - CONTAINER IDof your- Quayconsider by entering the following command:- podman ps - $ podman ps- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 5a3e82c4a75f <registry>/<repo>/quay:{productminv} "/sbin/my_init" 24 hours ago Up 18 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 443/tcp grave_keller- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 5a3e82c4a75f <registry>/<repo>/quay:{productminv} "/sbin/my_init" 24 hours ago Up 18 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 443/tcp grave_keller- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Restart the container by entering the following command - podman restart 5a3e82c4a75f - $ podman restart 5a3e82c4a75f- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Confirm that the certificate was copied into the container namespace by running the following command: - podman exec -it 5a3e82c4a75f cat /etc/ssl/certs/storage.pem - $ podman exec -it 5a3e82c4a75f cat /etc/ssl/certs/storage.pem- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - -----BEGIN CERTIFICATE----- MIIDTTCCAjWgAwIBAgIJAMVr9ngjJhzbMA0GCSqGSIb3DQEBCwUAMD0xCzAJBgNV... -----END CERTIFICATE----- - -----BEGIN CERTIFICATE----- MIIDTTCCAjWgAwIBAgIJAMVr9ngjJhzbMA0GCSqGSIb3DQEBCwUAMD0xCzAJBgNV... -----END CERTIFICATE------ Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
3.2. Adding additional Certificate Authorities to Red Hat Quay on OpenShift Container Platform
				On Red Hat Quay on OpenShift Container Platform, the extra_ca_certs configuration field is is used to populate additional Certificate Authorities (CAs) into the CA directory, which then adds the CAs into the system trust bundle. These certificates are used by Red Hat Quay to verify SSL/TLS connections with external services like LDAP, OIDC, and storage systems.
			
				When deploying or redeploying Red Hat Quay on OpenShift Container Platform, you can add one, or multiple, CAs into the CA directory to ensure that external services are properly secured and validated. On Red Hat Quay on OpenShift Container Platform deployments, you must manually add the extra_ca_certs configuration field to your config.yaml file and re-upload the config.yaml to OpenShift Container Platform.
			
The following procedures show you how to download your existing configuration file, add additional CAs to your Red Hat Quay on OpenShift Container Platform deployment, and then re-upload the configuration file.
3.2.1. Downloading the existing configuration
					The following procedure shows you how to download the existing configuration by locating the Config Bundle Secret.
				
Procedure
- Describe the - QuayRegistryresource by entering the following command:- oc describe quayregistry -n <quay_namespace> - $ oc describe quayregistry -n <quay_namespace>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - ... ... - # ... Config Bundle Secret: example-registry-config-bundle-v123x # ...- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Obtain the secret data by entering the following command: - oc get secret -n <quay_namespace> <example-registry-config-bundle-v123x> -o jsonpath='{.data}'- $ oc get secret -n <quay_namespace> <example-registry-config-bundle-v123x> -o jsonpath='{.data}'- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - { "config.yaml": "RkVBVFVSRV9VU0 ... MDAwMAo=" }- { "config.yaml": "RkVBVFVSRV9VU0 ... MDAwMAo=" }- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Decode the data by entering the following command: - echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode - $ echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Optional. You can export the data into a YAML file into the current directory by passing in the - >> config.yamlflag. For example:- echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode >> config.yaml - $ echo 'RkVBVFVSRV9VU0 ... MDAwMAo=' | base64 --decode >> config.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
3.2.2. Adding additional Certificate Authorities to Red Hat Quay on OpenShift Container Platform
The following example shows you how to add additional Certificate Authorities to your Red Hat Quay on OpenShift Container Platform deployment.
Prerequisites
- 
							You have base64 decoded the original config bundle into a config.yamlfile. For more information, see Downloading the existing configuration.
- You have a Certificate Authority (CA) file or files.
Procedure
- Create a new YAML file, for example, - extra-ca-certificate-config-bundle-secret.yaml:- touch extra-ca-certificate-config-bundle-secret.yaml - $ touch extra-ca-certificate-config-bundle-secret.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create the - extra-ca-certificate-config-bundle-secretresource.- Create the resource by entering the following command: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
- Optional. You can check the content of the - extra-ca-certificate-config-bundle-secret.yamlfile by entering the following command:- cat extra-ca-certificate-config-bundle-secret.yaml - $ cat extra-ca-certificate-config-bundle-secret.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create the - configBundleSecretresource by entering the following command:- oc create -n <namespace> -f extra-ca-certificate-config-bundle-secret.yaml - $ oc create -n <namespace> -f extra-ca-certificate-config-bundle-secret.yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - secret/extra-ca-certificate-config-bundle-secret created - secret/extra-ca-certificate-config-bundle-secret created- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Update the - QuayRegistryYAML file to reference the- extra-ca-certificate-config-bundle-secretobject by entering the following command:- oc patch quayregistry <registry_name> -n <namespace> --type=merge -p '{"spec":{"configBundleSecret":"extra-ca-certificate-config-bundle-secret"}}'- $ oc patch quayregistry <registry_name> -n <namespace> --type=merge -p '{"spec":{"configBundleSecret":"extra-ca-certificate-config-bundle-secret"}}'- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - quayregistry.quay.redhat.com/example-registry patched - quayregistry.quay.redhat.com/example-registry patched- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Ensure that your - QuayRegistryYAML file has been updated to use the extra CA certificate- configBundleSecretresource by entering the following command:- oc get quayregistry <registry_name> -n <namespace> -o yaml - $ oc get quayregistry <registry_name> -n <namespace> -o yaml- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - ... ... - # ... configBundleSecret: extra-ca-certificate-config-bundle-secret # ...- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
3.3. Adding custom SSL/TLS certificates when Red Hat Quay is deployed on Kubernetes
When deployed on Kubernetes, Red Hat Quay mounts in a secret as a volume to store config assets. Currently, this breaks the upload certificate function of the superuser panel.
				As a temporary workaround, base64 encoded certificates can be added to the secret after Red Hat Quay has been deployed.
			
Use the following procedure to add custom SSL/TLS certificates when Red Hat Quay is deployed on Kubernetes.
Prerequisites
- Red Hat Quay has been deployed.
- 
						You have a custom ca.crtfile.
Procedure
- Base64 encode the contents of an SSL/TLS certificate by entering the following command: - cat ca.crt | base64 -w 0 - $ cat ca.crt | base64 -w 0- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Example output - ...c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - ...c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Enter the following - kubectlcommand to edit the- quay-enterprise-config-secretfile:- kubectl --namespace quay-enterprise edit secret/quay-enterprise-config-secret - $ kubectl --namespace quay-enterprise edit secret/quay-enterprise-config-secret- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Add an entry for the certificate and paste the full - base64encoded stringer under the entry. For example:- custom-cert.crt: c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - custom-cert.crt: c1psWGpqeGlPQmNEWkJPMjJ5d0pDemVnR2QNCnRsbW9JdEF4YnFSdVd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Use the - kubectl deletecommand to remove all Red Hat Quay pods. For example:- kubectl delete pod quay-operator.v3.7.1-6f9d859bd-p5ftc quayregistry-clair-postgres-7487f5bd86-xnxpr quayregistry-quay-app-upgrade-xq2v6 quayregistry-quay-database-859d5445ff-cqthr quayregistry-quay-redis-84f888776f-hhgms - $ kubectl delete pod quay-operator.v3.7.1-6f9d859bd-p5ftc quayregistry-clair-postgres-7487f5bd86-xnxpr quayregistry-quay-app-upgrade-xq2v6 quayregistry-quay-database-859d5445ff-cqthr quayregistry-quay-redis-84f888776f-hhgms- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Afterwards, the Red Hat Quay deployment automatically schedules replace pods with the new certificate data.