Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Add Identity Provider CA to kubeconfig #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vijaykatam
Copy link

This change enables usage of self signed cert for the IdP by providing
a config idpCAPath in the config map.

Signed-off-by: Vijay Katam [email protected]

Closes: #148

This change enables usage of self signed cert for the IdP by providing
a config `idpCAPath` in the config map.

Closes: vmware-archive#148

Signed-off-by: Vijay Katam <[email protected]>
@@ -63,7 +63,8 @@ kubectl config set-credentials "{{ .KubeCfgUser }}" \
--auth-provider-arg='client-id={{ .ClientID }}' \
--auth-provider-arg='client-secret={{ .ClientSecret }}' \
--auth-provider-arg='refresh-token={{ .RefreshToken }}' \
--auth-provider-arg='id-token={{ .IDToken }}'
--auth-provider-arg='id-token={{ .IDToken }}' \
--auth-provider-arg='idp-certificate-authority-data={{ .IdentityProviderCA }}' \
Copy link
Author

Choose a reason for hiding this comment

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

If idp-certificate-authority-data is empty it is ignored.

Copy link
Contributor

@jenting jenting left a comment

Choose a reason for hiding this comment

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

Comment left.

if cfg.IdentityProviderCAPath != "" {
caFile, err := os.Open(cfg.IdentityProviderCAPath)
if err != nil {
log.Errorf("Failed to open CA file. %s", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Errorf("Failed to open CA file. %s", err.Error())
log.Errorf("Failed to open CA file. %s", err)

defer caFile.Close()
idpCA, err := ioutil.ReadAll(caFile)
if err != nil {
log.Errorf("Could not read CA file: %s", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Errorf("Could not read CA file: %s", err.Error())
log.Errorf("Could not read CA file: %s", err)

Comment on lines +302 to +304
log.Errorf("Could not read CA file: %s", err)
http.Error(w, "Could not read CA file", http.StatusInternalServerError)
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This change make go test failed. Consider leave it as it was or update the testing code.


# The path to find the CA bundle for the IdP, optional. Used to configure kubectl.
# Env var: GANGWAY_IDP_CA_PATH
# idpCAPath: "/cacerts/idpca.cert"
Copy link
Contributor

Choose a reason for hiding this comment

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

configuration doc should be updated also.

@jenting
Copy link
Contributor

jenting commented Jun 30, 2020

From my point of view, IdentityProviderCA is the same as TrustedCAPath since it should both points the same server, am I right?

If yes, then all we have to do is embed the TrustedCA into idp-certificate-authority-data. WDYT?

@echupriyanov
Copy link

Any plans to finish this PR?

@stevesloka
Copy link
Contributor

Hey @vijaykatam would you mind rebasing this as well as looking at the comments + failing tests? Thanks!

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.

Enable use of self signed cert for Identity Provider
4 participants