The server went dark at midnight. The logs showed nothing but handshake failures. Teams scrambled, restart after restart, and then someone asked the question no one wanted to hear: “What’s our TLS configuration?”
Mercurial TLS configuration decides if your repositories are secure, fast, and usable. Get it wrong, and your pushes stall, your pulls time out, and your CI pipeline bleeds minutes or hours. Get it right, and every connection is encrypted, trusted, and fast, with zero drama.
First, lock down the protocol versions. Mercury—like most tools—supports a range of SSL/TLS protocols, but anything older than TLS 1.2 is a hole waiting to be exploited. Configure it to require TLS 1.2 at minimum, preferably TLS 1.3. This cuts off legacy exploits and speeds up the handshake process. In your hgrc configuration or system-wide TLS settings, make protocol enforcement explicit.
Next, curate your cipher suites. Strong ciphers like AES-GCM with ECDHE key exchange ensure forward secrecy and resilience against brute-force attacks. Remove broken options like RC4, 3DES, or anything labeled “export.” Tight cipher lists can prevent downgrade attacks and reduce CPU overhead.
Certificate management is the silent partner in good Mercurial TLS. Use certificates issued by a trusted CA, keep them renewed automatically—via tools like Let’s Encrypt—and pin them where possible. Misconfigured or expired certs are the stealth killers of availability; even perfect code won’t save a rejected handshake.