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

security: new sub-package for certificate/key paths (cli refactor sequence 1/n) #82068

Merged
merged 4 commits into from
May 31, 2022

Conversation

knz
Copy link
Contributor

@knz knz commented May 30, 2022

Informs 82075.
PR split from #82020 to ease review.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz force-pushed the 20220528-certs1 branch from e1dbae4 to 0d9a1e0 Compare May 30, 2022 15:49
@knz knz requested review from otan and catj-cockroach May 30, 2022 15:49
@knz knz marked this pull request as ready for review May 30, 2022 15:50
@knz knz requested review from a team as code owners May 30, 2022 15:50
@knz knz force-pushed the 20220528-certs1 branch 2 times, most recently from 1732699 to bfa8d93 Compare May 30, 2022 16:02
Copy link
Contributor

@catj-cockroach catj-cockroach left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Reviewed 2 of 2 files at r1, 9 of 9 files at r2, 8 of 8 files at r3, 15 of 15 files at r4, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @otan)


pkg/security/certnames/certnames.go line 25 at r3 (raw file):

// IsCertificateFile returns true if the file name looks like a certificate file.
func IsCertificateFile(filename string) bool {

nit: I would argue this should be IsCertificateFilename rather than IsCertificateFile unless we're checking that the file has a PEM header.


pkg/security/certnames/locator.go line 22 at r4 (raw file):

// A Locator provides locations to certificates.
type Locator struct {

This is more for my curiosity rather than a request, but would it be difficult to move the certificate fallback logic into Locator?

Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @catj-cockroach and @otan)


pkg/security/certnames/certnames.go line 25 at r3 (raw file):

Previously, catj-cockroach (Cat J) wrote…

nit: I would argue this should be IsCertificateFilename rather than IsCertificateFile unless we're checking that the file has a PEM header.

Done.


pkg/security/certnames/locator.go line 22 at r4 (raw file):

Previously, catj-cockroach (Cat J) wrote…

This is more for my curiosity rather than a request, but would it be difficult to move the certificate fallback logic into Locator?

This new package is only interested in defining paths. In particular, it does not actually access the filesystem.

I think to do what you suggest we'll want to extract the fallback logic from CertificateManager into an actuall file access layer. It's a good idea (and on the way to solve #82075) but it's out of scope on the sequence of PRs that I'm currently working on (towards solving #81882).

@knz
Copy link
Contributor Author

knz commented May 30, 2022

(NB: Holding off on merging this despite the review approval, since we can't merge intermediate PRs in a sequence without dropping the entire sequence off github.)

@knz knz force-pushed the 20220528-certs1 branch from bf6c3c2 to bccde56 Compare May 30, 2022 18:02
@knz knz force-pushed the 20220528-certs1 branch 2 times, most recently from 0f5ba4f to 9a2e831 Compare May 31, 2022 11:49
knz added 4 commits May 31, 2022 13:50
The duplicated directive was making `dev generate bazel` unable to
keep the list of deps in sync.

Release note: None
We want to have the cert/key filenames in a package with minimal
dependencies, suitable for embedding in the lightweight SQL
executable. This commit starts the work by moving the file name
constants in a new separate package.

Release note: None
... since the function does not actually look at the contents of the
file.

Release note: None
@knz knz force-pushed the 20220528-certs1 branch from 9a2e831 to 8942085 Compare May 31, 2022 11:52
Copy link
Contributor

@catj-cockroach catj-cockroach left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r5, 8 of 8 files at r6, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @catj-cockroach)

Copy link
Contributor

@catj-cockroach catj-cockroach left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz)

@craig craig bot merged commit 8942085 into master May 31, 2022
@craig craig bot deleted the 20220528-certs1 branch May 31, 2022 18:49
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