Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Reduce required permissions for the GCPCKMS auto-unsealer #5999

Merged
merged 1 commit into from
Jan 4, 2019
Merged

Reduce required permissions for the GCPCKMS auto-unsealer #5999

merged 1 commit into from
Jan 4, 2019

Conversation

sethvargo
Copy link
Contributor

This changes the behavior of the GCPCKMS auto-unsealer setup to attempt encryption instead of a key lookup. Key lookups are a different API method not covered by roles/cloudkms.cryptoKeyEncrypterDecrypter. This means users must grant an extended scope to their service account (granting the ability to read key data) which only seems to be used to validate the existence of the key.

Worse, the only roles that include this permission are overly verbose (e.g. roles/viewer which gives readonly access to everything in the project and roles/cloudkms.admin which gives full control over all key operations). This leaves the user stuck between choosing to create a custom IAM role (which isn't fun) or grant overly broad permissions.

By changing to an encrypt call, we get better verification of the unseal permissions and users can reduce scope to a single role.

@sethvargo
Copy link
Contributor Author

+@emilymye

chrishoffman
chrishoffman previously approved these changes Jan 4, 2019
Copy link
Contributor

@chrishoffman chrishoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did something similar with the Transit Autounseal for the same reasons.

@chrishoffman chrishoffman dismissed their stale review January 4, 2019 20:01

Small issue found.

briankassouf
briankassouf previously approved these changes Jan 4, 2019
This changes the behavior of the GCPCKMS auto-unsealer setup to attempt
encryption instead of a key lookup. Key lookups are a different API
method not covered by roles/cloudkms.cryptoKeyEncrypterDecrypter. This
means users must grant an extended scope to their service account
(granting the ability to read key data) which only seems to be used to
validate the existence of the key.

Worse, the only roles that include this permission are overly verbose
(e.g. roles/viewer which gives readonly access to everything in the
project and roles/cloudkms.admin which gives full control over all key
operations). This leaves the user stuck between choosing to create a
custom IAM role (which isn't fun) or grant overly broad permissions.

By changing to an encrypt call, we get better verification of the unseal
permissions and users can reduce scope to a single role.
@chrishoffman chrishoffman merged commit 9293594 into hashicorp:master Jan 4, 2019
@sethvargo sethvargo deleted the sethvargo/gckcpms_lower_perms branch January 4, 2019 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants