Skip to main content

A tool for to manage Identity-Aware Proxy policy google cloud platform

Project description

Allow connection to instances on multiple criteria via Identity-Aware Proxy

Installation :

  pip install google-iap   

Prerequisites:

The service account used must have at least the roles Compute Viewer and IAP Policy Admin
You must authorize the Identity-Aware Proxy network (35.235.240.0/20) on port 22 as input to the desired network at the firewall

Example of use :

  google-iap iap get --credentials=service-account.json --project=<projectId>     

  google-iap iap get --credentials=service-account.json --project=<projectId> --zone=<zone>     

  google-iap iap get --credentials=service-account.json --project=<projectId> --zone=<zone> --instance=<instance>    

  google-iap iap get --credentials=service-account.json --project=<projectId> --zone=<zone> --instance=<instance> --format=yaml    

  google-iap iap get --credentials=service-account.json --project=<projectId> --zone=<zone> --instance=<instance> --format=json    

  google-iap iap set --credentials=service-account.json --project=<projectId> --policy=POLICY_FILE.json    

  google-iap iap set --credentials=service-account.json --project=<projectId> --policy=POLICY_FILE.yaml   

  google-iap iap set --credentials=service-account.json --project=<projectId> --zone=<zone> --policy=POLICY_FILE.yaml    

  google-iap iap set --credentials=service-account.json --project=<projectId> --zone=<zone> --instance=<instance> --policy=POLICY_FILE.yaml    

File example POLICY_FILE.yaml :

---
policy:
  bindings:
  - role: roles/iap.tunnelResourceAccessor
    members:
    - user:account@gmail.com
    condition:
      title: adm-ssh
      expression: "resource.name.startsWith(\"instance-name\") && resource.type == \"google.cloud.compute.Instance\" && destination.port == 22"

File example POLICY_FILE.json :

{

  "policy": {

    "bindings": [

      {

        "role": "roles/iap.tunnelResourceAccessor",

        "members": ["user:account@gmail.com"],

        "condition": {

           "title": "adm-ssh",

           "expression": "resource.name.startsWith(\"instance-name\") && resource.type == \"google.cloud.compute.Instance\" && destination.port == 22"

        }

      }

    ]

  }

}

You can show CEL expression -> https://cloud.google.com/iam/docs/conditions-overview?hl=ko#example_destination_ipport_expressions_for_cloud_iap_for_tcp_tunneling

Use :

  • Ssh tunneling :
    gcloud beta compute start-iap-tunnel <instance> 80 --local-host-port=localhost:8888 --network-interface=nic0 --zone=<zone>    
    
  • Ssh connection :
    gcloud beta compute ssh <instance> --tunnel-through-iap --zone=<zone>    
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

google_iap-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

google_iap-1.0.0-py2-none-any.whl (5.0 kB view details)

Uploaded Python 2

File details

Details for the file google_iap-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: google_iap-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for google_iap-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 deaaad4c26926e867443693a88ea297025c4e62035fde2eb607d933e21282600
MD5 ee4607bbf01847cc9623868eb3d6f414
BLAKE2b-256 397d6a3a5be5383a70d6274f4e77bda4392ad0e4741f4e8c9e63aa19dc6cbc3f

See more details on using hashes here.

File details

Details for the file google_iap-1.0.0-py2-none-any.whl.

File metadata

  • Download URL: google_iap-1.0.0-py2-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.13.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for google_iap-1.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 a022a54430c7e6c53af875ec6145c1327500953f5db01643521b9333c9d5fdf0
MD5 51cc2de21669c90d327ea01b053675cd
BLAKE2b-256 9a2dff09af896a87a61a3157e41c9a9c9b03c497df805da439ed63f9d3faf338

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page