This document describes how to configure certificate-based access for Workload Identity Federation using X.509 certificates.
Certificate-based access uses Mutual TLS (mTLS) to authenticate both the client and server during a TLS handshake. In this process, an mTLS binding incorporates policies based on the transport context and uses the state of the client's certificate within the TLS session to make authorization decisions.
For X.509 workload identity federation, an mTLS binding ensures that the entire authentication flow is securely tied to a trusted workload. This mitigates the risk of credential theft, because the authentication is bound to a specific, trusted endpoint.
Certificate-based access for Workload Identity Federation configuration overview
The following provides a high-level overview of the process to configure certificate-based access for Workload Identity Federation:
Establish a workload identity federation by configuring trust with the X.509 certificates' trust anchor.
Create an access level for certificate-based access.
Add the access level to a Context-Aware Access policy that enforces the mTLS binding.
Before you begin
Verify that you have the following prerequisites:
The latest version of the Google Cloud CLI
To update to the latest version of the Google Cloud CLI, run the following command:
gcloud components updateIf you need to install the Google Cloud CLI, see Install the Google Cloud CLI.
A Workload Identity Federation configuration that uses your X.509 certificates trust anchor
To use this feature, complete the following form to be added to an allowlist: Allowlist request form. You will be contacted after you are added to the allowlist.
Create an access level for certificates
Create an mTLS access level. The mTLS access level validates certificates when determining access to resources.
Console
In Access Context Manager, create a custom access level and enter the following expression in the CEL expression field:
request.auth.matchesMtlsTokens(origin) == true.gcloud
To create a custom access level, run the following command:
gcloud access-context-manager levels create ACCESS_LEVEL_NAME \ --title=TITLE \ --custom-level-spec=FILE \ --description=DESCRIPTION \ --policy=POLICY_NAME
Replace the following: