I am trying to setup permissions on a per-instance level on our GCP infrastructure (for example, can SSH on machine A but not on machine B) using GCloud IAM permissions.
However, I came across a weird behavior.
If I add a user to the GCloud project with only the Compute Viewer
permission, that user would be able to SSH on all the VM setup in the Compute Engine
section.
This makes no sense as the documentation itself states that you can't SSH with the Compute Viewer
: https://cloud.google.com/compute/docs/access/
Additionally, when I try to set permissions for each specific instance (by going in Compute Engine
> VM Instances
, selecting a specific instance and adding permissions from the permissions tab), those seem to have literally no effect.
Not sure if I missed something:
- why does
Compute Viewer
allow for SSH? - why does per-instance permissions have no effect?
gcloud compute os-login ssh-keys add
. When they did so, they were able to use their SSH key to ssh, but it did not last for long. In the meantime, all other users were not able to login correctly. This is consistent with what the documentation states byyou risk disrupting the ability of your project members to connect to instances.
Additionally, Google documentation recommend to use their own SSH key management mechanism (cloud.google.com/compute/docs/instances/#manage_access) - Simon Ninon