Chapter 3. Secure communication for containerized applications
You can add certificates from your local certificate authority (CA) or from a third-party vendor into a Podman machine. After adding these certificates, you can use them in your images to:
- Secure the communication channel between the running applications in your container and the external host system.
- Validate the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) certificates provided by external services for authentication.
Podman stores certificates in the machine at /etc/pki/ca-trust/source/anchors/, and you can obtain them in various formats:
-
Privacy-Enhanced Mail format (
.pem) -
Certificate file format (
.crt) -
Certificate file format (
.cer)
On Windows, the Podman commands use the CAs from the certificate store. For example, if you are unable to log in to an internal registry because the added certificate was not trusted by Podman, you can add it to the Windows certificate store. This will enable Podman commands to trust the certificate and help you log in to that registry.
3.1. Add certificates to a Podman machine Copy linkLink copied to clipboard!
You can add certificates from a local CA or third-party vendor directly to a running Podman machine. After adding a certificate, a reboot of the Podman machine is required to ensure the changes take effect.
Prerequisites
- You have a running Podman machine.
-
You have obtained the required certificates for installation, such as
certificate.pemorcertificate.crt.
Procedure
Start an interactive session with the default Podman machine:
$ podman machine ssh <machine_name>Optional: If Podman runs in the default rootless mode, switch to a root shell:
$ sudo su -Change to the directory where the certificates must be placed:
$ cd /etc/pki/ca-trust/source/anchorsPerform one of the following steps to obtain the certificate:
Use the
curlcommand to download a certificate:$ curl [-k] -o <my-certificate> https://<my-server.com/my-certificate>Use any editor, such as Notepad or Vim to create a certificate file with
.crt,.cer, or.pemextension.NoteYou can convert a certificate file to a text file and copy its content to the editor.
Add the certificate to the list of trusted certificates:
$ update-ca-trustOptional: To exit the root shell, run the following command:
$ exit-
Run the
exitcommand to exit the Podman machine. To apply your changes, reboot the Podman machine:
$ podman machine stop <machine_name> $ podman machine start <machine_name>