-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't take a close look at this, but I will soon.
Blocking it for now.
- 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 when the HTTPS server is accessible on multiple DNS names and/or IPs. | ||
Pass an empty list (`[]`) to keep the existing behavior ([#1057]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This is a change, not an addition. As such, this should live in the "Changed" section.
suggestion: Slight reword.
- 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 when the HTTPS server is accessible on multiple DNS names and/or IPs. | |
Pass an empty list (`[]`) to keep the existing behavior ([#1057]). | |
- BREAKING: The functions `generate_leaf_certificate`, `generate_rsa_leaf_certificate` and | |
`generate_ecdsa_leaf_certificate` of `CertificateAuthority` accept an additional parameter | |
`subject_alterative_dns_names` ([#1057]). | |
- The passed SANs are added to the generated certificate, this is needed when the HTTPS server is | |
accessible on multiple DNS names and/or IPs. | |
- Pass an empty list (`[]`) to keep the existing behavior. |
- 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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This also a change and should be moved.
- 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`. | ||
- Added the function `CertificateAuthority::ca_cert` to easily get the CA `Certificate` ([#1057]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Slight reword.
- Added the function `CertificateAuthority::ca_cert` to easily get the CA `Certificate` ([#1057]). | |
- Add the function `CertificateAuthority::ca_cert` to easily get the CA `Certificate` ([#1057]). |
## [0.3.1] - 2024-07-10 | ||
|
||
### Changed | ||
|
||
- Bump rust-toolchain to 1.79.0 ([#822]). | ||
|
||
[#822]: https://github.com/stackabletech/operator-rs/pull/822 | ||
[#1057]: https://github.com/stackabletech/operator-rs/pull/1057 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This link reference is in the wrong place.
#[snafu(display( | ||
"failed to parse subject alternative DNS name \"{subject_alternative_dns_name}\" as a Ia5 string" | ||
))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Get rid of the escaped quotes.
#[snafu(display( | |
"failed to parse subject alternative DNS name \"{subject_alternative_dns_name}\" as a Ia5 string" | |
))] | |
#[snafu(display( | |
"failed to parse subject alternative DNS name {subject_alternative_dns_name:?} as a Ia5 string" | |
))] |
use super::*; | ||
|
||
const TEST_CERT_LIFETIME: Duration = Duration::from_hours_unchecked(1); | ||
const TEST_SAN: &str = "airflow-0.airflow.default.svc.cluster.local"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Can we use a non-product specific test value here? This comes to mind:
const TEST_SAN: &str = "airflow-0.airflow.default.svc.cluster.local"; | |
const TEST_SAN: &str = "example-0.example.default.svc.cluster.local"; |
ca.generate_rsa_leaf_certificate("Airflow", "pod", Duration::from_secs(3600)) | ||
.unwrap(); | ||
let cert = ca | ||
.generate_rsa_leaf_certificate("Airflow", "pod", [TEST_SAN], TEST_CERT_LIFETIME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: In a similar fashion, we should replace "Airflow" with "Example" here as well.
.unwrap(); | ||
let cert = ca | ||
.generate_rsa_leaf_certificate("Airflow", "pod", [TEST_SAN], TEST_CERT_LIFETIME) | ||
.expect("RSA certificate generation failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Nicely done!
note: The message should instead read why this will never fail.
); | ||
|
||
// Test SAN extension is present | ||
let extensions = cert.extensions.as_ref().expect("cert had no extension"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This should state why it should never fail. Something like this comes to mind:
let extensions = cert.extensions.as_ref().expect("cert had no extension"); | |
let extensions = cert.extensions.as_ref().expect("cert must have extensions"); |
assert_eq!( | ||
not_after | ||
.duration_since(not_before) | ||
.expect("Failed to calculate duration between notBefore and notAfter"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This should state why it should never fail.
Description
As #1044 didn't move along, splitting the relevant change out to unblock CRD versioning.
Definition of Done Checklist
Author
Reviewer
Acceptance