Let OpenSSL auto-select DH parameters by default

Previously, if ssl_dh_params_file was not set, compiled-in default
parameters were used.  This changes this so that in that case, we call
SSL_CTX_set_dh_auto() and have OpenSSL choose appropriate, well-known,
and appropriately sized parameters.  In particular, the size of the
parameters is chosen consistent with the size of the key and
certificate, and so it can automatically grow with new standards and
best practices.  This default behavior is now preferable; it is noted
that setting ssl_dh_params_file is obsolescent.  (Previously, some
public configuration guides recommended setting ssl_dh_params_file,
and so it is possible that this setting is somewhat widely used in
practice and just removing it right away would be disruptive.)

There was also some not-very-modern text about this in README.SSL,
which is deleted here.

Note that if you use a very small certificate/key size, then this
could mean that the size of the chosen DH parameters could also end up
smaller than the previous hard-coded default.  But that could only
happen if you disregarded all current security best practices anyway.

Note a small behavior change: Previously, if loading the DH file
failed during a server reload, the system would then fall back to
using the built-in parameters, instead of failing the reload and
keeping the old SSL context, which is what it would do if some other
aspect of reinitializing SSL would fail.  This is now fixed.

Reviewed-by: Heikki Linnakangas <[email protected]>
Reviewed-by: Andreas Karlsson <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e9526740926a801554cc92ea4d5620fca3546fe8

Modified Files
--------------
doc/src/sgml/config.sgml              | 14 ++++--
src/backend/libpq/README.SSL          | 24 ----------
src/backend/libpq/be-secure-openssl.c | 87 ++++++++++++-----------------------
src/include/libpq/libpq-be.h          | 20 --------
4 files changed, 39 insertions(+), 106 deletions(-)

Reply via email to