mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Add support for Kerberos credential delegation
Support GSSAPI/Kerberos credentials being delegated to the server by a client. With this, a user authenticating to PostgreSQL using Kerberos (GSSAPI) credentials can choose to delegate their credentials to the PostgreSQL server (which can choose to accept them, or not), allowing the server to then use those delegated credentials to connect to another service, such as with postgres_fdw or dblink or theoretically any other service which is able to be authenticated using Kerberos. Both postgres_fdw and dblink are changed to allow non-superuser password-less connections but only when GSSAPI credentials have been delegated to the server by the client and GSSAPI is used to authenticate to the remote system. Authors: Stephen Frost, Peifeng Qiu Reviewed-By: David Christensen Discussion: https://postgr.es/m/CO1PR05MB8023CC2CB575E0FAAD7DF4F8A8E29@CO1PR05MB8023.namprd05.prod.outlook.com
This commit is contained in:
@ -171,7 +171,8 @@ ALTER SERVER testserver1 OPTIONS (
|
||||
sslcrl 'value',
|
||||
--requirepeer 'value',
|
||||
krbsrvname 'value',
|
||||
gsslib 'value'
|
||||
gsslib 'value',
|
||||
gssdeleg 'value'
|
||||
--replication 'value'
|
||||
);
|
||||
-- Error, invalid list syntax
|
||||
@ -9840,8 +9841,8 @@ CREATE FOREIGN TABLE pg_temp.ft1_nopw (
|
||||
c8 user_enum
|
||||
) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1');
|
||||
SELECT 1 FROM ft1_nopw LIMIT 1;
|
||||
ERROR: password is required
|
||||
DETAIL: Non-superusers must provide a password in the user mapping.
|
||||
ERROR: password or GSSAPI delegated credentials required
|
||||
DETAIL: Non-superusers must delegate GSSAPI credentials or provide a password in the user mapping.
|
||||
-- If we add a password to the connstr it'll fail, because we don't allow passwords
|
||||
-- in connstrs only in user mappings.
|
||||
ALTER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
|
||||
@ -9853,16 +9854,16 @@ HINT: Perhaps you meant the option "passfile".
|
||||
-- This won't work with installcheck, but neither will most of the FDW checks.
|
||||
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
|
||||
SELECT 1 FROM ft1_nopw LIMIT 1;
|
||||
ERROR: password is required
|
||||
DETAIL: Non-superuser cannot connect if the server does not request a password.
|
||||
ERROR: password or GSSAPI delegated credentials required
|
||||
DETAIL: Non-superuser cannot connect if the server does not request a password or use GSSAPI with delegated credentials.
|
||||
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
|
||||
-- Unpriv user cannot make the mapping passwordless
|
||||
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false');
|
||||
ERROR: password_required=false is superuser-only
|
||||
HINT: User mappings with the password_required option set to false may only be created or modified by the superuser.
|
||||
SELECT 1 FROM ft1_nopw LIMIT 1;
|
||||
ERROR: password is required
|
||||
DETAIL: Non-superuser cannot connect if the server does not request a password.
|
||||
ERROR: password or GSSAPI delegated credentials required
|
||||
DETAIL: Non-superuser cannot connect if the server does not request a password or use GSSAPI with delegated credentials.
|
||||
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
|
||||
RESET ROLE;
|
||||
-- But the superuser can
|
||||
@ -9890,8 +9891,8 @@ DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw;
|
||||
-- This will fail again as it'll resolve the user mapping for public, which
|
||||
-- lacks password_required=false
|
||||
SELECT 1 FROM ft1_nopw LIMIT 1;
|
||||
ERROR: password is required
|
||||
DETAIL: Non-superusers must provide a password in the user mapping.
|
||||
ERROR: password or GSSAPI delegated credentials required
|
||||
DETAIL: Non-superusers must delegate GSSAPI credentials or provide a password in the user mapping.
|
||||
RESET ROLE;
|
||||
-- The user mapping for public is passwordless and lacks the password_required=false
|
||||
-- mapping option, but will work because the current user is a superuser.
|
||||
|
Reference in New Issue
Block a user