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

cli: add --cert-principal-map to cert list command #48013

Merged
merged 2 commits into from
Apr 24, 2020

Conversation

petermattis
Copy link
Collaborator

Remove the use of base.Config.GetCertificateManager() from the cert list implementation as a first step in limiting use of that method, and
possibly removing it in the future.

Fixes #48011

Release note (cli change): Support list cert with certificates which
require --cert-principal-map to pass validation.

@petermattis petermattis requested a review from a team as a code owner April 24, 2020 12:43
@petermattis petermattis requested a review from knz April 24, 2020 12:43
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@petermattis
Copy link
Collaborator Author

This is an intermediate step towards moving Config.GetCertificateManager() to a more server-specific bit of code, and generally providing a cleaner separation between client cert handling and server cert handling. I don't quite have the plan for how that will be achieved as this stuff is all intricately woven together right now.

Copy link
Contributor

@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.

LGTM modulo the default initialization

Reviewed 4 of 4 files at r1, 2 of 2 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @aaron-crl and @petermattis)


pkg/cli/context.go, line 400 at r1 (raw file):

// Defaults set by InitCLIDefaults() above.
var certCtx struct {
	certPrincipalMap []string

you should reset this at the top in initCLIDefaults()


pkg/server/server.go, line 206 at r2 (raw file):

	// Attempt to load TLS configs right away, failures are permanent.
	if !cfg.Insecure {

I think this change makes this PR fix #17194 - WDYT?

Remove the use of `base.Config.GetCertificateManager()` from the `cert
list` implementation as a first step in limiting use of that method, and
possibly removing it in the future.

Fixes cockroachdb#48011

Release note (cli change): Support `list cert` with certificates which
require `--cert-principal-map` to pass validation.
Remove `base.Config.InitializeNodeTLSConfigs` and inline its
functionality in `server.NewServer`. This is another step in an effort
to isolate usage of `CertificateManager` to server related code.

Unexport some methods of `base.Config` that were not used externally.

Release note: None
Copy link
Collaborator Author

@petermattis petermattis 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 @aaron-crl and @knz)


pkg/cli/context.go, line 400 at r1 (raw file):

Previously, knz (kena) wrote…

you should reset this at the top in initCLIDefaults()

Done.


pkg/server/server.go, line 206 at r2 (raw file):

Previously, knz (kena) wrote…

I think this change makes this PR fix #17194 - WDYT?

I'm not seeing why this PR would fix #17194. The code here is intended to be identical to what was previously being done. Note that InitializeNodeTLSConfigs already had a if cfg.Insecure check. Am I missing something? I'm not actually sure what the problem is in #17194.

Copy link
Contributor

@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.

Reviewed 1 of 3 files at r3, 2 of 2 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @aaron-crl and @petermattis)


pkg/server/server.go, line 206 at r2 (raw file):

Previously, petermattis (Peter Mattis) wrote…

I'm not seeing why this PR would fix #17194. The code here is intended to be identical to what was previously being done. Note that InitializeNodeTLSConfigs already had a if cfg.Insecure check. Am I missing something? I'm not actually sure what the problem is in #17194.

Yes sorry I misread the call point.

The problem in #17194 is that the node certs should be checked to include the listen addr upon startup, not merely when another node tries to join. But I agree it's unrelated here.

@petermattis
Copy link
Collaborator Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 24, 2020

Build succeeded

@craig craig bot merged commit e438f1a into cockroachdb:master Apr 24, 2020
@petermattis petermattis deleted the pmattis/list-certs branch April 24, 2020 17:42
spaskob pushed a commit to spaskob/cockroach that referenced this pull request Apr 24, 2020
48013: cli: add --cert-principal-map to `cert list` command r=petermattis a=petermattis

Remove the use of `base.Config.GetCertificateManager()` from the `cert
list` implementation as a first step in limiting use of that method, and
possibly removing it in the future.

Fixes cockroachdb#48011

Release note (cli change): Support `list cert` with certificates which
require `--cert-principal-map` to pass validation.

Co-authored-by: Peter Mattis <petermattis@gmail.com>
andreimatei added a commit to andreimatei/cockroach that referenced this pull request Apr 24, 2020
This reverts commit e438f1a, reversing
changes made to 0dfff21.
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.

cli: cert list needs to be provided --cert-principal-map
3 participants