Menu

Encrypted Is Not Authenticated: What PostgreSQL sslmode Really Checks
📰

Encrypted Is Not Authenticated: What PostgreSQL sslmode Really Checks

DEV Community: docker·Victor Okoroafor·24 days ago
#aRh6XOA1
#devtodocker#devto#dev#server#postgres
Long article (3432 words) — no AI summary yet.
Reading 0:00
15s threshold

Why transport encryption alone won't protect you from a rogue server, and the one sslmode that does, tested in a reproducible Docker lab.

You've probably seen this line a hundred times and moved on:

psql (18.6 (Debian 18.6-3)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql) Type "help" for help.

Enter fullscreen mode

Exit fullscreen mode

It looks like the job is done. Your traffic is encrypted, and nobody sniffing the network can read your queries. But that line answers only one question: is this connection private? It says nothing about the more important one: is this actually my database?

In this article, you'll run one legitimate PostgreSQL server and three impostors on your own machine, then connect to each using every sslmode libpq supports . By the end, you'll see why only sslmode=verify-full blocks all three impostors, and which two extra client parameters close the authentication gaps that remain.

Everything here is reproducible.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.