-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: tsh
and tctl
changes
#19790
Conversation
54f03a0
to
987e04c
Compare
8321cdb
to
cbc0c1b
Compare
987e04c
to
d92542c
Compare
cbc0c1b
to
2dae0a0
Compare
d92542c
to
71e3a69
Compare
49ec4f8
to
cb83f86
Compare
cb83f86
to
0e35c38
Compare
d5a27d2
to
f8a2788
Compare
0e35c38
to
a3bd10d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, but a few things I'd like to address before approving
f8a2788
to
aa7754b
Compare
a3bd10d
to
0f0ddab
Compare
aa7754b
to
adf88aa
Compare
0f0ddab
to
877d3ce
Compare
adf88aa
to
54ccb28
Compare
877d3ce
to
c792f8a
Compare
- make debug log entry in appropriate place - document the default scope list - replace `context.WithTimeout` with `s.Clock.After` to avoid `time.Sleep` in tests. - cloud client is now being mocked, making `generateAccessToken` testeable. - update tests
- replace `context.WithTimeout` with `s.Clock.After` to avoid `time.Sleep` in tests.
- make `tsh gcloud` and `tsh proxy gcloud` base commands so they are shown in `--help` - `tsh gcp` and `tsh proxy gcp` are aliases now - switch `REQUESTS_CA_BUNDLE` to official `CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE` - add doc links for `CLOUDSDK_AUTH_ACCESS_TOKEN` and `CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE` - remove commented out code - add docs and tests for `SortedGCPServiceAccounts` - move `TELEPORT_GCLOUD_SECRET` to constant - typos
54ccb28
to
46d1ddc
Compare
c2852fd
to
9f4f453
Compare
Regarding point:
This works out of the box, but Terraform needs to be configured correctly. Assuming we are running
Then we must run Terraform with the following env variables exported:
Instead of using Unlike some other apps, Terraform does not provide explicit support for custom CA certs: hashicorp/terraform#28551. To make it trust |
tsh
andtctl
changes for #17257To be applied on top of #19789.
This is the final PR in the chain. Fixes #17257.
TODO: Testing:
gsutil
tool. PR: GCP CLI support: add support forgsutil
. #20072Setup:
teleport-service
.Service Account User
role to theteleport-service
account.teleport-service
as a VM account to use. If you cannot select the service account, check that it has appropriate role (see step 2).teleport-user-1
andteleport-user-2
. Assign desired permissions for these accounts.teleport-user-1
,teleport-user-2
etc. toteleport-service
at least withService Account Token Creator
role. This will allowteleport-service
to issue tokens asteleport-user-XXX
. More info: https://cloud.google.com/iam/docs/service-accounts#token-creator-rolecloud: GCP
is the critical part of the config.access
role should contain the snippet below. If not, modify a role the user has access to include a reference to{{internal.gcp_service_accounts}}
. You can also hardcode the list of identities in the role itself (not recommended).{{internal.gcp_service_accounts}}
, the list of allowed roles is sourced from user-specific traits. To update an existing user usetctl users update <username> --set-gcp-service-accounts ID_1,ID_2,ID_3,...
, whereID_N
is a full name of service account (e.g.teleport-user-1@my-account-123456.iam.gserviceaccount.com
)tsh logout; tsh login --proxy=...
.gcpapp
app withtsh app login gcpapp [--gcp-service-account ACCOUNT]
. The service account is optional if there is just one available. The service account name can be shortened by discarding domain (e.g.teleport-user-1
) as long as it doesn't make it ambigous.tsh gcloud ...
, e.g.tsh gcloud compute instances list
.tsh proxy gcloud
and follow printed instructions.Notes:
teleport-service
service account to your local machine and set theGOOGLE_APPLICATION_CREDENTIALS
env variable to its location. This is handful in development, but not recommended for production as the key file can be stolen. Example:GOOGLE_APPLICATION_CREDENTIALS=/path/to/teleport-service-my-account-123456-ee0011223344.json teleport start
teleport-service
which is inaccessible to Teleport users.