Skip to content

Commit 97d3a0b

Browse files
committed
Disallow SSL session tickets.
We don't actually support session tickets, since we do not create an SSL session identifier. But it seems that OpenSSL will issue a session ticket on-demand anyway, which will then fail when used. This results in reconnection failures when using ticket-aware client-side SSL libraries (such as the Npgsql .NET driver), as reported by Shay Rojansky. To fix, just tell OpenSSL not to issue tickets. At some point in the far future, we might consider enabling tickets instead. But the security implications of that aren't entirely clear; and besides it would have little benefit except for very short-lived database connections, which is Something We're Bad At anyhow. It would take a lot of other work to get to a point where that would really be an exciting thing to do. While at it, also tell OpenSSL not to use a session cache. This doesn't really do anything, since a backend would never populate the cache anyway, but it might gain some micro-efficiencies and/or reduce security exposures. Patch by me, per discussion with Heikki Linnakangas and Shay Rojansky. Back-patch to all supported versions. Discussion: https://postgr.es/m/CADT4RqBU8N-csyZuzaook-c795dt22Zcwg1aHWB6tfVdAkodZA@mail.gmail.com
1 parent b374481 commit 97d3a0b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/libpq/be-secure-openssl.c

+8
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,14 @@ be_tls_init(bool isServerStart)
288288
/* disallow SSL v2/v3 */
289289
SSL_CTX_set_options(context, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
290290

291+
/* disallow SSL session tickets */
292+
#ifdef SSL_OP_NO_TICKET /* added in openssl 0.9.8f */
293+
SSL_CTX_set_options(context, SSL_OP_NO_TICKET);
294+
#endif
295+
296+
/* disallow SSL session caching, too */
297+
SSL_CTX_set_session_cache_mode(context, SSL_SESS_CACHE_OFF);
298+
291299
/* set up ephemeral DH and ECDH keys */
292300
if (!initialize_dh(context, isServerStart))
293301
goto error;

0 commit comments

Comments
 (0)