[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ET2AHSC24PVNNH7NEGDG8P":3,"skill-same:01M6ET2AHSC24PVNNH7NEGDG8P":111},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6ET2AHSC24PVNNH7NEGDG8P","configuring-identity-aware-proxy-with-google-iap",null,"Configuring Google Cloud Identity-Aware Proxy (IAP) to enforce per-request identity verification for Compute Engine, App Engine, Cloud Run, and GKE services using access levels, context-aware policies, and programmatic access with service accounts.","luokai0\u002Fai-agent-skills-by-luo-kai","luokai0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266954973?v=4","01M6E16VNT42JB8B3X3254QWJ7","luo kai","01M6E16VTFVP6S5XJF1V1MPV90",14,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"with","identity","proxy","iap","google","configuring identity aware proxy with google iap","gke","app","trust","context","access","identity-aware","zero-trust","gcp","ZeRO","verification","run","architecture","cybersecurity","google cloud","2026-11-10 10:12:30",false,"---\nname: configuring-identity-aware-proxy-with-google-iap\ndescription: >\n  Configuring Google Cloud Identity-Aware Proxy (IAP) to enforce per-request identity\n  verification for Compute Engine, App Engine, Cloud Run, and GKE services using\n  access levels, context-aware policies, and programmatic access with service accounts.\ndomain: cybersecurity\nsubdomain: zero-trust-architecture\ntags: [google-iap, identity-aware-proxy, gcp, zero-trust, access-context-manager, cloud-run, app-engine]\nversion: \"1.0\"\nauthor: mahipal\nlicense: Apache-2.0\n---\n\n# Configuring Identity-Aware Proxy with Google IAP\n\n## When to Use\n\n- When protecting Google Cloud applications (App Engine, Cloud Run, GKE, Compute Engine) with identity-based access\n- When implementing context-aware access requiring device posture and location verification\n- When providing secure access to internal tools without VPN or public IP exposure\n- When needing per-request authentication and authorization for web applications and TCP services\n- When configuring programmatic access to IAP-protected resources using service accounts\n\n**Do not use** for non-HTTP applications that cannot be placed behind an HTTPS load balancer, for public-facing applications that need unauthenticated access, or when applications handle their own authentication and IAP would conflict with existing auth flows.\n\n## Prerequisites\n\n- Google Cloud project with billing enabled\n- IAP API enabled (`gcloud services enable iap.googleapis.com`)\n- Application deployed behind HTTPS Load Balancer, App Engine, or Cloud Run\n- Cloud Identity or Google Workspace for user management\n- Access Context Manager API enabled for access levels\n- OAuth consent screen configured for the project\n\n## Workflow\n\n### Step 1: Enable IAP on Backend Services\n\nConfigure IAP for different GCP compute platforms.\n\n```bash\n# Enable required APIs\ngcloud services enable iap.googleapis.com\ngcloud services enable accesscontextmanager.googleapis.com\n\n# Create OAuth consent screen\ngcloud iap oauth-brands create \\\n  --application_title=\"Internal Applications\" \\\n  --support_email=security@company.com\n\n# Create OAuth client\ngcloud iap oauth-clients create \\\n  projects\u002FPROJECT_ID\u002Fbrands\u002FBRAND_ID \\\n  --display_name=\"IAP Web Client\"\n\n# === Enable IAP on Compute Engine Backend Service ===\ngcloud compute backend-services update my-backend-service \\\n  --iap=enabled,oauth2-client-id=CLIENT_ID,oauth2-client-secret=CLIENT_SECRET \\\n  --global\n\n# === Enable IAP on App Engine ===\ngcloud iap web enable \\\n  --resource-type=app-engine \\\n  --oauth2-client-id=CLIENT_ID \\\n  --oauth2-client-secret=CLIENT_SECRET\n\n# === Enable IAP on Cloud Run ===\n# First grant IAP service account the Cloud Run Invoker role\ngcloud run services add-iam-policy-binding my-service \\\n  --member=\"serviceAccount:service-PROJECT_NUM@gcp-sa-iap.iam.gserviceaccount.com\" \\\n  --role=\"roles\u002Frun.invoker\" \\\n  --region=us-central1\n\n# Enable IAP on the Cloud Run backend service\ngcloud compute backend-services update my-cloud-run-backend \\\n  --iap=enabled,oauth2-client-id=CLIENT_ID,oauth2-client-secret=CLIENT_SECRET \\\n  --global\n\n# === Enable IAP TCP Forwarding for SSH\u002FRDP ===\n# No load balancer needed - uses IAP tunnel\ngcloud compute instances add-iam-policy-binding my-vm \\\n  --member=\"group:developers@company.com\" \\\n  --role=\"roles\u002Fiap.tunnelResourceAccessor\" \\\n  --zone=us-central1-a\n\n# SSH through IAP tunnel\ngcloud compute ssh my-vm --zone=us-central1-a --tunnel-through-iap\n\n# RDP through IAP tunnel\ngcloud compute start-iap-tunnel my-windows-vm 3389 \\\n  --local-host-port=localhost:3390 \\\n  --zone=us-central1-a\n```\n\n### Step 2: Configure IAM Bindings for Access Control\n\nGrant access to specific users and groups with optional access level conditions.\n\n```bash\n# Grant basic access to a group\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=my-backend-service \\\n  --member=\"group:engineering@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\"\n\n# Grant access with access level condition\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=finance-app \\\n  --member=\"group:finance@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.auth.access_levels.exists(x, x == \"accessPolicies\u002FPOLICY_ID\u002FaccessLevels\u002Fcorporate-device\"),title=RequireCorporateDevice,description=Requires managed corporate device'\n\n# Grant access only during business hours\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=admin-console \\\n  --member=\"group:admins@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.time.getHours(\"America\u002FNew_York\") >= 8 && request.time.getHours(\"America\u002FNew_York\") \u003C= 18 && request.time.getDayOfWeek(\"America\u002FNew_York\") >= 1 && request.time.getDayOfWeek(\"America\u002FNew_York\") \u003C= 5,title=BusinessHoursOnly'\n\n# Grant access to a specific URL path\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=internal-api \\\n  --member=\"group:api-consumers@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.path.startsWith(\"\u002Fapi\u002Fv2\u002F\"),title=APIv2Access'\n```\n\n### Step 3: Create Access Levels with Access Context Manager\n\nDefine context-based access requirements using device attributes and network conditions.\n\n```bash\n# Create access level requiring encrypted corporate device\ncat > managed-device.yaml \u003C\u003C 'EOF'\n- devicePolicy:\n    allowedEncryptionStatuses:\n      - ENCRYPTED\n    osConstraints:\n      - osType: DESKTOP_WINDOWS\n        minimumVersion: \"10.0.19045\"\n      - osType: DESKTOP_MAC\n        minimumVersion: \"14.0\"\n      - osType: DESKTOP_CHROME_OS\n    requireScreenlock: true\n    requireAdminApproval: true\n    allowedDeviceManagementLevels:\n      - ADVANCED\nEOF\n\ngcloud access-context-manager levels create managed-device \\\n  --policy=POLICY_ID \\\n  --title=\"Managed Device\" \\\n  --basic-level-spec=managed-device.yaml\n\n# Create access level for corporate network\ncat > corp-network.yaml \u003C\u003C 'EOF'\n- ipSubnetworks:\n    - \"203.0.113.0\u002F24\"\n    - \"198.51.100.0\u002F24\"\n  regions:\n    - US\n    - GB\nEOF\n\ngcloud access-context-manager levels create corp-network \\\n  --policy=POLICY_ID \\\n  --title=\"Corporate Network\" \\\n  --basic-level-spec=corp-network.yaml\n\n# Create custom access level using CEL for complex logic\ncat > high-trust.yaml \u003C\u003C 'EOF'\nexpression: >\n  device.encryption_status == DeviceEncryptionStatus.ENCRYPTED &&\n  device.is_admin_approved_device == true &&\n  (\n    origin.ip in [\"203.0.113.0\u002F24\"] ||\n    device.os_type == OsType.DESKTOP_CHROME_OS\n  ) &&\n  request.auth.claims.hd == \"company.com\"\nEOF\n\ngcloud access-context-manager levels create high-trust \\\n  --policy=POLICY_ID \\\n  --title=\"High Trust\" \\\n  --custom-level-spec=high-trust.yaml\n```\n\n### Step 4: Configure Session Settings and Re-authentication\n\nSet session duration and re-authentication policies per application.\n\n```bash\n# Configure re-authentication for a backend service\n# Requires login every 4 hours for sensitive apps\ngcloud iap settings set \\\n  --project=PROJECT_ID \\\n  --resource-type=compute \\\n  --service=finance-app \\\n  reauthSettings.method=LOGIN \\\n  reauthSettings.maxAge=14400s \\\n  reauthSettings.policyType=MINIMUM\n\n# Configure session settings for App Engine\ngcloud iap settings set \\\n  --project=PROJECT_ID \\\n  --resource-type=app-engine \\\n  reauthSettings.method=SECURE_KEY \\\n  reauthSettings.maxAge=3600s \\\n  reauthSettings.policyType=MINIMUM\n\n# View current IAP settings\ngcloud iap settings get \\\n  --project=PROJECT_ID \\\n  --resource-type=compute \\\n  --service=finance-app\n```\n\n### Step 5: Configure Programmatic Access for Service Accounts\n\nEnable service-to-service communication through IAP-protected endpoints.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"Access IAP-protected resource using service account credentials.\"\"\"\n\nimport google.auth\nimport google.auth.transport.requests\nfrom google.auth import impersonated_credentials\nimport requests as req\n\nIAP_CLIENT_ID = \"YOUR_IAP_OAUTH_CLIENT_ID.apps.googleusercontent.com\"\nIAP_URL = \"https:\u002F\u002Fmy-app.company.com\u002Fapi\u002Fdata\"\n\ndef access_iap_resource():\n    # Get default credentials (works with service account key or workload identity)\n    credentials, project = google.auth.default()\n\n    # Create IAP-authenticated request\n    authed_session = google.auth.transport.requests.AuthorizedSession(\n        credentials,\n        target_audience=IAP_CLIENT_ID\n    )\n\n    # Make request to IAP-protected resource\n    response = authed_session.get(IAP_URL)\n    print(f\"Status: {response.status_code}\")\n    print(f\"Response: {response.text[:500]}\")\n\n    return response\n\nif __name__ == \"__main__\":\n    access_iap_resource()\n```\n\n### Step 6: Set Up Audit Logging and Monitoring\n\nConfigure logging for all IAP access decisions.\n\n```bash\n# Enable data access audit logs for IAP\ngcloud projects get-iam-policy PROJECT_ID --format=json > policy.json\n\n# Add IAP audit config to policy.json:\n# {\n#   \"service\": \"iap.googleapis.com\",\n#   \"auditLogConfigs\": [\n#     {\"logType\": \"ADMIN_READ\"},\n#     {\"logType\": \"DATA_READ\"},\n#     {\"logType\": \"DATA_WRITE\"}\n#   ]\n# }\n\ngcloud projects set-iam-policy PROJECT_ID policy.json\n\n# Create log-based metric for denied access\ngcloud logging metrics create iap-denied-access \\\n  --description=\"Count of IAP access denials\" \\\n  --log-filter='resource.type=\"gce_backend_service\" AND protoPayload.status.code=16'\n\n# Create alerting policy for high denial rates\ngcloud alpha monitoring policies create \\\n  --display-name=\"IAP High Denial Rate\" \\\n  --condition-display-name=\"Denied access > 50 in 5 min\" \\\n  --condition-filter='metric.type=\"logging.googleapis.com\u002Fuser\u002Fiap-denied-access\"' \\\n  --condition-threshold-value=50 \\\n  --condition-threshold-duration=300s \\\n  --notification-channels=projects\u002FPROJECT_ID\u002FnotificationChannels\u002FCHANNEL_ID\n\n# Query IAP access logs\ngcloud logging read '\n  resource.type=\"gce_backend_service\"\n  protoPayload.serviceName=\"iap.googleapis.com\"\n  timestamp >= \"2026-02-22T00:00:00Z\"\n' --project=PROJECT_ID --format='table(timestamp,protoPayload.authenticationInfo.principalEmail,protoPayload.status.code,resource.labels.backend_service_name)' --limit=50\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Identity-Aware Proxy | GCP service that intercepts web requests and TCP connections, authenticating users and evaluating access policies before proxying to backend services |\n| Backend Service | GCP load balancer component that IAP protects; can serve Compute Engine instances, GKE pods, Cloud Run services, or App Engine |\n| IAP Tunnel | Secure TCP tunnel through IAP allowing SSH, RDP, and other TCP access to VMs without public IPs or VPN |\n| OAuth Consent Screen | GCP configuration specifying the application name and support email shown to users during IAP authentication |\n| Access Level | Named condition in Access Context Manager evaluated during IAP authorization (device posture, IP, geography) |\n| Re-authentication | IAP feature requiring users to prove their identity again after a configurable session duration |\n\n## Tools & Systems\n\n- **Google Cloud IAP**: Identity-aware reverse proxy for GCP applications and TCP services\n- **Access Context Manager**: Defines access levels based on device, network, and geographic attributes\n- **gcloud CLI**: Command-line tool for configuring IAP, access levels, and IAM bindings\n- **IAP TCP Forwarding**: Tunnel-based access to VMs for SSH\u002FRDP without public IPs\n- **Cloud Audit Logs**: Immutable records of all IAP access decisions for compliance\n- **Endpoint Verification**: Chrome extension collecting device attributes for access level evaluation\n\n## Common Scenarios\n\n### Scenario: Securing 15 Internal GCP Services with IAP\n\n**Context**: An e-commerce company runs 15 internal services on GKE and Cloud Run (admin dashboards, internal APIs, monitoring tools). Currently, these services are protected only by VPN and firewall rules, creating excessive network-level access.\n\n**Approach**:\n1. Deploy all services behind an HTTPS Load Balancer with managed SSL certificates\n2. Enable IAP on each backend service with per-service OAuth clients\n3. Create IAM bindings mapping Google Groups to specific services (admin group -> admin dashboard, engineering -> monitoring)\n4. Define access levels: managed-device (encryption + screen lock), corp-network (office IP ranges)\n5. Apply managed-device access level to admin dashboard and financial tools\n6. Configure IAP TCP tunneling for SSH access to GKE nodes (replacing SSH bastion host)\n7. Set re-authentication to 4 hours for admin tools, 8 hours for monitoring\n8. Configure Cloud Audit Logs and create alerting for repeated denials\n\n**Pitfalls**: IAP adds 10-50ms latency per request; test application performance. WebSocket connections through IAP require specific backend service configuration. Service-to-service calls within GKE should bypass IAP using internal service mesh, not external IAP endpoints. Break-glass access should use a separate IAM binding without access level conditions.\n\n## Output Format\n\n```\nGoogle Cloud IAP Configuration Report\n==================================================\nProject: ecommerce-internal\nReport Date: 2026-02-23\n\nIAP-PROTECTED SERVICES:\n  Backend Services:     12\n  App Engine:            1\n  Cloud Run:             2\n  IAP TCP Tunnels:       4 (SSH access)\n  Total:                19\n\nACCESS CONTROL:\n  IAM Bindings:         34\n  With Access Levels:   18 (52.9%)\n  Access Levels:         3 (managed-device, corp-network, high-trust)\n\nSESSION POLICIES:\n  Admin tools:          4h re-auth (SECURE_KEY)\n  Sensitive apps:       4h re-auth (LOGIN)\n  General tools:        8h re-auth (LOGIN)\n\nACCESS LOGS (last 24h):\n  Total requests:       23,456\n  Authenticated:        23,289 (99.3%)\n  Denied by IAM:           112\n  Denied by access level:   55\n  Unique users:            134\n```\n","# Configuring Identity-Aware Proxy with Google IAP\n\n## When to Use\n\n- When protecting Google Cloud applications (App Engine, Cloud Run, GKE, Compute Engine) with identity-based access\n- When implementing context-aware access requiring device posture and location verification\n- When providing secure access to internal tools without VPN or public IP exposure\n- When needing per-request authentication and authorization for web applications and TCP services\n- When configuring programmatic access to IAP-protected resources using service accounts\n\n**Do not use** for non-HTTP applications that cannot be placed behind an HTTPS load balancer, for public-facing applications that need unauthenticated access, or when applications handle their own authentication and IAP would conflict with existing auth flows.\n\n## Prerequisites\n\n- Google Cloud project with billing enabled\n- IAP API enabled (`gcloud services enable iap.googleapis.com`)\n- Application deployed behind HTTPS Load Balancer, App Engine, or Cloud Run\n- Cloud Identity or Google Workspace for user management\n- Access Context Manager API enabled for access levels\n- OAuth consent screen configured for the project\n\n## Workflow\n\n### Step 1: Enable IAP on Backend Services\n\nConfigure IAP for different GCP compute platforms.\n\n```bash\n# Enable required APIs\ngcloud services enable iap.googleapis.com\ngcloud services enable accesscontextmanager.googleapis.com\n\n# Create OAuth consent screen\ngcloud iap oauth-brands create \\\n  --application_title=\"Internal Applications\" \\\n  --support_email=security@company.com\n\n# Create OAuth client\ngcloud iap oauth-clients create \\\n  projects\u002FPROJECT_ID\u002Fbrands\u002FBRAND_ID \\\n  --display_name=\"IAP Web Client\"\n\n# === Enable IAP on Compute Engine Backend Service ===\ngcloud compute backend-services update my-backend-service \\\n  --iap=enabled,oauth2-client-id=CLIENT_ID,oauth2-client-secret=CLIENT_SECRET \\\n  --global\n\n# === Enable IAP on App Engine ===\ngcloud iap web enable \\\n  --resource-type=app-engine \\\n  --oauth2-client-id=CLIENT_ID \\\n  --oauth2-client-secret=CLIENT_SECRET\n\n# === Enable IAP on Cloud Run ===\n# First grant IAP service account the Cloud Run Invoker role\ngcloud run services add-iam-policy-binding my-service \\\n  --member=\"serviceAccount:service-PROJECT_NUM@gcp-sa-iap.iam.gserviceaccount.com\" \\\n  --role=\"roles\u002Frun.invoker\" \\\n  --region=us-central1\n\n# Enable IAP on the Cloud Run backend service\ngcloud compute backend-services update my-cloud-run-backend \\\n  --iap=enabled,oauth2-client-id=CLIENT_ID,oauth2-client-secret=CLIENT_SECRET \\\n  --global\n\n# === Enable IAP TCP Forwarding for SSH\u002FRDP ===\n# No load balancer needed - uses IAP tunnel\ngcloud compute instances add-iam-policy-binding my-vm \\\n  --member=\"group:developers@company.com\" \\\n  --role=\"roles\u002Fiap.tunnelResourceAccessor\" \\\n  --zone=us-central1-a\n\n# SSH through IAP tunnel\ngcloud compute ssh my-vm --zone=us-central1-a --tunnel-through-iap\n\n# RDP through IAP tunnel\ngcloud compute start-iap-tunnel my-windows-vm 3389 \\\n  --local-host-port=localhost:3390 \\\n  --zone=us-central1-a\n```\n\n### Step 2: Configure IAM Bindings for Access Control\n\nGrant access to specific users and groups with optional access level conditions.\n\n```bash\n# Grant basic access to a group\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=my-backend-service \\\n  --member=\"group:engineering@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\"\n\n# Grant access with access level condition\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=finance-app \\\n  --member=\"group:finance@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.auth.access_levels.exists(x, x == \"accessPolicies\u002FPOLICY_ID\u002FaccessLevels\u002Fcorporate-device\"),title=RequireCorporateDevice,description=Requires managed corporate device'\n\n# Grant access only during business hours\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=admin-console \\\n  --member=\"group:admins@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.time.getHours(\"America\u002FNew_York\") >= 8 && request.time.getHours(\"America\u002FNew_York\") \u003C= 18 && request.time.getDayOfWeek(\"America\u002FNew_York\") >= 1 && request.time.getDayOfWeek(\"America\u002FNew_York\") \u003C= 5,title=BusinessHoursOnly'\n\n# Grant access to a specific URL path\ngcloud iap web add-iam-policy-binding \\\n  --resource-type=backend-services \\\n  --service=internal-api \\\n  --member=\"group:api-consumers@company.com\" \\\n  --role=\"roles\u002Fiap.httpsResourceAccessor\" \\\n  --condition='expression=request.path.startsWith(\"\u002Fapi\u002Fv2\u002F\"),title=APIv2Access'\n```\n\n### Step 3: Create Access Levels with Access Context Manager\n\nDefine context-based access requirements using device attributes and network conditions.\n\n```bash\n# Create access level requiring encrypted corporate device\ncat > managed-device.yaml \u003C\u003C 'EOF'\n- devicePolicy:\n    allowedEncryptionStatuses:\n      - ENCRYPTED\n    osConstraints:\n      - osType: DESKTOP_WINDOWS\n        minimumVersion: \"10.0.19045\"\n      - osType: DESKTOP_MAC\n        minimumVersion: \"14.0\"\n      - osType: DESKTOP_CHROME_OS\n    requireScreenlock: true\n    requireAdminApproval: true\n    allowedDeviceManagementLevels:\n      - ADVANCED\nEOF\n\ngcloud access-context-manager levels create managed-device \\\n  --policy=POLICY_ID \\\n  --title=\"Managed Device\" \\\n  --basic-level-spec=managed-device.yaml\n\n# Create access level for corporate network\ncat > corp-network.yaml \u003C\u003C 'EOF'\n- ipSubnetworks:\n    - \"203.0.113.0\u002F24\"\n    - \"198.51.100.0\u002F24\"\n  regions:\n    - US\n    - GB\nEOF\n\ngcloud access-context-manager levels create corp-network \\\n  --policy=POLICY_ID \\\n  --title=\"Corporate Network\" \\\n  --basic-level-spec=corp-network.yaml\n\n# Create custom access level using CEL for complex logic\ncat > high-trust.yaml \u003C\u003C 'EOF'\nexpression: >\n  device.encryption_status == DeviceEncryptionStatus.ENCRYPTED &&\n  device.is_admin_approved_device == true &&\n  (\n    origin.ip in [\"203.0.113.0\u002F24\"] ||\n    device.os_type == OsType.DESKTOP_CHROME_OS\n  ) &&\n  request.auth.claims.hd == \"company.com\"\nEOF\n\ngcloud access-context-manager levels create high-trust \\\n  --policy=POLICY_ID \\\n  --title=\"High Trust\" \\\n  --custom-level-spec=high-trust.yaml\n```\n\n### Step 4: Configure Session Settings and Re-authentication\n\nSet session duration and re-authentication policies per application.\n\n```bash\n# Configure re-authentication for a backend service\n# Requires login every 4 hours for sensitive apps\ngcloud iap settings set \\\n  --project=PROJECT_ID \\\n  --resource-type=compute \\\n  --service=finance-app \\\n  reauthSettings.method=LOGIN \\\n  reauthSettings.maxAge=14400s \\\n  reauthSettings.policyType=MINIMUM\n\n# Configure session settings for App Engine\ngcloud iap settings set \\\n  --project=PROJECT_ID \\\n  --resource-type=app-engine \\\n  reauthSettings.method=SECURE_KEY \\\n  reauthSettings.maxAge=3600s \\\n  reauthSettings.policyType=MINIMUM\n\n# View current IAP settings\ngcloud iap settings get \\\n  --project=PROJECT_ID \\\n  --resource-type=compute \\\n  --service=finance-app\n```\n\n### Step 5: Configure Programmatic Access for Service Accounts\n\nEnable service-to-service communication through IAP-protected endpoints.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"Access IAP-protected resource using service account credentials.\"\"\"\n\nimport google.auth\nimport google.auth.transport.requests\nfrom google.auth import impersonated_credentials\nimport requests as req\n\nIAP_CLIENT_ID = \"YOUR_IAP_OAUTH_CLIENT_ID.apps.googleusercontent.com\"\nIAP_URL = \"https:\u002F\u002Fmy-app.company.com\u002Fapi\u002Fdata\"\n\ndef access_iap_resource():\n    # Get default credentials (works with service account key or workload identity)\n    credentials, project = google.auth.default()\n\n    # Create IAP-authenticated request\n    authed_session = google.auth.transport.requests.AuthorizedSession(\n        credentials,\n        target_audience=IAP_CLIENT_ID\n    )\n\n    # Make request to IAP-protected resource\n    response = authed_session.get(IAP_URL)\n    print(f\"Status: {response.status_code}\")\n    print(f\"Response: {response.text[:500]}\")\n\n    return response\n\nif __name__ == \"__main__\":\n    access_iap_resource()\n```\n\n### Step 6: Set Up Audit Logging and Monitoring\n\nConfigure logging for all IAP access decisions.\n\n```bash\n# Enable data access audit logs for IAP\ngcloud projects get-iam-policy PROJECT_ID --format=json > policy.json\n\n# Add IAP audit config to policy.json:\n# {\n#   \"service\": \"iap.googleapis.com\",\n#   \"auditLogConfigs\": [\n#     {\"logType\": \"ADMIN_READ\"},\n#     {\"logType\": \"DATA_READ\"},\n#     {\"logType\": \"DATA_WRITE\"}\n#   ]\n# }\n\ngcloud projects set-iam-policy PROJECT_ID policy.json\n\n# Create log-based metric for denied access\ngcloud logging metrics create iap-denied-access \\\n  --description=\"Count of IAP access denials\" \\\n  --log-filter='resource.type=\"gce_backend_service\" AND protoPayload.status.code=16'\n\n# Create alerting policy for high denial rates\ngcloud alpha monitoring policies create \\\n  --display-name=\"IAP High Denial Rate\" \\\n  --condition-display-name=\"Denied access > 50 in 5 min\" \\\n  --condition-filter='metric.type=\"logging.googleapis.com\u002Fuser\u002Fiap-denied-access\"' \\\n  --condition-threshold-value=50 \\\n  --condition-threshold-duration=300s \\\n  --notification-channels=projects\u002FPROJECT_ID\u002FnotificationChannels\u002FCHANNEL_ID\n\n# Query IAP access logs\ngcloud logging read '\n  resource.type=\"gce_backend_service\"\n  protoPayload.serviceName=\"iap.googleapis.com\"\n  timestamp >= \"2026-02-22T00:00:00Z\"\n' --project=PROJECT_ID --format='table(timestamp,protoPayload.authenticationInfo.principalEmail,protoPayload.status.code,resource.labels.backend_service_name)' --limit=50\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Identity-Aware Proxy | GCP service that intercepts web requests and TCP connections, authenticating users and evaluating access policies before proxying to backend services |\n| Backend Service | GCP load balancer component that IAP protects; can serve Compute Engine instances, GKE pods, Cloud Run services, or App Engine |\n| IAP Tunnel | Secure TCP tunnel through IAP allowing SSH, RDP, and other TCP access to VMs without public IPs or VPN |\n| OAuth Consent Screen | GCP configuration specifying the application name and support email shown to users during IAP authentication |\n| Access Level | Named condition in Access Context Manager evaluated during IAP authorization (device posture, IP, geography) |\n| Re-authentication | IAP feature requiring users to prove their identity again after a configurable session duration |\n\n## Tools & Systems\n\n- **Google Cloud IAP**: Identity-aware reverse proxy for GCP applications and TCP services\n- **Access Context Manager**: Defines access levels based on device, network, and geographic attributes\n- **gcloud CLI**: Command-line tool for configuring IAP, access levels, and IAM bindings\n- **IAP TCP Forwarding**: Tunnel-based access to VMs for SSH\u002FRDP without public IPs\n- **Cloud Audit Logs**: Immutable records of all IAP access decisions for compliance\n- **Endpoint Verification**: Chrome extension collecting device attributes for access level evaluation\n\n## Common Scenarios\n\n### Scenario: Securing 15 Internal GCP Services with IAP\n\n**Context**: An e-commerce company runs 15 internal services on GKE and Cloud Run (admin dashboards, internal APIs, monitoring tools). Currently, these services are protected only by VPN and firewall rules, creating excessive network-level access.\n\n**Approach**:\n1. Deploy all services behind an HTTPS Load Balancer with managed SSL certificates\n2. Enable IAP on each backend service with per-service OAuth clients\n3. Create IAM bindings mapping Google Groups to specific services (admin group -> admin dashboard, engineering -> monitoring)\n4. Define access levels: managed-device (encryption + screen lock), corp-network (office IP ranges)\n5. Apply managed-device access level to admin dashboard and financial tools\n6. Configure IAP TCP tunneling for SSH access to GKE nodes (replacing SSH bastion host)\n7. Set re-authentication to 4 hours for admin tools, 8 hours for monitoring\n8. Configure Cloud Audit Logs and create alerting for repeated denials\n\n**Pitfalls**: IAP adds 10-50ms latency per request; test application performance. WebSocket connections through IAP require specific backend service configuration. Service-to-service calls within GKE should bypass IAP using internal service mesh, not external IAP endpoints. Break-glass access should use a separate IAM binding without access level conditions.\n\n## Output Format\n\n```\nGoogle Cloud IAP Configuration Report\n==================================================\nProject: ecommerce-internal\nReport Date: 2026-02-23\n\nIAP-PROTECTED SERVICES:\n  Backend Services:     12\n  App Engine:            1\n  Cloud Run:             2\n  IAP TCP Tunnels:       4 (SSH access)\n  Total:                19\n\nACCESS CONTROL:\n  IAM Bindings:         34\n  With Access Levels:   18 (52.9%)\n  Access Levels:         3 (managed-device, corp-network, high-trust)\n\nSESSION POLICIES:\n  Admin tools:          4h re-auth (SECURE_KEY)\n  Sensitive apps:       4h re-auth (LOGIN)\n  General tools:        8h re-auth (LOGIN)\n\nACCESS LOGS (last 24h):\n  Total requests:       23,456\n  Authenticated:        23,289 (99.3%)\n  Denied by IAM:           112\n  Denied by access level:   55\n  Unique users:            134\n```\n",{"name":5,"tags":44,"author":50,"domain":37,"license":15,"version":51,"subdomain":52,"description":53},[45,46,32,31,47,48,49],"google-iap","identity-aware-proxy","access-context-manager","cloud-run","app-engine","mahipal","1.0","zero-trust-architecture","Configuring Google Cloud Identity-Aware Proxy (IAP) to enforce per-request identity verification for Compute Engine, App Engine, Cloud Run, and GKE services using access levels, context-aware policies, and programmatic access with service accounts.\n","main","4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c","ai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap",2,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai","https:\u002F\u002Fgithub.com\u002Fluokai0","a solo builder.","2026-05-06 04:29:04",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill configuring-identity-aware-proxy-with-google-iap",{"tool":68,"command":69},"bunx","bunx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill configuring-identity-aware-proxy-with-google-iap",{"tool":71,"command":72},"pnpm","pnpm dlx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill configuring-identity-aware-proxy-with-google-iap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002FSKILL.md",true,[76,82,87,93,97,101,107],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"assets\u002Ftemplate.md","ASSET","资产文件",2266,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fassets\u002Ftemplate.md",{"path":83,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002FLICENSE",{"path":88,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fapi-reference.md","REFERENCE","参考文档",1597,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fapi-reference.md",{"path":94,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fstandards.md",1762,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fstandards.md",{"path":98,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fworkflows.md",2490,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fworkflows.md",{"path":102,"resourceType":103,"resourceTypeDesc":104,"sizeBytes":105,"sourceHtmlUrl":106},"scripts\u002Fagent.py","SCRIPT","脚本",4547,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fscripts\u002Fagent.py",{"path":108,"resourceType":103,"resourceTypeDesc":104,"sizeBytes":109,"sourceHtmlUrl":110},"scripts\u002Fprocess.py",7875,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F21-external-registries\u002F08-pinkpixel-collection\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fscripts\u002Fprocess.py",[112,140,157,182,208,232],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":39},"01M6F2SKTE208174C7S7JJCZC7","write-contracts","Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and storage type guidance. Includes comprehensive storage decision framework for optimal data structure selection. Triggers on: 'write contract', 'create NFT collection', 'build marketplace', 'implement minting', 'generate Move module', 'create token contract', 'build DAO', 'implement staking'. Ask storage questions when: 'store', 'track', 'registry', 'mapping', 'list', 'collection'.","MIT","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fwrite-contracts\u002FSKILL.md",[],[120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139],"write","contracts","write contracts","storage","secure","create","generate","collection","model","decision","ask","smart-contracts","selection","objects","structure","nft","token","aptos","critical","move",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":39},"01M6F2RFXJ6T9MKW0A7N7GM45B","web-search","通用网络搜索技能，支持多引擎搜索（百度、必应、DuckDuckGo），无需API密钥即可获取实时信息","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fweb-search-ex-skill\u002FSKILL.md",[],[147,148,149,150,151,152,153,154,155,156],"web","search","web search","搜索","baidu","bing","duckduckgo","百度","多引擎","internet",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":39},"01M6F2K968G1FZEZFPW2E6B222","solo-build","Execute implementation plan tasks with TDD workflow, auto-commit, and phase gates. Use when user says \"build it\", \"start building\", \"execute plan\", \"implement tasks\", \"ship it\", or references a track ID. Do NOT use for planning (use \u002Fplan) or scaffolding (use \u002Fscaffold).","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fsolo-build\u002FSKILL.md",[],[164,165,166,167,168,169,170,171,148,172,173,174,120,175,176,177,178,179,180,181],"build","solo","solo build","MCP","workflow","commit","tasks","code","Bash","plan","read","auto","references","context7","query","scaffolding","ship it","project",{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":188,"publishedAt":39},"01M6F2GKN39SGHSPWYB3662YC8","react-email","Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Freact-email-skills\u002FSKILL.md",[],[189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,19],"react","email","react email","github","editor","components","react components","component","welcome","https","notifications","password","node","use","html","resend","visual","emails","rendering",{"skillNo":209,"name":210,"nameZh":6,"description":211,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":212,"categories":213,"keywords":214,"publishedAt":39},"01M6F2FBVGVDFSG8SSFJGXA40C","APITester Agent-Driven API Testing","Test API endpoints and document responses. Define tests in plain English, run them, get formatted results. Agent-driven Postman alternative.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fopenclaw-api-tester\u002FSKILL.md",[],[215,216,217,218,219,220,35,221,222,223,224,225,226,227,228,229,230,231],"testing","api","api testing","driven","APITester Agent Driven API Testing","test","postman","results","plain english","tester","endpoints","document","get","define","tests","english","api-tester",{"skillNo":233,"name":234,"nameZh":6,"description":235,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":236,"categories":237,"keywords":238,"publishedAt":39},"01M6F273Y3NGAPVJZ608BC0G9G","hubspot-implementation-plan","Generate a phased implementation plan from a HubSpot audit report. Creates prioritized, sequenced cleanup processes with effort estimates, dependencies, and automation feasibility. Use after running \u002Fhubspot-audit.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fhubspot-implementation-plan\u002FSKILL.md",[],[173,239,240,241,242,243,244,126,245,246,247,248,249,202,250,251,19,252],"implementation","hubspot","hubspot implementation plan","automation","feasibility","cleanup","planning","report","audit","audit report","phased implementation","dependencies","processes","hubspot audit"]