Identity and access management
F5 NGINXaaS for Google Cloud (NGINXaaS) uses Workload Identity Federation (WIF) to integrate with Google Cloud services. For example, with WIF configured, your NGINXaaS deployment can perform the following integrations:
- export logs to Cloud Logging
- export metrics to Cloud Monitoring
- fetch secrets from Secret Manager
To learn more, see Google’s Workload Identity Federation documentation.
- In the project you’re configuring WIF in, you need the following roles to create a workload identity pool, provider, and policy bindings:
- An NGINXaaS deployment. See our documentation on creating an NGINXaaS deployment for a step-by-step guide.
- Create a workload identity pool. See Google’s documentation on configuring Workload Identity Federation for a step-by-step guide.
- Create an OIDC workload identity pool provider. See Google’s documentation on creating a workload identity pool provider for a step-by-step guide. Set up the provider settings as follows:
Issuer URLmust behttps://accounts.google.com.Allowed audiencesmust contain the full canonical resource name of the workload identity pool provider, for example,https://iam.googleapis.com/projects/<project-number>/locations/<location>/workloadIdentityPools/<pool-id>/providers/<provider-id>. IfAllowed audiencesis empty, the full canonical resource name of the workload identity pool provider will be included by default.- Add the following attribute mapping:
google.subject=assertion.sub. - Add the following attribute condition:
assertion.sub=='$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID', where$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_IDis the unique ID of your NGINXaaS deployment’s service account. This ID can be found in theF5 NGINXaaS Service Account Unique IDfield under the Cloud Info section in the Details tab of your deployment.
Depending on your use case, you will need to grant certain roles on specific resources. See Google’s documentation on granting access for more information.
Grant access to export logs to a Google project
To grant access to export logs to a Google project, $LOG_PROJECT_ID, in the Google Cloud Console,
- Go to the
$LOG_PROJECT_IDproject. - Go to the IAM page.
- Select Grant Access.
- Enter your principal, for example,
principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID. - Assign the Logs Writer role.
Alternatively, to use the Google Cloud CLI, you can run the following gcloud command.
gcloud projects add-iam-policy-binding "$LOG_PROJECT_ID" \
--member="principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID" \
--role='roles/logging.logWriter'Grant access to export metrics to a Google project
To grant access to export metrics to a Google project, $METRIC_PROJECT_ID in the Google Cloud Console,
- Go to the
$METRIC_PROJECT_IDproject. - Go to the IAM page.
- Select Grant Access.
- Enter your principal, for example,
principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID. - Assign the Monitoring Metric Writer role.
Alternatively, to use the Google Cloud CLI, you can run the following gcloud command.
gcloud projects add-iam-policy-binding "$METRIC_PROJECT_ID" \
--member="principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID" \
--role='roles/monitoring.metricWriter'Grant access to fetch a secret from Secret Manager
To grant access to fetch a secret, $SECRET_ID, in the Google Cloud Console,
- Go to the secret,
$SECRET_ID, in Secret Manager. - Select the Permissions tab.
- Select Grant Access.
- Enter your principal, for example,
principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID. - Assign the Secret Manager Secret Accessor role.
Alternatively, to use the Google Cloud CLI, you can run the following gcloud command.
gcloud secrets add-iam-policy-binding "$SECRET_ID" \
--member="principal://iam.googleapis.com/projects/$WIF_PROJECT_NUMBER/locations/global/workloadIdentityPools/$WIF_POOL_ID/subject/$NGINXAAS_SERVICE_ACCOUNT_UNIQUE_ID" \
--role='roles/secretmanager.secretAccessor'If you have more than one secret that you would like fetched, you will need to grant access on each secret or grant access on the project your secrets are in.
In the NGINXaaS Console,
- On the navigation menu, select Deployments.
- Select the deployment you want to update and select Edit.
- Enter your provider name, for example,
projects/<project-number>/locations/<location>/workloadIdentityPools/<pool-id>/providers/<provider-id>, under Workload Identity Pool Provider Name. - Select Update.