-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Validate Subject DN entries during Certificate based authentication with Vault #5453
base: main
Are you sure you want to change the base?
Validate Subject DN entries during Certificate based authentication with Vault #5453
Conversation
Hello Admin(s), Thanks. |
@bluecmd @michaelansel @vishalnayak @joemiller @armon @traviscosgrave Thanks! |
Nice! To me this makes a lot of sense -- I just scrolled through the code, I'm more reviewing the idea.
I'm thinking something like: r := &vault.Whatever{
RequiredExtensions: map[string]string{
"uid": "TheUID",
"dc": "ExampleDC",
"0.OU" "ExampleDivision1", // Case in-sensitive
"2.5.4.3": "example.com", // Supports explicit extensions as well
},
} I think those API calls would be 1) much more user friendly, 2) easier to audit, and 3) harder to screw up. |
@bluecmd Thanks for the feedback. My comments inline.
The resulting policy would still be determined by a defined role at the cert endpoint. Nothing changes there.
- On the user friendliness, I do agree that readable names would be easier for operators, but considering that this will also support arbitrary relative DN's, it might be a good idea to just keep it consistent in OID format; similar to the required_extensions check in cert auth. But if the consensus on this is to keep it readable, it will change the interface.
- "harder to screw up" : Core configs would be done by operators and not general users and this will be a relatively low recurring change. But yes, mistakes will be easier to identify if the names are more readable.
The policy configured for the cert auth role. |
I'm adding this to the next release milestone for visibility; note that I won't be making the final decision on when it might land. Also, nobody from HC can review this until you accept the CLA, so that's a hard prerequisite before we can proceed. |
a13e613
to
1e1a31e
Compare
501a09e
to
fb253b7
Compare
fb253b7
to
1e1a31e
Compare
Thank you @jefferai . |
Hi @jefferai , when can we expect this to be merged? |
@desperados1999 No idea. It hasn't been discussed by the Vault team yet, so far as I know; there are concerns about its implementation raised in the comments above. |
hey @palsaurabh2005 any chance you can resolve the merge conflict here - I appreciate a lot has changed and I'm not entirely certain if it will be merged - but then having said that I cant think of reasons why not since all these properties are user configurable. Thank you for your efforts and suggestion here. |
@cipherboy any inputs you may have on this would be welcome too. |
Hey @aphorise , sorry about the delay in getting back to you. |
Why?
Vault should be able to verify individual Subject DN entries of a presented client certificate.
A subject DN is particularly important when a PKI is backed by LDAP and its almost necessary at times
to match DN fields before access could be granted.
Further, its not always possible to tweak the PKI on request to get DN entries in certificate extensions.
Furthermore, as of today, we provide options to check for allowed_common_names and allowed_organizational_units(0.11.2).
Instead of adding a check for each of the Subject DN fields, there should be a unified way of checking any of the Subject DN entries.
Similar to how the "required_extensions" check works.
How:
With this PR I am pushing in changes that will allow Vault to verify Subject DN entries in a client certificate.
These entries will be matched against a config property "required_subject_oids".
The format for "required_subject_oids" is a comma separated array or string of form oid:value and globbing of value is supported.
For example:
A config entry for required_subject_oids as: "0.9.2342.19200300.100.1.1:TheUID,2.5.4.3:example.com,2.5.4.6:US,2.5.4.8:CA,2.5.4.7:Sunnyvale,2.5.4.10:ExampleOrg,2.5.4.11:ExampleDivision1,2.5.4.11:Example*2,2.5.4.11:ExampleDivision3,0.9.2342.19200300.100.1.25:ExampleDC,2.5.4.4:ExampleSN"
will require the Client certificate to contain a Subject DN with entries as:
Note that all these fields should match for the the certificate verification to pass.
The test cases cover most of the scenarios:
./builtin/credential/cert/backend_test.go#TestBackend_subjectoids_singleCert()
To execute the test cases:
make test TEST=./builtin/credential/cert
Ref: https://tools.ietf.org/html/rfc5280#section-4.1.2.4
https://www.cryptosys.net/pki/manpki/pki_distnames.html
Related conversation on this topic @jefferai @briankassouf :
https://groups.google.com/forum/#!topic/vault-tool/3XzNAaKWi9U