diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c index 67145e9..1039254 100644 --- a/src/backend/libpq/be-secure-openssl.c +++ b/src/backend/libpq/be-secure-openssl.c @@ -87,6 +87,9 @@ static SSL_CTX *SSL_context = NULL; static bool SSL_initialized = false; static bool ssl_passwd_cb_called = false; +/* Arbitrary hardcoded value to serve as the session ID context */ +static const unsigned char session_id_context[] = "postgresql"; + /* ------------------------------------------------------------ */ /* Hardcoded values */ /* ------------------------------------------------------------ */ @@ -206,6 +209,12 @@ be_tls_init(bool isServerStart) SSL_CTX_set_mode(context, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); /* + * Set the session ID context, which is necessary to make OpenSSL perform + * session resumption correctly. + */ + SSL_CTX_set_session_id_context(context, session_id_context, sizeof session_id_context); + + /* * If reloading, override OpenSSL's default handling of * passphrase-protected files, because we don't want to prompt for a * passphrase in an already-running server. (Not that the default