Skip to content
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

sql,security, ccl: Match certificate DN against SUBJECT role option #119958

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

souravcrl
Copy link
Contributor

@souravcrl souravcrl commented Mar 5, 2024

informs #110616
fixes CRDB-35940
Epic CRDB-34126

We use values from SUBJECT role option to match against a client certificate for
a user. The client certificate in X.509 standard contains a subject which
represents an X.509 DN. We use the RFC 2253 parsed string from this
representation to be used as an LDAP DN subject in the client
CertificateUserScope object while evaluating the certificate for auth. Thus,
in UserAuthCertHook we will be evaluating both for the cert scope userName to
match the db user and cert scope subject to match the set subject role option.

Release note: None

@souravcrl souravcrl requested review from a team as code owners March 5, 2024 20:44
@souravcrl souravcrl requested review from mgartner and removed request for a team March 5, 2024 20:44
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@souravcrl souravcrl force-pushed the subject-role-option-match branch from 0c1831c to 2da7a46 Compare March 5, 2024 20:47
@souravcrl souravcrl changed the title sql, security: use values from the SUBJECT role option to match again… sql, security: use values from the SUBJECT role option to match against a client certificate for a user Mar 5, 2024
@mgartner mgartner removed their request for review March 5, 2024 22:40
@souravcrl souravcrl changed the title sql, security: use values from the SUBJECT role option to match against a client certificate for a user (WIP) sql, security: use values from the SUBJECT role option to match against a client certificate for a user Mar 6, 2024
@souravcrl souravcrl force-pushed the subject-role-option-match branch 2 times, most recently from 082b9e9 to 121aea7 Compare March 6, 2024 06:54
@BabuSrithar BabuSrithar marked this pull request as draft March 6, 2024 09:34
@BabuSrithar BabuSrithar requested review from BabuSrithar and removed request for a team March 6, 2024 09:37
@souravcrl souravcrl force-pushed the subject-role-option-match branch 2 times, most recently from c5f71aa to 5f41e6f Compare March 10, 2024 19:58
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Mar 11, 2024
Release note: None
Epic: None

Release justification: We will need encoding/asn1 library to support
marshalling/unmarshalling of DER encoded values used in crypto/x509 library for
raw subject and subject fields. This is needed for
cockroachdb#119958
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Mar 11, 2024
Release note: None
Epic: None

Release justification: We will need encoding/asn1 library to support
marshalling/unmarshalling of DER encoded values used in crypto/x509 library for
raw subject and subject fields. This is needed for
cockroachdb#119958
craig bot pushed a commit that referenced this pull request Mar 11, 2024
120189: testutils: add asn1 to allowed Marshal functions list r=bdarnell a=souravcrl

Release note: None
Epic: None

Release justification: We will need encoding/asn1 library to support marshalling/unmarshalling of DER encoded values used in crypto/x509 library for raw subject and subject fields. This is needed for #119958

Co-authored-by: Sourav Sarangi <[email protected]>
@souravcrl souravcrl changed the title (WIP) sql, security: use values from the SUBJECT role option to match against a client certificate for a user sql, security: use values from the SUBJECT role option to match against a client certificate for a user Mar 11, 2024
@souravcrl souravcrl marked this pull request as ready for review March 11, 2024 08:39
@souravcrl souravcrl force-pushed the subject-role-option-match branch from 5f41e6f to d9b757f Compare March 11, 2024 09:02
@souravcrl souravcrl marked this pull request as draft March 11, 2024 09:02
@souravcrl souravcrl self-assigned this Mar 11, 2024
@souravcrl souravcrl marked this pull request as ready for review March 11, 2024 12:16
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Mar 28, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce the provided certificate by
client to exactly match the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Mar 28, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce the provided certificate by
client to exactly match the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Apr 2, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce that certificate provided by
client exactly matches the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Apr 4, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce that certificate provided by
client exactly matches the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Apr 8, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce that certificate provided by
client exactly matches the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
souravcrl added a commit to souravcrl/cockroach that referenced this pull request Apr 8, 2024
Previous in sequence: cockroachdb#119958
informs cockroachdb#110616, cockroachdb#118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce that certificate provided by
client exactly matches the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
craig bot pushed a commit that referenced this pull request Apr 9, 2024
120786: rpc,security, cli: Add cert-distinguished-name root/node cli flag r=rafiss a=souravcrl

Previous in sequence: #119958
informs #110616 
fixes #118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce the provided certificate by
client to exactly match the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None

Co-authored-by: Sourav Sarangi <[email protected]>
blathers-crl bot pushed a commit that referenced this pull request Apr 9, 2024
Previous in sequence: #119958
informs #110616, #118750
fixes CRDB-35884
Epic CRDB-34126

We will be adding 2 new cli flags `root-cert-distinguished-name` and
`node-cert-distinguished-name` to provide option to have subject DN for root and
node user during server startup. This will enforce that certificate provided by
client exactly matches the value set by the above flags both for sql client and
RPC authentication. This is needed because subject role option cannot be set for
root and node users.

Post this the plan is to add a cluster setting
`server.client_cert.subject_required` which will mandate that any auth which
happens should verify certSubject with rootSubject in case of root user, with
nodeSubject in case of node user, with roleSubject otherwise.

Release note: None
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.

4 participants