Skip to content

Allow the use of custom CA Certificates#162

Closed
GauntletWizard wants to merge 4 commits intoauthzed:mainfrom
GauntletWizard:ted/cacert
Closed

Allow the use of custom CA Certificates#162
GauntletWizard wants to merge 4 commits intoauthzed:mainfrom
GauntletWizard:ted/cacert

Conversation

@GauntletWizard
Copy link
Copy Markdown

This allows the use of a custom CA Pool/TrustBundle via the cafile flag. Starts on #161, but does not support contexts, which would presumably want to embed the ca pool in the context secret.

The decision to use cafile for the flag name was based on curl, but kubectl calls it --certificate-authority and I've seen others.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 15, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@GauntletWizard
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Signed-off-by: Thomas Hahn <Thahn@tcbtech.com>
Copy link
Copy Markdown
Member

@jzelinskie jzelinskie left a comment

Choose a reason for hiding this comment

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

I think --certificate-path might be the best name for this flag.

}

if cobrautil.MustGetBool(cmd, "insecure") && cobrautil.MustGetString(cmd, "cafile") != "" {
panic("cafile flag cannot be combined with insecure")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should definitely be checked somewhere else and return an error rather than panicking.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't seen an obvious place to put a "verify flags" precondition; I'm not that familiar with Cobra

Copy link
Copy Markdown
Member

@jzelinskie jzelinskie Jan 6, 2023

Choose a reason for hiding this comment

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

Yeah, that's pretty fair -- I think we should just ignore the CA flag if the insecure flag is set. The insecure flag description is "connect over a plaintext connection", so if you specify it, that's what we should do.

The real problem is that the grpcutil library panics if it cannot find a CA rather than returning an error.
I'll fix things upstream to improve the situation.

@jzelinskie
Copy link
Copy Markdown
Member

jzelinskie commented Jan 12, 2023

Closed in favor of #183.

Let me know if there's anything missing so that we can follow-up.

Thanks again for pushing this forward.

@jzelinskie jzelinskie closed this Jan 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants