Case study

Expired certificates broke production twice, and nothing turned red

Once as a load-balancer black hole that swallowed 23 of 24 connections for fifteen hours, once as a silent 30-hour replica lag behind a database that kept answering. Both times the metrics existed and the alerts did not.

3 min read · Markdown

TL;DR

Incident one: the black hole

The read-only port of a PostgreSQL cluster is a virtual IP in front of three replicas. On each node pgbouncer runs in session mode and connects to the local PostgreSQL with a TLS client certificate. HAProxy balances with leastconn.

What happened:

How to find it fast. Take the certificate straight from the virtual IP (a TLS handshake after PostgreSQL's SSLRequest) and read its subject alternative names: they name the node behind it. The workaround is to take the node out of the pool, or to point the service at the primary until the certificate is reissued.

Incident two: the silent lag

A two-node ClickHouse cluster served reads for a seller-facing portal, split roughly evenly between the nodes. Both nodes used one certificate with a 90-day lifetime for the native TLS port and for interserver replication. It was issued on the same day for both, and it expired on the same day for both.

At expiry:

The certificate was reissued the next evening; the replicas caught up within a week. The next expiry is in 90 days.

How to find it fast. When replicas lag or network errors spike, check the certificate first: openssl s_client -connect <host>:<tls-port>. Look at lag on every replica, not just the one your tools connect to by default.

Takeaways


All writing · A similar problem? contact@ivanblinov.com