pgsql: GSSAPI encryption support - Mailing list pgsql-committers

From Stephen Frost
Subject pgsql: GSSAPI encryption support
Date
Msg-id E1hBlA6-0004G0-WF@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
GSSAPI encryption support

On both the frontend and backend, prepare for GSSAPI encryption
support by moving common code for error handling into a separate file.
Fix a TODO for handling multiple status messages in the process.
Eliminate the OIDs, which have not been needed for some time.

Add frontend and backend encryption support functions.  Keep the
context initiation for authentication-only separate on both the
frontend and backend in order to avoid concerns about changing the
requested flags to include encryption support.

In postmaster, pull GSSAPI authorization checking into a shared
function.  Also share the initiator name between the encryption and
non-encryption codepaths.

For HBA, add "hostgssenc" and "hostnogssenc" entries that behave
similarly to their SSL counterparts.  "hostgssenc" requires either
"gss", "trust", or "reject" for its authentication.

Similarly, add a "gssencmode" parameter to libpq.  Supported values are
"disable", "require", and "prefer".  Notably, negotiation will only be
attempted if credentials can be acquired.  Move credential acquisition
into its own function to support this behavior.

Add a simple pg_stat_gssapi view similar to pg_stat_ssl, for monitoring
if GSSAPI authentication was used, what principal was used, and if
encryption is being used on the connection.

Finally, add documentation for everything new, and update existing
documentation on connection security.

Thanks to Michael Paquier for the Windows fixes.

Author: Robbie Harwood, with changes to the read/write functions by me.
Reviewed in various forms and at different times by: Michael Paquier,
   Andres Freund, David Steele.
Discussion: https://www.postgresql.org/message-id/flat/jlg1tgq1ktm.fsf@thriss.redhat.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/client-auth.sgml           |  78 +++-
doc/src/sgml/libpq.sgml                 |  59 ++-
doc/src/sgml/monitoring.sgml            |  57 +++
doc/src/sgml/runtime.sgml               |  77 +++-
src/backend/catalog/system_views.sql    |   8 +
src/backend/libpq/Makefile              |   4 +
src/backend/libpq/auth.c                | 115 +++---
src/backend/libpq/be-gssapi-common.c    |  74 ++++
src/backend/libpq/be-gssapi-common.h    |  26 ++
src/backend/libpq/be-secure-gssapi.c    | 627 +++++++++++++++++++++++++++++++
src/backend/libpq/be-secure.c           |  16 +
src/backend/libpq/hba.c                 |  51 ++-
src/backend/postmaster/pgstat.c         |  46 +++
src/backend/postmaster/postmaster.c     |  40 +-
src/backend/utils/adt/pgstatfuncs.c     |  20 +-
src/bin/psql/command.c                  |  17 +
src/include/catalog/pg_proc.dat         |   6 +-
src/include/libpq/hba.h                 |   4 +-
src/include/libpq/libpq-be.h            |  20 +
src/include/libpq/libpq.h               |   3 +
src/include/libpq/pqcomm.h              |   5 +-
src/include/pgstat.h                    |  24 +-
src/interfaces/libpq/Makefile           |   4 +
src/interfaces/libpq/exports.txt        |   2 +
src/interfaces/libpq/fe-auth.c          |  84 +----
src/interfaces/libpq/fe-connect.c       | 236 +++++++++++-
src/interfaces/libpq/fe-gssapi-common.c | 130 +++++++
src/interfaces/libpq/fe-gssapi-common.h |  23 ++
src/interfaces/libpq/fe-secure-gssapi.c | 635 ++++++++++++++++++++++++++++++++
src/interfaces/libpq/fe-secure.c        |  31 ++
src/interfaces/libpq/libpq-fe.h         |   9 +-
src/interfaces/libpq/libpq-int.h        |  23 ++
src/test/kerberos/t/002_enc.pl          | 197 ++++++++++
src/test/regress/expected/rules.out     |  11 +-
src/tools/msvc/Mkvcbuild.pm             |  10 +
35 files changed, 2575 insertions(+), 197 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Copy name when cloning FKs recurses to partitions
Next
From: Tomas Vondra
Date:
Subject: pgsql: Reduce overhead of pg_mcv_list (de)serialization