LibreSSL: openssl Error due to missing v3_ca in extension

To use openssl (opens in a new tab), one of the utilities of LibreSSL (opens in a new tab), and create root and intermediate certificates with v3_ca extensions, error might happen in OpenBSD (opens in a new tab) 6.7 (opens in a new tab).

This is because /etc/ssl/openssl.cnf doesn’t have [ v3_ca ] section by default. The solution is to create the backup, if necessary, and append the section.

console
$ doas cp -p /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.org
$ doas nvim /etc/ssl/openssl.cnf

[ v3_ca ] section:

diff
+ [ v3_ca ]
+ basicConstraints = critical,CA:TRUE
+ subjectKeyIdentifier = hash
+ authorityKeyIdentifier = keyid:always,issuer:always

Besides, I met the error when trying to build tls connection between PostgreSQL (opens in a new tab) server and client like this:

console
$ # create a root certificate authority
[...]
$ openssl x509 -req -in root.csr -text -days 36500 -extfile /etc/ssl/openssl.cnf -extensions v3_ca -signkey root.key -out root.crt
Error Loading extension section v3_ca

More on: Configure and secure a server

OBSD Solutions

OBSD Solutions: OpenBSD consulting and support by Scqr, Reflerd Inc. (opens in a new tab)

Comments and feedback are welcome.