Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 11, 2023

Conversation

elcallio
Copy link
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
@avikivity
Copy link
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
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
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
Copy link
Contributor Author

elcallio commented May 9, 2023

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