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

Prevent EBS snapshots from becoming public #60

Closed
KevinHock opened this issue Oct 22, 2020 · 3 comments
Closed

Prevent EBS snapshots from becoming public #60

KevinHock opened this issue Oct 22, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request research Research

Comments

@KevinHock
Copy link

KevinHock commented Oct 22, 2020

Encryption makes this unnecessary, but for completeness.

From the ec2:ModifySnapshotAttribute docs:

# Example
This example makes the snap-1234567890abcdef0 snapshot public, and gives the account with ID 111122223333 permission to create volumes from the snapshot.

# Sample Request
https://ec2.amazonaws.com/?Action=ModifySnapshotAttribute
&SnapshotId=snap-1234567890abcdef0
&CreateVolumePermission.Add.1.UserId=111122223333
&CreateVolumePermission.Add.1.Group=all
&AUTHPARAMS
@jdyke jdyke added enhancement New feature or request research Research labels Oct 24, 2020
@KevinHock
Copy link
Author

Maybe impossible? cc @jdyke

aws:ResourceTag/${TagKey}
ec2:Owner
ec2:ParentVolume
ec2:Region
ec2:ResourceTag/${TagKey}
ec2:SnapshotTime
ec2:VolumeSize

from the condition keys https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonec2.html

🤔

@mikefuller mikefuller self-assigned this Jan 8, 2021
@mikefuller
Copy link

@KevinHock, I have been doing some investigating on this and I'm not sure we can quite do what you are looking for. It is possible to create an SCP that prevents all snapshot permission modifications using a null check on the ec2:Attribute/CREATE_VOLUME_PERMISSION condition.

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "DenyEbsPublicSnapshot",
			"Effect": "Deny",
			"Action": "ec2:ModifySnapshotAttribute",
			"Resource": "arn:aws:ec2:*::snapshot/*",
			"Condition": {
				"Null": {
					"ec2:Attribute/CREATE_VOLUME_PERMISSION": "true"
				}
			}
		}
	]
}

This allows us to filter on someone attempting to make any permission change. But there is no condition key available that I can find to filter on the Group=all attribute value that would limit the deny statement to only Public sharing modifications. I think in most cases you wouldn't want to filter out all permission changes because it may be entirely legitimate to share a volume with another account.

If you have any other ideas definitely let us know and we can try them out.

@KevinHock
Copy link
Author

Makes sense, thank you @mikefuller !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research Research
Projects
None yet
Development

No branches or pull requests

3 participants