Allow matching whole DN from a client certificate - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Allow matching whole DN from a client certificate
Date
Msg-id 92e70110-9273-d93c-5913-0bccb6562740@dunslane.net
Whole thread Raw
Responses Re: Allow matching whole DN from a client certificate  (Stephen Frost <sfrost@snowman.net>)
Re: Allow matching whole DN from a client certificate  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
Currently we only match the Common Name (CN) of a client certificate
when authenticating a user. The attached patch allows matching the
entire Distinguished Name (DN) of the certificate. This is enabled by
the HBA line option "clientname", which can take the values "CN" or
"DN". "CN" is the default.

The idea is that you might have a role with a CN of, say, "dbauser" in
two different parts of the organization, say one with "OU=marketing" and
the other with "OU=engineering", and you only want to allow access to
one of them.

This feature is best used in conjunction with a map. e.g. in testing I
have this pg_hba.conf line:

    hostssl all all 127.0.0.1/32 cert clientname=DN map=dn

and this pg_ident.conf line:

    dn /^C=US,ST=North.Carolina,O=test,OU=eng,CN=andrew$ andrew

If people like this idea I'll add tests and docco and add it to the next CF.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
"


Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Add docs stub for recovery.conf
Next
From: John Naylor
Date:
Subject: Re: cutting down the TODO list thread