Skip to content

feat!(stackable-certs): Support adding SAN entries #1057

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sbernauer
Copy link
Member

Description

As #1044 didn't move along, splitting the relevant change out to unblock CRD versioning.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added

Sorry, something went wrong.

@sbernauer sbernauer moved this to Development: Waiting for Review in Stackable Engineering Jun 23, 2025
Copy link
Member

@NickLarsenNZ NickLarsenNZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some changes to the changelog, and the rest (I think) are only suggestions.

Comment on lines +345 to +349
Ok(GeneralName::DnsName(Ia5String::new(dns_name).context(
ParseSubjectAlternativeDnsNameSnafu {
subject_alternative_dns_name: dns_name.to_string(),
},
)?))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find these a little bit of a handful and would tend to prefer this:

Suggested change
Ok(GeneralName::DnsName(Ia5String::new(dns_name).context(
ParseSubjectAlternativeDnsNameSnafu {
subject_alternative_dns_name: dns_name.to_string(),
},
)?))
let ia5_dns_name = Ia5String::new(dns_name).context(
ParseSubjectAlternativeDnsNameSnafu {
subject_alternative_dns_name: dns_name.to_string(),
},
)?;
Ok(GeneralName::DnsName(ia5_dns_name))

You're welcome to ignore this suggestion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better if we had a TryFrom impl, we could then do:

        let sans = subject_alterative_dns_names
            .into_iter()
            .map(GeneralName::try_from)
            .collect::<Result<Vec<_>, Error>>()?;


- BREAKING: `CertificateAuthority::generate_leaf_certificate` (and `generate_rsa_leaf_certificate` and `generate_ecdsa_leaf_certificate`)
now take an additional parameter `subject_alterative_dns_names`. The passed SANs are added to the generated certificate,
this is needed for basically all modern TLS certificate validations when used with HTTPS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree that it is needed.

It is only needed when you want to use the certificate with multiple names (in addition to the commonName). So while it is common, it isn't correct to say that it is needed due to modern validation impls.

Unless I've been hiding under a rock and you have seen problems validating on commonName alone?

Suggested change
this is needed for basically all modern TLS certificate validations when used with HTTPS.
this is often needed.

or

Suggested change
this is needed for basically all modern TLS certificate validations when used with HTTPS.
this is needed when the HTTPS server is accessible on multiple DNS names and/or IPs.

Comment on lines +13 to +14
- BREAKING: The constant `DEFAULT_CA_VALIDITY_SECONDS` has been renamed to `DEFAULT_CA_VALIDITY` and now is of type `stackable_operator::time::Duration`.
Also, the constant `ROOT_CA_SUBJECT` has been renamed to `SDP_ROOT_CA_SUBJECT` ([#1057]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- BREAKING: The constant `DEFAULT_CA_VALIDITY_SECONDS` has been renamed to `DEFAULT_CA_VALIDITY` and now is of type `stackable_operator::time::Duration`.
Also, the constant `ROOT_CA_SUBJECT` has been renamed to `SDP_ROOT_CA_SUBJECT` ([#1057]).
- BREAKING: Constants have been renamed/retyped ([#1057]):
- `DEFAULT_CA_VALIDITY_SECONDS` has been renamed to `DEFAULT_CA_VALIDITY` and now is of type `stackable_operator::time::Duration`.
- `ROOT_CA_SUBJECT` has been renamed to `SDP_ROOT_CA_SUBJECT`.

Comment on lines +337 to +338
ID_KP_CLIENT_AUTH,
ID_KP_SERVER_AUTH,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was existing behaviour, so no change required now, but I don't think we should make any certificate usable as a Client Cert. It should be intentional.

})
.collect::<Result<Vec<_>, Error>>()?;
builder
.add_extension(&SubjectAltName(sans))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking what happens if there are no sans (note to self, see if tests show it).

Nice, there is a test for the empty sans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Development: Waiting for Review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants