postgresql/src/backend/libpq
Nathan Bossart db6a4a985b Deprecate MD5 passwords.
MD5 has been considered to be unsuitable for use as a cryptographic
hash algorithm for some time.  Furthermore, MD5 password hashes in
PostgreSQL are vulnerable to pass-the-hash attacks, i.e., knowing
the username and hashed password is sufficient to authenticate.
The SCRAM-SHA-256 method added in v10 is not subject to these
problems and is considered to be superior to MD5.

This commit marks MD5 password support in PostgreSQL as deprecated
and to be removed in a future release.  The documentation now
contains several deprecation notices, and CREATE ROLE and ALTER
ROLE now emit deprecation warnings when setting MD5 passwords.  The
warnings can be disabled by setting the md5_password_warnings
parameter to "off".

Reviewed-by: Greg Sabino Mullane, Jim Nasby
Discussion: https://postgr.es/m/ZwbfpJJol7lDWajL%40nathan
2024-12-02 13:30:07 -06:00
..
auth-sasl.c Make SASL max message length configurable 2024-10-23 16:10:27 +02:00
auth-scram.c Make SASL max message length configurable 2024-10-23 16:10:27 +02:00
auth.c More use of getpwuid_r() directly 2024-09-02 09:04:30 +02:00
be-fsstubs.c Remove unnecessary code from be_lo_put() 2024-04-25 10:08:07 +02:00
be-gssapi-common.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
be-secure-common.c Fix memory leaks in error reporting with LOG level 2024-05-14 10:41:32 +02:00
be-secure-gssapi.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
be-secure-openssl.c Remove unused #include's from backend .c files 2024-10-27 08:26:50 +01:00
be-secure.c Support configuring TLSv1.3 cipher suites 2024-10-24 15:20:32 +02:00
crypt.c Deprecate MD5 passwords. 2024-12-02 13:30:07 -06:00
hba.c Remove useless casts to (void *) 2024-11-28 08:27:20 +01:00
ifaddr.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Refactor SASL code with a generic interface for its mechanisms 2021-07-07 10:55:15 +09:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_hba.conf.sample Add description for new patterns supported in HBA and ident sample files 2023-02-16 07:38:52 +09:00
pg_ident.conf.sample Add description for new patterns supported in HBA and ident sample files 2023-02-16 07:38:52 +09:00
pqcomm.c Add missing includes for some global variables 2024-07-02 07:26:22 +02:00
pqformat.c Remove unused 'countincludesself' argument to pq_sendcountedtext() 2024-03-04 12:56:05 +02:00
pqmq.c Use correct type for pq_mq_parallel_leader_proc_number variable 2024-07-15 11:12:22 +03:00
pqsignal.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
README.SSL Move EDH support to common files 2018-01-23 07:11:38 -05:00

src/backend/libpq/README.SSL

SSL
===

>From the servers perspective:


  Receives StartupPacket
           |
           |
 (Is SSL_NEGOTIATE_CODE?) -----------  Normal startup
           |                  No
           |
           | Yes
           |
           |
 (Server compiled with USE_SSL?) ------- Send 'N'
           |                       No        |
           |                                 |
           | Yes                         Normal startup
           |
           |
        Send 'S'
           |
           |
      Establish SSL
           |
           |
      Normal startup





>From the clients perspective (v6.6 client _with_ SSL):


      Connect
         |
         |
  Send packet with SSL_NEGOTIATE_CODE
         |
         |
  Receive single char  ------- 'S' -------- Establish SSL
         |                                       |
         | '<else>'                              |
         |                                  Normal startup
         |
         |
   Is it 'E' for error  ------------------- Retry connection
         |                  Yes             without SSL
         | No
         |
   Is it 'N' for normal ------------------- Normal startup
         |                  Yes
         |
   Fail with unknown

---------------------------------------------------------------------------

Ephemeral DH
============

Since the server static private key ($DataDir/server.key) will
normally be stored unencrypted so that the database backend can
restart automatically, it is important that we select an algorithm
that continues to provide confidentiality even if the attacker has the
server's private key.  Ephemeral DH (EDH) keys provide this and more
(Perfect Forward Secrecy aka PFS).

N.B., the static private key should still be protected to the largest
extent possible, to minimize the risk of impersonations.

Another benefit of EDH is that it allows the backend and clients to
use DSA keys.  DSA keys can only provide digital signatures, not
encryption, and are often acceptable in jurisdictions where RSA keys
are unacceptable.

The downside to EDH is that it makes it impossible to use ssldump(1)
if there's a problem establishing an SSL session.  In this case you'll
need to temporarily disable EDH (see initialize_dh()).