Souji Thenria

Importing TLS Certificates

Summary: A quick overview of how to add a certificate to your local certificate collection.

Created on:

-----

There are two noteworthy points: for FreeBSD and Linux, the methods mentioned later are essentially scripts that wrap the openssl rehash function. The more important note is that not all applications use the local certificate store. Some applications, such as web browsers, use their own collection of certificates.

FreeBSD

On FreeBSD based platforms, the tool you want to use is certctl(8). Before using it, it is important to set the correct permissions on the certificate itself. Since certctl creates a symbolic link to the original file, users will not be able to access the certificate information if they cannot read that original file.

To import your certificates, do the following:

  1. Create the directory /usr/loca/etc/ssl/certs.
  2. Copy your certificate to that previously created directory.
  3. Set the permissions to e.g. 444, on the file containing the certificate.
  4. Execute certctl rehash.

OpenBSD

On an OpenBSD system, there is a single file that contains all certificates: /etc/ssl/cert.pem. To add your certificate, you simply need to append it to this file. For example, you can use the following command (replace mycert with your certificate):

cat <mycert>.crt >> /etc/ssl/cert.pem

Linux

Importing certificates on Linux works similarly to FreeBSD. I used update-ca-certificates(8); However, I am not sure whether this script is available on all distributions. As mentioned earlier, the script essentially just wraps the openssl rehash function, and you may be able to use that function directly instead.

To import your certificates, do the following:

  1. Create the directory /usr/local/share/ca-certificates
  2. Copy your certificate to that previously created directory.
  3. Set the permissions to e.g. 444, on the file containing the certificate.
  4. Execute update-ca-certificates.
Tags: