Google Cloud Identity-Aware Proxy (IAP) can replace VPNs and bastion hosts with per-request identity checks, but only if nothing can reach the backend except through IAP and the application verifies what IAP tells it. Teams turn IAP on in front of an internal tool, then leave a firewall rule that lets any VM in the VPC reach the backend port, keep the Cloud Run run.app URL open, or trust an x-goog-authenticated-user-email header an attacker can forge once IAP is bypassed. This guide covers IAP for HTTPS applications and IAP TCP forwarding for SSH, RDP and other ports, including on-premises targets through tunnel destination groups. It explains the IAM roles, context-aware access with access levels, reauthentication, programmatic access by service accounts, signed header verification and logging. It is for Google Cloud platform engineers and security architects replacing bastions or VPN access. For the general zero trust access model, read the ZTNA Guide first.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- IAP is only as strong as the bypass paths you close. Restrict backend firewall rules to load balancer traffic, disable or restrict Cloud Run default URLs, and remember that code on the same VM can always reach the port.
- Verify the signed JWT, not the email header. Applications should validate
x-goog-iap-jwt-assertion(ES256,isshttps://cloud.google.com/iap, the correctaud) and use itssubandemailclaims. - TCP forwarding replaces bastions. Allow ingress only from
35.235.240.0/20on the ports you need, remove external IPs, and grantroles/iap.tunnelResourceAccessorper instance or withdestination.portconditions. - Context comes from access levels. Bind
roles/iap.httpsResourceAccessorwith a condition onrequest.auth.access_levels; device-based levels need a Chrome Enterprise Premium licence. - Owners and Editors still matter. Owner can change IAP access policies and use TCP forwarding; Editor can switch IAP off. Use IAP Policy Admin for policy management and alert on IAP setting changes.
How identity and access work in Identity-Aware Proxy
IAP sits in Google's serving path. For each request it authenticates the user, then checks IAM on the IAP-secured resource before the request reaches your backend.
| Resource type | How IAP is attached | Main bypass path to close |
|---|---|---|
| App Engine | IAP enabled on the app, service or version | Ingress settings that expose the app another way |
| Cloud Run | Directly on the service (covers all ingress paths) or through a load balancer with a serverless backend | The default run.app URL when IAP is only on the load balancer; Google does not recommend enabling IAP on both |
| Compute Engine and GKE | Backend service of an external or internal HTTP(S) load balancer | Firewall rules allowing other VMs or the internet to reach the backend port directly |
| VMs over TCP (SSH, RDP, other ports) | IAP TCP forwarding from Google's range 35.235.240.0/20 (IPv6 2600:2d00:1:7::/64) | External IPs or broad firewall rules left in place |
| On-premises or other cloud hosts over TCP | Tunnel destination groups reached over Cloud VPN or Cloud Interconnect | Direct routes into the private network that bypass IAP |
Authentication sources
- Browser users: Google accounts, Workforce Identity Federation or Identity Platform (for customer-facing apps). IAP stores a session cookie after sign-in.
- OAuth client: enabling IAP creates an OAuth 2.0 client ID and secret. Deleting them breaks IAP, so protect them from cleanup scripts.
- Programmatic callers: service accounts present an OIDC ID token or a signed service account JWT; user accounts from desktop apps use a desktop OAuth client. Programmatic user access works only with Google identities, not Identity Platform or Workforce Identity Federation.
What IAP does not do
IAP authorises requests to supported entry points. It does not inspect traffic between VMs inside the project, does not authorise actions inside the application, and does not replace application-level authorisation. A user with httpsResourceAccessor reaches the whole application unless IAM conditions restrict host or path.
Admin roles and privileged access
| Role | Role ID | Grants | Notes |
|---|---|---|---|
| IAP-Secured Web App User | roles/iap.httpsResourceAccessor | Access to IAP-secured HTTPS resources | Grant per backend service or Cloud Run service rather than project-wide |
| IAP-Secured Tunnel User | roles/iap.tunnelResourceAccessor | iap.tunnelInstances.accessViaIAP and iap.tunnelDestGroups.accessViaIAP | Grant per instance or destination group; tags are not supported for granting it |
| IAP Policy Admin | roles/iap.admin | Manage IAP access policies, including destination group IAM | Use instead of Owner for policy management |
| Tunnel destination group editor | iap.tunnelDestGroupEditor | Create and change destination groups (which CIDRs and FQDNs are reachable) | Effectively network reachability control; keep to the network team |
| Owner | roles/owner | Same policy rights as IAP Policy Admin, and can use TCP forwarding | Does not by itself grant web app access |
| Editor | roles/editor | Can turn IAP on or off; cannot modify access policies | Turning IAP off on a resource with open backends exposes it |
Securing SSH and RDP through IAP
- Tunnel permission is not login permission: IAP decides who can open the tunnel; the VM still authenticates the user. Combine IAP with OS Login so SSH access is also tied to IAM, rather than metadata SSH keys. Without OS Login,
gcloud compute sshneeds metadata-writing permissions such ascompute.instances.setMetadata, which are powerful in their own right. See the SSH Key Management Guide. - Restrict by port and target: use IAM conditions on
destination.ipanddestination.port, for example allowing only port 22 for Linux operators and 3389 for Windows administrators. See the Remote Desktop (RDP) Security Guide. - Force the tunnel:
gcloud compute ssh --tunnel-through-iapforces IAP, and VMs without an external IP use it automatically.--internal-ipbypasses IAP and should fail by design if firewalls are right. - Session limits: IAP disconnects TCP sessions after one hour of inactivity and may rate-limit bulk transfer; it is not a file transfer channel.
- Make access just-in-time: grant tunnel roles with time-bound IAM conditions or through an approval workflow rather than permanently. See the JIT Access Guide.
Integrations, API tokens and service accounts
Context-aware access
- Access levels: created in Access Context Manager in the organisation's access policy (use the organisation-level policy, and confirm current options with Google). Levels can test IP ranges and, with Chrome Enterprise Premium, device attributes such as management state or encryption.
- Binding: add a conditional binding of
roles/iap.httpsResourceAccessorwith a condition such as"accessPolicies/ORG_NUMBER/accessLevels/corp_devices" in request.auth.access_levels, optionally combined with host or path checks. One condition per binding; gcloud supports only project-level conditional bindings, so use the console or API for app-level ones. - Public bindings: bindings to
allUsersorallAuthenticatedUserscannot carry conditions, so a path-scoped "public" area has to be handled differently. - Reauthentication:
reauthSettingsin IapSettings forces periodic reauthentication withmaxAge(minimum 300 seconds) and a method of LOGIN, ENROLLED_SECOND_FACTORS or SECURE_KEY. MINIMUM policy type merges with parent settings, taking the shorter duration and stronger method. It applies to browser flows only: service accounts and IAP-TCP are exempt, as are Workforce Identity Federation and external identities.
Service accounts calling IAP-protected apps
| Method | Audience | Required role | Security notes |
|---|---|---|---|
| OIDC ID token | OAuth client ID of the IAP resource | roles/iam.serviceAccountOpenIdTokenCreator when impersonating another account | Token must carry an email claim; client ID must be allowlisted for programmatic access |
| Service account JWT | Resource URL, exact or with /* | roles/iam.serviceAccountTokenCreator, granted on the target service account, not the project | Lifetime up to 3600 seconds; sign through the IAM Credentials signJwt API instead of a local key file |
| User ID token from desktop app | Allowlisted desktop OAuth client | User holds httpsResourceAccessor | Refresh tokens cannot satisfy access level policies; full reauthentication required |
Tokens go in Authorization: Bearer, or in Proxy-Authorization: Bearer when the application needs its own Authorization header; IAP strips Proxy-Authorization before forwarding. Prefer keyless signing and workload identity; a downloaded service account key that can mint IAP tokens is a portable credential for every app it can reach (ATT&CK T1550.001 Application Access Token). See the Google Cloud Service Account Keys Security Guide.
Verifying signed headers in the application
- Read
x-goog-iap-jwt-assertionand reject requests without it. - Check the header algorithm is ES256 and the
kidmatches a key fromhttps://www.gstatic.com/iap/verify/public_key-jwk; cache and refresh keys, because IAP rotates them. - Check
issequalshttps://cloud.google.com/iap,expandiatwithin 30 seconds of skew, andaudequals the exact value for your backend, for example/projects/PROJECT_NUMBER/global/backendServices/SERVICE_IDor/projects/PROJECT_NUMBER/locations/REGION/services/SERVICE_NAME. - Use the token's
subandemailclaims as the identity, never the unsignedx-goog-authenticated-user-*headers.
Google's stated reason for this check is defence against IAP being disabled, misconfigured firewalls and access from inside the project. See the JWT Security Guide.
Logging and detection
| Event | Where it appears | Detection use |
|---|---|---|
| IAP access policy changed | Admin Activity: IdentityAwareProxyAdminService.SetIamPolicy | New principal granted app or tunnel access |
| IAP settings or reauth changed | Data Access: UpdateIapSettings | Reauthentication relaxed or access settings altered |
| Destination groups created or changed | Data Access: CreateTunnelDestGroup, UpdateTunnelDestGroup, DeleteTunnelDestGroup | New on-premises ranges made reachable |
| Access decisions | IAP Data Access logs: authorizationInfo.granted, requestMetadata.callerIp, requestAttributes | Denied bursts, access from unusual IPs, access levels met |
| IAP turned off or backend changed | Admin Activity on the backend service or Cloud Run service | Exposure window if backends are open |
| Firewall rules opening backend ports | Admin Activity on compute.firewalls | New bypass path; source ranges other than LB and IAP ranges |
- Enable Data Access logs for IAP: access decisions and most configuration reads and writes are Data Access, which is off by default in Google Cloud. Query with
protoPayload.serviceName="iap.googleapis.com". See the Google Cloud Audit Logs and Log Sinks Guide. - Access levels in logs: logs list only the levels a user met, not the ones that blocked them, so compare against the resource's required levels during investigations.
- Relevant ATT&CK techniques: T1133 External Remote Services (IAP tunnels as the remote access path), T1021.004 SSH and T1021.001 Remote Desktop Protocol for what happens after the tunnel, T1078.004 Cloud Accounts for stolen identities used through IAP.
Metrics that show it is working
- Bastion and VPN retirement: number of VMs with external IPs or bastion hosts remaining in scope (trend to zero).
- Bypass exposure: firewall rules allowing backend or admin ports from sources other than the load balancer or
35.235.240.0/20(target zero). - Signed header adoption: percentage of IAP-protected applications that validate the JWT.
- Standing tunnel access: principals with permanent project-level
tunnelResourceAccessor(trend down). - Context coverage: percentage of sensitive apps with an access level condition and reauthentication policy.
Hardening baseline
- Close every bypass: backend firewall rules allow only the load balancer health check and proxy ranges; admin ports allow only
35.235.240.0/20; Cloud Run services fronted by a load balancer use ingress set to internal and load balancer traffic, or have IAP enabled directly on the service. - Remove external IPs: enforce with the
constraints/compute.vmExternalIpAccessorganisation policy. See the Google Cloud Organization Policy Guide. - Grant narrowly: web access per backend or service, tunnel access per instance or destination group with port conditions, never to
allAuthenticatedUsers. - Use OS Login for SSH targets and Windows credentials management for RDP targets behind IAP.
- Context and reauth: access levels for sensitive apps, reauthentication with ENROLLED_SECOND_FACTORS or SECURE_KEY for administrative and confidential apps.
- Validate signed headers in every application, with the audience pinned.
- Policy ownership: IAP Policy Admin for a small group, Owner and Editor removed from production projects where possible.
- Logging: IAP Data Access logs on, routed to the central sink, with alerts on policy and destination group changes.
Phased rollout: replacing a bastion
- Inventory: list bastions, VPN groups and VMs with external IPs; record who connects to what, on which ports.
- Prepare targets: enable OS Login, add the firewall rule from
35.235.240.0/20on required ports, and keep the bastion running in parallel. - Grant and pilot: give a pilot group
tunnelResourceAccessoron specific instances with port conditions; testgcloud compute ssh --tunnel-through-iapandstart-iap-tunnelfor RDP. - Add context: add an access level condition for managed devices or corporate IP ranges and confirm denials appear in logs.
- Cut over: remove external IPs and the bastion's firewall rules, then decommission the bastion. For on-premises hosts, create destination groups and advertise
35.235.240.0/20on the Cloud Router so return traffic uses VPN or Interconnect. - Roll back: restore the bastion firewall rule from change records; IAP grants can stay in place while you fix issues.
Decision guidance
- IAP vs a third-party ZTNA: IAP is native for Google Cloud resources and hybrid hosts reachable over Interconnect or VPN, with IAM as the policy engine. A multi-cloud estate with many non-Google targets may prefer a provider-neutral ZTNA broker; the bypass and header verification lessons apply to both.
- IAP on Cloud Run directly vs via load balancer: direct IAP covers all ingress paths with less configuration; a load balancer adds Cloud Armor, custom domains and multi-backend routing but requires closing the default URL.
- Small vs large estates: a small team can grant tunnel access per project with port conditions; large estates should manage grants per instance or destination group through infrastructure as code and approval workflows.
Framework mapping
| Control area | NIST SP 800-53 Rev 5 | NIST CSF 2.0 | CIS Controls v8.1 | ISO/IEC 27001:2022 Annex A |
|---|---|---|---|---|
| Per-request authorisation to apps and VMs | AC-3, AC-6 | PR.AA-05 | 6 Access Control Management | A.5.15 Access control, A.8.3 Information access restriction |
| Remote administrative access via TCP forwarding | AC-17 | PR.AA-05 | 12 Network Infrastructure Management | A.6.7 Remote working, A.8.2 Privileged access rights |
| Authentication, reauthentication, sessions | IA-2, IA-11, AC-12 | PR.AA-03 | 6 Access Control Management | A.8.5 Secure authentication |
| Closing bypass paths | SC-7 | PR.IR-01 | 12 Network Infrastructure Management | A.8.20 Networks security |
| IAP audit logging | AU-2, AU-6 | DE.CM-09 | 8 Audit Log Management | A.8.15 Logging |
Common misconfigurations
- Open backend firewall: IAP on the load balancer while a rule allows 0.0.0.0/0 or the whole VPC to the backend port. Any VM in the network, or the internet, reaches the app without IAP (ATT&CK T1190 Exploit Public-Facing Application becomes possible against an app you thought was private).
- Trusting unsigned headers: applications that read
x-goog-authenticated-user-emailaccept forged identities as soon as a bypass exists. - Project-wide tunnel access: granting
tunnelResourceAccessorat project level with no port condition gives every holder SSH and RDP to every VM in the project. - Default Cloud Run URL left open: IAP on the load balancer while the
run.appURL accepts all traffic. - Bastion kept "just in case": the old path stays reachable and unmonitored after IAP goes live.
- Deleting the IAP OAuth client: cleanup of "unused" OAuth clients breaks IAP; an unplanned disable may then expose backends that were never closed.
Practitioner checklist
- Restrict backend firewall rules to load balancer ranges and admin ports to
35.235.240.0/20. - Remove external IPs from VMs and enforce it with organisation policy.
- Grant
httpsResourceAccessorper backend andtunnelResourceAccessorper instance or destination group with port conditions. - Add access level conditions and reauthentication for sensitive and administrative apps.
- Validate
x-goog-iap-jwt-assertionin every application with a pinned audience. - Use OS Login with IAP for SSH and keyless token signing for service accounts.
- Close the Cloud Run default URL or enable IAP directly on the service.
- Use IAP Policy Admin instead of Owner for policy management.
- Enable IAP Data Access logs and alert on policy, settings and destination group changes.
- Decommission bastions and VPN routes once IAP is live.
Standards and references
- Google Cloud: Identity-Aware Proxy overview
- Google Cloud: Using IAP for TCP forwarding
- Google Cloud: IAP TCP forwarding to resources outside Google Cloud
- Google Cloud: Securing your app with signed headers
- Google Cloud: Managing access to IAP-secured resources
- Google Cloud: Setting up context-aware access with IAP
- Google Cloud: Programmatic authentication
- Google Cloud: IAP audit logging
Related NHI Mgmt Group resources: ZTNA Guide · Compute Engine Security Guide · Cloud Run and Cloud Functions Security Guide · Google Cloud IAM and Service Accounts Guide · Privileged Access Workstations Guide