Skip to main content
To enable Keyless Authentication in GCP you’ll first need permissions to create service accounts and assign these accounts roles to GCP. The workflow to enable keyless authentication is:
  1. Create a service account with no permissions for federation.
  2. If you do not attach a service account to compute resources or use the default service account, we recommend creating a new service account for the compute resources. Create a service account to attach to compute resources and impersonate the federation service account.
  3. Create an authorization policy to allow the federation service account to authenticate to Endor Labs.
  4. Provision the compute resources with the appropriate permissions.
  5. Test Keyless authentication.

Create GCP service accounts and authorization policies

To create your service accounts, first export your GCP project name as an environment variable:
1

Create a federation service account

Create a federation service account called endorlabs-federation:
2

Create a compute service account

Create a keyless authentication service account to assign to compute resources called endorlabs-compute-service:
This is needed if you don’t already have service accounts for your compute resources. If you do, you need to modify the existing permissions to allow the existing service account to create a federation token.
3

Assign impersonation permissions

Assign the serviceAccountOpenIdTokenCreator role to the endorlabs-compute-service service account:
4

Create an authorization policy in Endor Labs

Use the following command to create an authorization policy to allow the endorlabs-federation account to authenticate to your Endor Labs tenant.
Replace <your-tenant> with your Endor Labs tenant name and <insert-your-project> with your GCP project name.
If you use Endor Labs with an EU tenant, use https://api.eu.endorlabs.com instead of https://api.endorlabs.com.
You’ve now set up the foundation of keyless authentication. You’ll now need to provision your compute resources with the appropriate GCP scopes and service account. See Provision and test keyless authentication for GKE workloads for instructions on setting up GKE for keyless authentication. See Provision and Test Keyless Authentication for GCP Virtual Machine Instances for instructions on setting up a virtual machine instance for keyless authentication.

Provision and test keyless authentication for GKE workloads

Prerequisites

The following prerequisites are required to setup keyless authentication on GKE workloads:

Procedure

The following instructions require you to export these environment variables:
1

Create a GKE cluster with workload identity

Optionally, create a GKE cluster with workload identity enabled if you do not already have one:
2

Authenticate to the GKE cluster

3

Create a namespace for Endor Labs scans

Optionally, create a dedicated namespace:
4

Create a Kubernetes service account

5

Bind the Kubernetes service account to your GCP compute service account

Replace <insert-your-project> with your GCP project name.
6

Annotate the Kubernetes service account

If you created a different service account name, replace endorlabs-compute-service with the appropriate name.
7

Test a scanning workload using keyless authentication

Run a test scan to confirm keyless authentication is working correctly.

Provision and Test Keyless Authentication for GCP Virtual Machine Instances

The following instructions require you to export the following environment variable:
1

Create a virtual machine instance with the appropriate scopes

2

Download and install endorctl on the virtual machine instance

SSH to the virtual machine instance:
Then download and install the latest version of endorctl. See our documentation for instructions on downloading the latest version.
3

Launch a test scan with keyless authentication

Use the --gcp-service-account flag for federated access to Endor Labs:
If this scan runs successfully you’ve tested and scanned a project with keyless authentication to Endor Labs.