1

The default configuration of Google Compute Engine instances allows administrators to run all commands via sudo without specifying a password. This seems like a security weakness, because the theft of one SSH key belonging to an admin could allow unlimited access to every instance, and all data could be compromised. Requiring a password for sudo would provide a second level of security by preventing an attacker from obtaining root privileges. An attacker would also have to crack an admin's sudo password to access sensitive data or perform destructive acts.

It seems like it should be possible to configure sudo on each instance to require a password, but then each admin would then have to manually set a password on each instance. This approach would not scale well across many instances. Does Google Cloud Platform support any form of password management? If not, how can I require password for sudo in a way that scales well with many instances and multiple admins?

  • 1
    man sudoers for the password part, as far as managing passwords, you need a config management system like puppet/chef/etc for all your users – dmourati May 16 '16 at 3:08
  • So, you are saying that there is no way to manage sudo passwords using Google's cloud infrastructure, and I would have to manage them just like I would with non-cloud infrastructure. – Craig Finch May 18 '16 at 18:17
  • More like you are mixing responsibilities/layers of the problem. Sudo is managed at the OS layer. GCE is an IaaS that operates at a higher layer. There is a bootstrap requirement, you need to be able to login. Thats the only intersection. – dmourati May 18 '16 at 18:43
  • Did you have the chance to look at the Identity and Access Management Roles in this article?: cloud.google.com/compute/docs/access/iam – George Oct 31 '16 at 20:17
  • The behaviour is explained in this article. You can remove the default policy in the OS of the VM. After that you can create a image from that disk and generate new VMs using this image. – Carlos Nov 30 '16 at 21:54
1

You can limit the sudo access project wise through User Accounts feature which is currently in beta release. More information is mentioned here:

Root access

All Linux user accounts in your project are granted root access to your instances. By default, new Linux user accounts are added to the following user groups upon account creation:

gce-sudoers - Gives root access gce-users - General users group The gce-sudoers group is automatically maintained by the Cloud User Accounts service and contains every Linux user account in your project. If you wanted to restrict root access to certain accounts, remove the default policy at:

/etc/sudoers.d/gcua

Next, create your own group and add a configuration similar to the gcua file in the sudoers.d folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.