postgresql/src/backend/libpq
Peter Eisentraut 74a308cf52 Use explicit_bzero
Use the explicit_bzero() function in places where it is important that
security information such as passwords is cleared from memory.  There
might be other places where it could be useful; this is just an
initial collection.

For platforms that don't have explicit_bzero(), provide various
fallback implementations.  (explicit_bzero() itself isn't standard,
but as Linux/glibc, FreeBSD, and OpenBSD have it, it's the most common
spelling, so it makes sense to make that the invocation point.)

Discussion: https://www.postgresql.org/message-id/flat/42d26bde-5d5b-c90d-87ae-6cab875f73be%402ndquadrant.com
2019-09-05 08:30:42 +02:00
..
Makefile GSSAPI encryption support 2019-04-03 15:02:33 -04:00
README.SSL Move EDH support to common files 2018-01-23 07:11:38 -05:00
auth-scram.c Clean up some SCRAM attribute processing 2019-08-20 22:33:06 +02:00
auth.c Fix inconsistencies and typos in the tree, take 10 2019-08-13 13:53:41 +09:00
be-fsstubs.c Use consistent style for checking return from system calls 2019-07-07 15:28:49 +02:00
be-gssapi-common.c Move be-gssapi-common.h into src/include/libpq/ 2019-06-08 09:59:02 +09:00
be-secure-common.c Use explicit_bzero 2019-09-05 08:30:42 +02:00
be-secure-gssapi.c Remove unnecessary header from be-secure-gssapi.c 2019-06-29 11:17:37 +09:00
be-secure-openssl.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
be-secure.c GSSAPI encryption support 2019-04-03 15:02:33 -04:00
crypt.c Remove configure detection of crypt() 2019-08-21 21:36:54 +02:00
hba.c Represent Lists as expansible arrays, not chains of cons-cells. 2019-07-15 13:41:58 -04:00
ifaddr.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_hba.conf.sample Rename "scram" to "scram-sha-256" in pg_hba.conf and password_encryption. 2017-04-18 14:50:50 +03:00
pg_ident.conf.sample Reformat the comments in pg_hba.conf and pg_ident.conf 2010-01-26 06:58:39 +00:00
pqcomm.c Fix inconsistencies and typos in the tree, take 10 2019-08-13 13:53:41 +09:00
pqformat.c Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
pqmq.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pqsignal.c Update copyright for 2019 2019-01-02 12:44:25 -05:00

README.SSL

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()).