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

From Jacob Champion
Subject Re: Allow matching whole DN from a client certificate
Date
Msg-id 5e6a0be9b5da4ef6f3755d594d385f938b6a1cff.camel@vmware.com
Whole thread Raw
In response to Re: Allow matching whole DN from a client certificate  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Allow matching whole DN from a client certificate  (Jacob Champion <pchampion@vmware.com>)
Re: Allow matching whole DN from a client certificate  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Mon, 2021-01-18 at 11:23 +0100, Daniel Gustafsson wrote:
> +               /* use commas instead of slashes */
> +               X509_NAME_print_ex(bio, x509name, 0, XN_FLAG_SEP_COMMA_PLUS);
> I don't have strong opinions on whether we shold use slashes or commas, but I
> think it needs to be documented that commas are required since slashes is the
> more common way to print a DN.

There's also a XN_FLAG_RFC2253 flag, which claims to print in an RFC-
compatible escape system. (It includes XN_FLAG_SEP_COMMA_PLUS.) I think
NSS uses a similar RFC-based escape scheme, but I haven't checked to
see whether it's fully compatible.

I think you'll want to be careful to specify the format as much as
possible, both to make sure that other backend TLS implementations can
actually use the same escaping system and to ensure that user regexes
don't suddenly start matching different things at some point in the
future. As a cautionary tale, nginx is stuck with two versions of their
similar feature (ssl_client_s_dn_legacy vs ssl_client_s_dn) after their
switch to an RFC-compatible system [1].

Even when using RFC 2253 (now 4514) escaping, there are things left to the implementation, such as the order of AVAs
insidemultivalued RDNs. The RFC warns not to consider these representations to be canonical forms, so it's possible
thatswitching (or upgrading) the TLS library in use could force users to change their regexes at some point in the
future.
I'm going to test this patch with some UTF-8 DNs later today; I'll
share my findings. I'm also going to read up on [2] a bit more.

--Jacob

[1] 
https://serverfault.com/questions/829754/why-did-the-format-of-nginx-ssl-client-i-dn-suddenly-change

[2] 
https://frasertweedale.github.io/blog-redhat/posts/2019-05-28-a-dn-is-not-a-string.html

pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: catalogs.sgml documentation ambiguity
Next
From: Dmitry Dolgov
Date:
Subject: Re: [HACKERS] [PATCH] Generic type subscripting