OIDC for GCP
What is OIDC GCP?
OIDC is a protocol and the best practice for secure authentication in GCP services.
Buddy supports OIDC and SSO login for Google cloud services integration, providing you with secure access management.
The following guide will walk you through the steps for setting up OIDC for your CI/CD pipelines.
OIDC provider configuration
- Sign to your Google Cloud Console and go to IAM & Admin.
- Switch to Workload Identity Federation and click +Create Pool:
Image loading...
- Enter the name and description and click Continue.
Switch the provider type to OpenID Connect (OIDC) and fill in the details:
- Provider name → e.g.
Buddy
- Provider URL →
https://oidc.buddyusercontent.com
(US accounts) orhttps://eu-oidc.buddyusercontent.com
(EU accounts)
- Provider name → e.g.
Image loading...
- Copy the audience URL and click Continue.
- Map the subject attribute to
assertion.sub
and the audience attribute toassertion.aud
and click Save to proceed.
Image loading...
Once added, click +Grant access and define the service account and principals for your pool.
When a pop-up appears, select the Service account. Then choose 'audience' in Principals, provide the value copied in point 5 and click Save:
Image loading...
A window will appear from which you can download the configuration file to client libraries. Set the provider to the one created earlier and fill in the details:
- OIDC ID token path →
/buddy
- Format type → text
- OIDC ID token path →
Image loading...
- Download the config file to finish.
Buddy configuration
- Sign in to your Buddy account and go to Integrations.
- Click New integration and select Google Cloud.
Define the integration details:
- enter the name and define the sharing scope
- switch the authorization method to OIDC
- enter the name of the project
- upload the JSON file as the Client Library Config
- paste the audience copied from the OIDC provider
Image loading...
- Click the button to finish configuration.
Restricting provider to integration
To restrict the provider to this integration, follow the next steps:
- Go to the created integration in Buddy and copy the Subject.
- Switch back to Google and go to Workload Identity Federation.
- Expand the pool that you configured beforehand, and click edit by the provider's name.
Image loading...
Add the following attribute condition:
google.subject == GOOGLE_INTEGRATION_SUBJECT
Image loading...
- Click Save to finish.
Narrowing restrictions
REF_NAME
to master
).
You can add more conditions if required. For example, if you want to restrict the integration to pipeline runs executed for the main branch in a specific project, you must map additional attributes for claims described in the OpenID claims.
Mappings:
attribute.repo
→assertion.PROJECT_NAME
attribute.branch
→assertion.REF_NAME
Conditions:
google.subject == GOOGLE_INTEGRATION_SUBJECT &&
attribute.repo == PROJECT_NAME &&
attribute.branch == REF_NAME &&
Image loading...
Once the integration configuration has been completed, you can begin to deploy software with CI/CD pipelines in Buddy and Google services.
Last modified on Sep 23, 2024