Skip to content

TLS: support for extracting certificate subject alt names from client certs#1629

Merged
avikivity merged 4 commits into
scylladb:masterfrom
elcallio:tls_alt_names
May 11, 2023
Merged

TLS: support for extracting certificate subject alt names from client certs#1629
avikivity merged 4 commits into
scylladb:masterfrom
elcallio:tls_alt_names

Conversation

@elcallio

Copy link
Copy Markdown
Contributor

Fixes #1628

Subject alt name info can contain more extensive and detailed info on a connecting client. Add interface to allow querying this from a connected socket.

Initially we don't include this in accept-sequence auth verification, though we maybe should include it as an option.

@elcallio elcallio requested a review from bhalevy April 25, 2023 12:31
Comment thread src/net/tls.cc Outdated
Comment thread src/net/tls.cc Outdated
Comment thread src/net/tls.cc Outdated
@avikivity

Copy link
Copy Markdown
Member

Looks good, but please elaborate on "Initially we don't include this in accept-sequence auth verification, though we maybe should include it as an option.". What does that mean? That we should accept some predicate to apply to alt names?

@elcallio

Copy link
Copy Markdown
Contributor Author

It means that we should maybe add it as an (optional), retrievable attribute for the void set_dn_verification_callback(dn_callback);. That is a callback that can be registered for an accepting socket, and allows user code to optionally reject connections early based on certificate content (DN info). Since SAN (alt names) are an extension of DN info, it seems logical that we should maybe allw it also to be at least queried.

I was thinking something like:

    using dn_callback = noncopyable_function<void(session_type type, sstring subject, sstring issuer)>;

    void set_dn_verification_callback(dn_callback);

...

    using dn_callback_ex = noncopyable_function<void(session_type type, sstring subject, sstring issuer, const std::vector<subject_alt_name>&)>;

    void set_dn_verification_callback_ex(dn_callback_ex, std::unordered_set<subject_alt_name_type> types = {});

to maintain compatibility.

@elcallio elcallio force-pushed the tls_alt_names branch 2 times, most recently from 9cf7d7d to 9f1f930 Compare April 25, 2023 15:12
@elcallio

Copy link
Copy Markdown
Contributor Author

ping?

Calle Wilund added 3 commits May 2, 2023 12:16
Fixes scylladb#1628

Subject alt name info can contain more extensive and detailed info
on a connecting client. Add interface to allow querying this from a
connected socket.

Initially we don't include this in accept-sequence auth verification,
though we maybe should include it as an option in
`set_dn_verification_callback`.
For printing. And consequential parsing/matching.

Note: because naming of alternative names is inconsistent between tools,
and because openssl is probably more popular when creating certs anyway,
this routine will be inconsistent with both gnutls and openssl (though more
in line with the latter) and name the constants as follows:

* dnsname: "DNS"
* rfc822name: "EMAIL"
* uri: "URI"
* ipaddress "IP"
* othername: "OTHERNAME"
* dn: "DIRNAME"
@elcallio

elcallio commented May 9, 2023

Copy link
Copy Markdown
Contributor Author

ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TLS: add interface to query subject alternative names for client auth certificated

2 participants