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

AUTH-296: certificate chains init refactoring #939

Merged

Conversation

stlaz
Copy link
Member

@stlaz stlaz commented Sep 8, 2022

This PR adds a refactoring of the current certificate initialization code.

The new code allows describing certificate chains by Go structures, feeding them into a builder object, and then creating them all at once once the developer is happy with what they have.

The new structure currently only allows to retrieve leaf certificate certs/key PEMs in a path-like manner, but might be extensible to perform queries on *x509.Certificate objects in the future, so as to allow for checking expirations and could be thus fed to a controller that is capable of handling rotations over the structure.

/cc @ibihim

@openshift-ci openshift-ci bot requested a review from ibihim September 8, 2022 09:44
@stlaz
Copy link
Member Author

stlaz commented Sep 8, 2022

The failures are appearing because the binaries are still being built with go 1.17, whereas my PR is using generics at a single spot, and go 1.17 does not know what to do about it, obviously.

@stlaz stlaz force-pushed the kubelet-client-bundle-refactoring branch from f17fca9 to 363be63 Compare September 8, 2022 10:18
@stlaz stlaz changed the title certificate chains init refactoring AUTH-296: certificate chains init refactoring Sep 8, 2022
@stlaz stlaz force-pushed the kubelet-client-bundle-refactoring branch from 363be63 to 9ba225d Compare September 8, 2022 13:39
We allow specifying the certificate information using Go structures
instead of additional code that goes a certificate signing at a time
and checking for errors.

All of the certificate chains can be created by using the builder
patter of the "certificateChains", where all the signing information
can be injected, and once everything is done, calling "Complete()"
attempts to build all the certificate chains specified.

The "CertificateChains" structure, which is a result of the previous
chain completion allows querying for certificate PEMs in a directory-like
manner.

Each of the signers provides information about its directly-signed
certificates and its sub-CAs. Signers don't allow retrieving their
keys directly as those should never be needed to be extracted anywhere
in the code.
@oglok
Copy link
Contributor

oglok commented Sep 13, 2022

I've had a look at this PR. I'd need a bit more of context from OpenShift cert management, but in general it looks good to me. I understand it generalizes the build of signers and client certificates. It works in my dev environment.

@ibihim is referenced in the PR, are we expecting him to review it too?

@stlaz
Copy link
Member Author

stlaz commented Sep 13, 2022

I'm ok with a single person review, I'd like to move on to using this code in new PRs.

@oglok
Copy link
Contributor

oglok commented Sep 13, 2022

/lgtm

@oglok
Copy link
Contributor

oglok commented Sep 13, 2022

/approve

@oglok oglok added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 13, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 13, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: oglok, stlaz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 57aff39 and 2 for PR HEAD d82a9f5 in total

@oglok
Copy link
Contributor

oglok commented Sep 13, 2022

/retest

@stlaz
Copy link
Member Author

stlaz commented Sep 14, 2022

/test periodics-images

@stlaz
Copy link
Member Author

stlaz commented Sep 14, 2022

/test e2e-openshift-conformance-sig-node

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 14, 2022

@stlaz: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit a338fc9 into openshift:main Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants