[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BYRK0ZDQ4STB17VZQ4FFGQ":3,"skill-same:01M6BYRK0ZDQ4STB17VZQ4FFGQ":158},{"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":23,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":82,"commitSha":83,"skillDirectory":84,"forksCount":85,"repositoryHtmlUrl":86,"repositoryHomepageUrl":6,"ownerHtmlUrl":87,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":88,"install":89,"resources":102},"01M6BYRK0ZDQ4STB17VZQ4FFGQ","teach",null,"Teach the user a new skill or concept, within this workspace.","Vortex375\u002Fseraph","Vortex375","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5016523?v=4","01M6BYMHA5FQE4EMD6BSZ13M46","Benjamin Schmitz","01M6BYMHEYGQ7DM3Q8A7KBNZ48",2,"AGPL-3.0","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000039","教师与教育","PROFESSION","适用职业",[5,24,25,26,27,28,29,30,31,32],"learn","workspace","user","new skill","about","you","true","concept","new","2026-11-10 10:12:30",false,"---\nname: configuring-identity-aware-proxy-with-google-iap\ndescription: 'Configures Google Cloud Identity-Aware Proxy (IAP) via gcloud to enforce\n  per-request identity verification on Compute Engine, App Engine, Cloud Run, and\n  GKE, including IAM bindings, Access Context Manager access levels, session\u002Freauth\n  settings, and service-account programmatic access. Use when replacing VPN access\n  with identity-based access to GCP backends or configuring context-aware, zero-trust\n  policies for Google Cloud services.\n\n  '\ndomain: cybersecurity\nsubdomain: zero-trust-architecture\ntags:\n- google-iap\n- identity-aware-proxy\n- gcp\n- zero-trust\n- access-context-manager\n- cloud-run\n- app-engine\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.AA-01\n- PR.AA-05\n- PR.IR-01\n- GV.PO-01\nmitre_attack:\n- T1078.004\n- T1133\n- T1021.007\nmitre_f3:\n  version: '1.1'\n  tactics:\n  - initial-access\n  - positioning\n  techniques:\n  - id: F1006\n    name: Account Takeover\n    tactic: initial-access\n    source: f3\n  - id: F1004\n    name: Access with Stolen Session Cookie\n    tactic: initial-access\n    source: f3\n  - id: T1550.001\n    name: 'Use Alternate Authentication Material: Application Access Token'\n    tactic: initial-access\n    source: attack\n  - id: T1539\n    name: Steal Web Session Cookie\n    tactic: positioning\n    source: attack\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":38,"tags":39,"author":47,"domain":48,"license":49,"version":50,"mitre_f3":51,"nist_csf":71,"subdomain":76,"description":77,"mitre_attack":78},"configuring-identity-aware-proxy-with-google-iap",[40,41,42,43,44,45,46],"google-iap","identity-aware-proxy","gcp","zero-trust","access-context-manager","cloud-run","app-engine","mahipal","cybersecurity","Apache-2.0","1.0",{"tactics":52,"version":55,"techniques":56},[53,54],"initial-access","positioning","1.1",[57,61,64,68],{"id":58,"name":59,"source":60,"tactic":53},"F1006","Account Takeover","f3",{"id":62,"name":63,"source":60,"tactic":53},"F1004","Access with Stolen Session Cookie",{"id":65,"name":66,"source":67,"tactic":53},"T1550.001","Use Alternate Authentication Material: Application Access Token","attack",{"id":69,"name":70,"source":67,"tactic":54},"T1539","Steal Web Session Cookie",[72,73,74,75],"PR.AA-01","PR.AA-05","PR.IR-01","GV.PO-01","zero-trust-architecture","Configures Google Cloud Identity-Aware Proxy (IAP) via gcloud to enforce per-request identity verification on Compute Engine, App Engine, Cloud Run, and GKE, including IAM bindings, Access Context Manager access levels, session\u002Freauth settings, and service-account programmatic access. Use when replacing VPN access with identity-based access to GCP backends or configuring context-aware, zero-trust policies for Google Cloud services.\n",[79,80,81],"T1078.004","T1133","T1021.007","main","54a798831d2266a3ca61ce68a7acb80b81160d57","app\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach",0,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph","https:\u002F\u002Fgithub.com\u002FVortex375","2026-11-08 18:46:14",{"source":8,"skillName":38,"commands":90,"prompt":100,"zipAvailable":101},[91,94,97],{"tool":92,"command":93},"npx","npx skills add Vortex375\u002Fseraph --skill configuring-identity-aware-proxy-with-google-iap",{"tool":95,"command":96},"bunx","bunx skills add Vortex375\u002Fseraph --skill configuring-identity-aware-proxy-with-google-iap",{"tool":98,"command":99},"pnpm","pnpm dlx skills add Vortex375\u002Fseraph --skill configuring-identity-aware-proxy-with-google-iap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FSKILL.md",true,[103,109,115,119,123,128,132,136,140,144,148,154],{"path":104,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":107,"sourceHtmlUrl":108},"agents\u002Fopenai.yaml","REFERENCE","参考文档",139,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002Fagents\u002Fopenai.yaml",{"path":110,"resourceType":111,"resourceTypeDesc":112,"sizeBytes":113,"sourceHtmlUrl":114},"assets\u002Ftemplate.md","ASSET","资产文件",2266,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fassets\u002Ftemplate.md",{"path":116,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":117,"sourceHtmlUrl":118},"GLOSSARY-FORMAT.md",2122,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FGLOSSARY-FORMAT.md",{"path":120,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":121,"sourceHtmlUrl":122},"LEARNING-RECORD-FORMAT.md",2747,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FLEARNING-RECORD-FORMAT.md",{"path":124,"resourceType":124,"resourceTypeDesc":125,"sizeBytes":126,"sourceHtmlUrl":127},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002FLICENSE",{"path":129,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":130,"sourceHtmlUrl":131},"MISSION-FORMAT.md",1540,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FMISSION-FORMAT.md",{"path":133,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":134,"sourceHtmlUrl":135},"references\u002Fapi-reference.md",1597,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fapi-reference.md",{"path":137,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":138,"sourceHtmlUrl":139},"references\u002Fstandards.md",1762,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fstandards.md",{"path":141,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":142,"sourceHtmlUrl":143},"references\u002Fworkflows.md",2490,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Freferences\u002Fworkflows.md",{"path":145,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":146,"sourceHtmlUrl":147},"RESOURCES-FORMAT.md",1924,"https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fteach\u002FRESOURCES-FORMAT.md",{"path":149,"resourceType":150,"resourceTypeDesc":151,"sizeBytes":152,"sourceHtmlUrl":153},"scripts\u002Fagent.py","SCRIPT","脚本",4547,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fscripts\u002Fagent.py",{"path":155,"resourceType":150,"resourceTypeDesc":151,"sizeBytes":156,"sourceHtmlUrl":157},"scripts\u002Fprocess.py",7875,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fconfiguring-identity-aware-proxy-with-google-iap\u002Fscripts\u002Fprocess.py",[159,181,206,230,246,265],{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":173,"publishedAt":33},"01M6BYS1QVW7F887EXS5RR34TA","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[165,170],{"categoryNo":166,"categoryName":167,"taxonomyType":168,"taxonomyTypeDesc":169},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",{"categoryNo":171,"categoryName":172,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000036","内容创作者",[174,175,176,177,178,179,180],"writing","for","writing for agents","when","use","editing","documents",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":33},"01M6BYRZNREK0C7V6Y43AKDJWW","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fwizard\u002FSKILL.md",[],[183,188,189,190,191,192,193,194,177,195,196,175,197,198,199,200,201,202,178,203,204,205],"provisioning","ci","generate","infrastructure","dashboard","can","running","invoke","party","credentials","human","provisioning infrastructure","migration","up","only","interactive","Bash","secrets",{"skillNo":207,"name":208,"nameZh":6,"description":209,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":210,"categories":211,"keywords":212,"publishedAt":33},"01M6BYRY92S448X31PTG25TCJC","wayfinder","Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[208,213,214,215,193,216,30,217,218,219,220,221,222,223,224,225,226,227,228,229],"at","map","agent session","time","shared","more","tickets","as","clear","issue","session","one at a time","work","decision","plan","chunk","tracker",{"skillNo":231,"name":232,"nameZh":6,"description":233,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":234,"categories":235,"keywords":236,"publishedAt":33},"01M6BYRWXMYWB6PD7E9PAD44M4","wait-what","Stop. That last message did not land: re-pitch it.","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fwait-what\u002FSKILL.md",[],[237,238,239,30,240,241,242,243,244,245],"wait what","wait","re","last","it","pitch","message","stop","land",{"skillNo":247,"name":248,"nameZh":6,"description":249,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":250,"categories":251,"keywords":252,"publishedAt":33},"01M6BYRTS6JNDYB7BZVAWK7JJ9","triage","Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Ftriage\u002FSKILL.md",[],[248,253,254,255,256,257,258,259,260,261,262,263,30,264],"machine","roles","grill","ready","write","verify","issues","state","move","prs","state machine","briefs",{"skillNo":266,"name":267,"nameZh":6,"description":268,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":269,"categories":270,"keywords":271,"publishedAt":33},"01M6BYRRRCDHNXH2YBDTYJPG36","to-tickets","Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).","https:\u002F\u002Fgithub.com\u002FVortex375\u002Fseraph\u002Fblob\u002Fmain\u002Fapp\u002Fseraph_app\u002F.agents\u002Fskills\u002Fto-tickets\u002FSKILL.md",[],[272,219,273,274,275,30,276,277,220,278,229,279,227,280,281],"to tickets","spec","links","break","native","ticket","conversation","text","SET","file"]