Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GCP CLI support: add support for gsutil. #20072

Merged
merged 3 commits into from
Jan 12, 2023
Merged

Conversation

Tener
Copy link
Contributor

@Tener Tener commented Jan 11, 2023

This PR adds changes necessary to support gsutil v2 in GCP App Access. gsutil v2 does not support CLOUDSDK_AUTH_ACCESS_TOKEN; instead, we have to write the token to file and set env variables so that gsutil reads the configuration file, which points at the file with token.

gsutil v3 is based on GCP Cloud SDK and, therefore, already supported.

More info: GoogleCloudPlatform/gsutil#357 (comment)

This change is a follow-up to #17257.

Setup: see #19790.

Usage options:

  1. Directly call gsutil using tsh as wrapper:
> tsh gsutil ls
gs://example-gcp-bucket-001/
gs://example-gcp-bucket-002/
  1. Start proxy in one console. Use gsutil in another console after setting env variables:
> tsh proxy gcp --port 3500

Started GCP proxy on http://127.0.0.1:3500.

Use the following credentials and HTTPS proxy setting to connect to the proxy:

  export BOTO_CONFIG=/Users/username/.tsh/gcp/teleport.example.com/gcp/5b46ada1_boto.cfg
  export CLOUDSDK_AUTH_ACCESS_TOKEN=8db77684aea05ef3c49ca0a313d5d9fd
  export CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE=/Users/username/.tsh/keys/teleport.example.com/username-app/teleport.example.com/gcp-localca.pem
  export HTTPS_PROXY=http://127.0.0.1:3500
> export BOTO_CONFIG=/Users/username/.tsh/gcp/teleport.example.com/gcp/5b46ada1_boto.cfg
> export CLOUDSDK_AUTH_ACCESS_TOKEN=8db77684aea05ef3c49ca0a313d5d9fd
> export CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE=/Users/username/.tsh/keys/teleport.example.com/username-app/teleport.example.com/gcp-localca.pem
> export HTTPS_PROXY=http://127.0.0.1:3500
> gsutil ls
gs://example-gcp-bucket-001/
gs://example-gcp-bucket-002/

@github-actions github-actions bot added size/md tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Jan 11, 2023
@github-actions github-actions bot requested review from AntonAM and zmb3 January 11, 2023 11:55
Base automatically changed from tener/gcloud-cli-tsh-tctl to master January 11, 2023 16:34
@Tener Tener force-pushed the tener/gcloud-cli-gsutil branch from 1774b93 to 065c544 Compare January 11, 2023 16:36
@github-actions github-actions bot removed request for AntonAM and zmb3 January 12, 2023 12:46
@Tener Tener force-pushed the tener/gcloud-cli-gsutil branch 3 times, most recently from 64f5dfc to c845067 Compare January 12, 2023 18:16
@Tener Tener changed the base branch from master to tener/gcp-set-project-id-and-isolate-gcloud January 12, 2023 18:17
Base automatically changed from tener/gcp-set-project-id-and-isolate-gcloud to master January 12, 2023 19:28
@Tener Tener force-pushed the tener/gcloud-cli-gsutil branch from c845067 to eac6359 Compare January 12, 2023 19:31
@Tener Tener enabled auto-merge (squash) January 12, 2023 19:32
@Tener Tener merged commit 3db6628 into master Jan 12, 2023
@Tener Tener deleted the tener/gcloud-cli-gsutil branch January 12, 2023 19:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size/md tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants