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

AccessKey credentials are reset on every cluster creation #637

Open
jbpratt opened this issue Mar 9, 2022 · 13 comments
Open

AccessKey credentials are reset on every cluster creation #637

jbpratt opened this issue Mar 9, 2022 · 13 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@jbpratt
Copy link
Contributor

jbpratt commented Mar 9, 2022

Access keys are being reset on every rosa create cluster ... call such that subsequent calls (rosa list clusters) failed due to invalid credentials. These credentials are also used when working with the ocm CLI so it is causing issues for my team since we store these. Would it be possible to not upsert the access keys on cluster creation or perhaps suggest an alternative workflow? cc'ing @jharrington22 since they wrote the code and explanation.

rosa/pkg/aws/client.go

Lines 471 to 494 in 7b3efee

// GetAWSAccessKeys uses UpsertAccessKey to delete and create new access keys
// for `osdCcsAdmin` each time we use the client to create a cluster.
// There is no need to permanently store these credentials since they are only used
// on create, the cluster uses a completely different set of IAM credentials
// provisioned by this user.
func (c *awsClient) GetAWSAccessKeys() (*AccessKey, error) {
if c.awsAccessKeys != nil {
return c.awsAccessKeys, nil
}
accessKey, err := c.UpsertAccessKey(AdminUserName)
if err != nil {
return nil, err
}
err = c.ValidateAccessKeys(accessKey)
if err != nil {
return nil, err
}
c.awsAccessKeys = accessKey
return c.awsAccessKeys, nil
}

❯ rosa list clusters
E: Failed to create AWS client: InvalidClientTokenId: The security token included in the request is invalid.
	status code: 403, request id: 77591dc5-8d54-4282-9ec9-b20xyzabc658eb
@yuwang-RH
Copy link
Member

@jbpratt I think this issue will not happen if you configure aws credential with another aws user rather than the 'osdCCSadmin' user credential.

@yuwang-RH
Copy link
Member

@jbpratt I have opened a JIRA issue about this, https://issues.redhat.com/browse/SDA-5644

@jbpratt
Copy link
Contributor Author

jbpratt commented Mar 16, 2022

thanks for that @yuwang-RH, I think an issue with using another user is that OCM utilizes this user, so while subsequent calls to ROSA stop working, OCM does as well. According to the docs, this is the user to use. (Note: we are trying to use OCM and ROSA in the same account)

@arendej
Copy link
Contributor

arendej commented Mar 16, 2022

I don't mean to side-track the issue, but, why not use STS mode?

@jbpratt
Copy link
Contributor Author

jbpratt commented Mar 21, 2022

Hey @arendej , thanks for the recommendation, I will need to look more into it. I think even if we use an alternate auth method, the credentials are still rotated which causes issues with the ocm cli.

@jbpratt
Copy link
Contributor Author

jbpratt commented Mar 23, 2022

Hey @arendej what are your thoughts on the rosa CLI upsert conflicting with the ocm CLI? Maybe I'm doing something wrong but it seems I can't easily work with both tools in the same account.

edit: maybe if I'm using STS mode then the credentials don't get upserted? I'm looking into this now

@jbpratt
Copy link
Contributor Author

jbpratt commented Mar 23, 2022

that is exactly what it is! 😺 thank you very much @arendej and @yuwang-RH ! STS mode doesn't upsert the creds 👍

@jbpratt
Copy link
Contributor Author

jbpratt commented May 12, 2022

Going to re-open this issue, various code paths (rosa init?) seem to reset credentials which is causing issues with our OSD deployments.

@jbpratt jbpratt reopened this May 12, 2022
@trepel
Copy link

trepel commented Jun 13, 2022

Hey, I encountered this issue too. STS is not an option for us since our product does not support STS just yet. If you create a ROSA cluster in certain aws account (not matter what aws user is used) the ROSA cli upsert the osdCcsAdmin's credentials. In order to use the aws account for "standard" OSD creation one has to create a new keypair for osdCcsAdmin first which is not really feasible for automation.

@mrrajan
Copy link

mrrajan commented Jul 25, 2022

Hi, I have faced encountered this as well. For each ROSA cluster creation, the existing osdCcsAdmin aws access keys pairs are removed and this impacts the usage of access key pairs in other parts of automation to provision OSD clusters.

@jbpratt
Copy link
Contributor Author

jbpratt commented Sep 20, 2022

Hey @arendej, are there any plans to resolve this problem? It seems this issue is leaking into other features as well cc @oriAdler 1299a60

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 20, 2022
@jbpratt
Copy link
Contributor Author

jbpratt commented Dec 20, 2022

/lifecycle frozen

@openshift-ci openshift-ci bot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

6 participants