Exercise 2: What sslmode=require Is Missing — Possible Solution ==================================================================== WHAT'S MISSING: sslmode=require only guarantees the connection is ENCRYPTED — it does not verify that the server the client actually connected to is the real, legitimate database server. The client will accept ANY certificate presented to it, including a self-signed one or one belonging to a completely different server, and proceed with an "encrypted" connection regardless. WHY THIS MATTERS: an attacker positioned to intercept the connection (a man-in-the-middle) can present their OWN certificate instead of the real database's, and sslmode=require will accept it without complaint. The client ends up with a perfectly encrypted connection — to the attacker, not to the real database — defeating the entire purpose of using TLS in the first place while still giving a false sense of security ("we have SSL enabled"). THE FIX: sslmode=verify-full. This setting does everything require does (encrypts the channel) AND additionally verifies that the server's certificate is signed by a trusted certificate authority AND that the certificate's hostname actually matches the server being connected to — the same two checks https1-5's chain-of-trust material covers for HTTPS generally. (sslmode=verify-ca is a middle ground — checks the CA signature but not the hostname match — verify-full is the setting that closes the gap completely.)