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

add provider ca auth-method support for azure #16298

Merged
merged 4 commits into from
Mar 1, 2023

Conversation

eikenb
Copy link
Contributor

@eikenb eikenb commented Feb 17, 2023

Does the required dance with the local HTTP endpoint to get the required data for the jwt based auth setup in Azure. Keeps support for 'legacy' mode where all login data is passed on via the auth methods parameters.

PR Checklist

@eikenb eikenb added type/enhancement Proposed improvement or new feature theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/consul-vault Relating to Consul & Vault interactions labels Feb 17, 2023
@kisunji kisunji changed the title add provicer ca auth-method support for azure add provider ca auth-method support for azure Feb 23, 2023
@eikenb eikenb force-pushed the eikenb/azure-vault-provider-auth branch from a56a083 to 5f4e781 Compare February 23, 2023 21:20
Copy link
Contributor

@cthain cthain left a comment

Choose a reason for hiding this comment

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

Good stuff John 👍

.changelog/16298.txt Show resolved Hide resolved

// Checks to see if all the parameters needed to login have been hardcoded in the
// auth-method's config Parameters field.
func legacyCheck(params map[string]any) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like the func name legacyCheck.. there is already a function called containsVaultLoginParams that has some overlap with this method.. What do you think about consolidating these two functions?

Copy link
Contributor Author

@eikenb eikenb Feb 24, 2023

Choose a reason for hiding this comment

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

Right, it is basically the same function just passing in the list of keys. I'll replace containsVaultLoginParams with legacyCheck (adding the expectedKeys as an arg) and update the AWS/GCP plugins to us it. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noticed they have a key difference in testing... the containsVaultLoginParams returns true when it finds any of the hardcoded /login values where legacyCheck only returns true if all of them are present. In the case of Azure they are all required for it to work, were AWS/GCP different or did you go with the idea that if they had any of the /login fields it meant they were using that path and can return early?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, exactly.. My thought was that if any of the /login args are present, then the user has most likely configured the CA provider for a direct login.. I think that it's reasonable for the func to check for all required args before returning true since most folks will probably want to use new auto auth config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @cthain, I'll go with all fields required then and make those changes.

Copy link
Contributor Author

@eikenb eikenb Feb 28, 2023

Choose a reason for hiding this comment

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

Started looking at updating AWS to this and it has multiple different ways of calling /login with different sets of parameters, thus there is no 1 set of required parameters to check.

So I'm flip-flopping on this and will make it use 'legacy mode' if it detects any of the 'legacy' or hard coded /login fields. Going to re-review my uses to make sure none of them have fields that overlap with non-/login-hack uses. (eg. role in azure is required for /login but also required for proper config)

Does the required dance with the local HTTP endpoint to get the required
data for the jwt based auth setup in Azure. Keeps support for 'legacy'
mode where all login data is passed on via the auth methods parameters.
New, improved name and used in more places.
@eikenb eikenb force-pushed the eikenb/azure-vault-provider-auth branch from 5f4e781 to 7fe2c8e Compare February 28, 2023 20:16
@eikenb eikenb merged commit 4f2d9a9 into main Mar 1, 2023
@eikenb eikenb deleted the eikenb/azure-vault-provider-auth branch March 1, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/consul-vault Relating to Consul & Vault interactions type/enhancement Proposed improvement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants