openvpn.is
English
简体中文繁體中文EnglishРусскийفارسی

HomeBlogCertificates

The papers ran out

OpenVPN certificate has expired or CRL has expired: which one it is, replacing the server certificate, reissuing for clients, the CA, and reminders.

Compiled on

A passport over a century old has a validity date too
A passport over a century old has a validity date too Władze kantonu szwajcarskiego Graubunden, Public domain

If everyone fails on the same day, it is the server certificate or the CRL nine times out of ten. If one person fails, it is their own.

Certificates do not fade; at one second everybody is out, and whoever signed them may have left. Two parts: the quickest recovery, and how to avoid it.

Which one

LogExpired
depth=0, CN=server with expiredServer certificate
CN=laptop expired in the server logThat client's
depth=1 expiredCA
CRL has expiredRevocation list
not yet validSomebody's clock is slow
Look at the dates
openssl x509 -in server.crt -noout -enddate
openssl crl -in crl.pem -noout -nextupdate
An old stamped document: stamps do not help once the date has passed
An old stamped document: stamps do not help once the date has passed Government of Turkey, Public domain

The revocation list

The saddest case: all certificates are fine. Make a new one and copy it:

On the issuer's machine
./easyrsa gen-crl
scp pki/crl.pem root@server:/etc/openvpn/server/

The server certificate

Sign again, replace server.crt and server.key, restart. Clients need no change; they trust the issuer.

An old certificate: OpenVPN certificates expire too; renew before the date
An old certificate: OpenVPN certificates expire too; renew before the date John Brown, Public domain

A client certificate

Issue one under a new name, hand over the new .ovpn, and revoke the old.

The issuer

The worst: everything is reissued. Start half a year early. Make a new CA and put both CA certificates into the server's ca.crt, so that old and new papers are accepted, and take the old one out when everyone has changed.

  1. CalendarServer 825 days, CRL 180 days
  2. Monthly./easyrsa show-expire 60
  3. CRL on a scheduleAs a scheduled job
So it does not surprise you again

How far does it reach

  1. EverybodyServer certificate, CRL or CA
  2. Only new connectionsThe same; hurry, reconnects will fail
  3. One personTheir own
Three questions

If one connection into the server is still open, keep it.

Emergency

CRL: five minutes. If the signing machine cannot be found, comment out crl-verify and restart; revoked certificates then work too, so repair it the same day.

Server certificate, with the CA key:

On the issuer's machine
./easyrsa --days=825 build-server-full server2 nopass
openssl x509 -in pki/issued/server2.crt -noout -subject -enddate

Use a new name, keep the old files, change two lines and restart. If clients check verify-x509-name, the name has to stay.

CA: no shortcut. Start a second service on another port with a new CA, hand out new profiles, let people move over.

The CA key is lost

Then nothing can be signed and all is rebuilt. Before giving up look on old computers, backup drives, /etc/openvpn/easy-rsa/pki/private/ and root's home directory.

A warning in time

/usr/local/bin/ovpn-expiry.sh
#!/bin/sh
D=/etc/openvpn/server
for f in $D/server.crt $D/ca.crt; do
  openssl x509 -in $f -noout -checkend 2592000 || echo "$f expires within 30 days"
done
N=$(openssl crl -in $D/crl.pem -noout -nextupdate | cut -d= -f2)
[ $(( ($(date -d "$N" +%s) - $(date +%s)) / 86400 )) -lt 30 ] && echo "crl.pem expires within 30 days"

Run it weekly and send the output to mail or a chat. For clients ./easyrsa show-expire 60.

How long

CertificateSuggestion
CATen years, key offline
ServerAbout two years
ClientOne or two
CRL180 days, renewed automatically

A hundred years saves work, and keeps lost devices and former staff valid.

What clients need

New server certificate, same CA: nothing. New CA or new tls-crypt key: everybody. Test a new profile on one device first.

Can I set my clock back?

It works for a moment, but web certificates all fail and the server may refuse. Do not.

A provider's profile expired?

Download a new one from their website.

It says expired but the certificate is fine?

Look at that device's clock.

Can a certificate be extended?

Only signed again; renew does the same.

A provider's certificate expired?

Download a new profile, or ask support.

Walk on

Nearby gates

Signposts: OpenVPN certificate expired, CRL has expired, renew OpenVPN certificate