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

[infra.ci.jenkins.io] Azure AD Password expired for terraform-production (jenkins-infra/azure) #4045

Closed
dduportal opened this issue Apr 16, 2024 · 7 comments

Comments

@dduportal
Copy link
Contributor

Service(s)

Azure, infra.ci.jenkins.io

Summary

The credentials used by infra.ci.jenkins.io to manage the Terraform project jenkins-infra/azure are expired: any job quickly fail on early Terraform phases when accessing the shared state with the following error:

Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "<redacted>": autorest/Client#Do: Preparing request failed: StatusCode=0 -- Original Error: clientCredentialsToken: received HTTP status 401 with response: {"error":"invalid_client","error_description":"AADSTS7000222: The provided client secret keys for app '<redacted>' are expired. Visit the Azure portal to create new keys for your app: https://aka.ms/NewClientSecret, or consider using certificate credentials for added security: https://aka.ms/certCreds. Trace ID: <redacted> Correlation ID: <redacted> Timestamp: 2024-04-16 10:37:34Z","error_codes":[7000222],"timestamp":"2024-04-16 10:37:34Z","trace_id":"<redacted>","correlation_id":"<redacted>","error_uri":"https://login.microsoftonline.com/error?code=7000222"}

Reproduction steps

No response

@dduportal dduportal added the triage Incoming issues that need review label Apr 16, 2024
@dduportal dduportal self-assigned this Apr 16, 2024
@dduportal dduportal added this to the infra-team-sync-2024-04-23 milestone Apr 16, 2024
@dduportal dduportal removed the triage Incoming issues that need review label Apr 16, 2024
@dduportal
Copy link
Contributor Author

Rotated credentials with the following change (private link): https://github.com/jenkins-infra/terraform-states/commit/bbab9fe5e97ce12d1bdcc9be5581941515e7dbe1

It involved:

=> we'll have to apply this change (rotation + expiry) to all the other projects in https://github.com/jenkins-infra/terraform-states

dduportal added a commit to jenkins-infra/azure that referenced this issue Apr 16, 2024
As per
jenkins-infra/helpdesk#4045 (comment),
the [name of the Azure SP used by Terraform in production for the
`azure`project
changed](jenkins-infra/terraform-states@bbab9fe)


This PR updates the code to maps this change

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
@dduportal
Copy link
Contributor Author

Update:

@dduportal
Copy link
Contributor Author

Next steps before closing:

  • As https://github.com/jenkins-infra/terraform-states/commit/bbab9fe5e97ce12d1bdcc9be5581941515e7dbe1 changed the terraform module used to set up the Terraform Shared Backends (for states), we have to apply the change to all project (and deploy the updated secret backend-config files to infra.ci)
  • The project jenkins-infra/azure-net also defines, like jenkins-infra/azure, a couple of Azure Service Principal: they need to be updated in the same way (with explicit expiration date)
  • We have to add the expiration dates to our shared calendar: even if notifications are not shared, we should have it as a strict minimum
  • Open an issue about how to run updatecli on the (private!) repository jenkins-infra/terraform-states to update the expiration dates + providers

@dduportal
Copy link
Contributor Author

dduportal commented Apr 17, 2024

  • As jenkins-infra/terraform-states@bbab9fe changed the terraform module used to set up the Terraform Shared Backends (for states), we have to apply the change to all project (and deploy the updated secret backend-config files to infra.ci)
  • The project jenkins-infra/azure-net also defines, like jenkins-infra/azure, a couple of Azure Service Principal: they need to be updated in the same way (with explicit expiration date)

Update: jenkins-infra/azure-net has been updated:

@dduportal
Copy link
Contributor Author

  • As jenkins-infra/terraform-states@bbab9fe changed the terraform module used to set up the Terraform Shared Backends (for states), we have to apply the change to all project (and deploy the updated secret backend-config files to infra.ci)
  • The project jenkins-infra/azure-net also defines, like jenkins-infra/azure, a couple of Azure Service Principal: they need to be updated in the same way (with explicit expiration date)

The other projects have been updated (jenkins-infra/aws, jenkins-infra/cloudflare, jenkins-infra/digitalocean and jenkins-infra/fastly). Note that jenkins-infra/datadog has NOT been updated: it appears that its state is NOT managed in jenkins-infra/terraform-states (most probably never migrated from legacy state).

Same method has been used:

@dduportal
Copy link
Contributor Author

We have to add the expiration dates to our shared calendar: even if notifications are not shared, we should have it as a strict minimum

Update: calendar events added. it won't 100% ensure we catch it before expiration but it is a start!

@dduportal
Copy link
Contributor Author

Open an issue about how to run updatecli on the (private!) repository jenkins-infra/terraform-states to update the expiration dates + providers

Issue opened: #4051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant