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

Check IAM permissions beforehand. Let non-essential actions fail due to lack of permissions #8

Open
tm-kn opened this issue Jun 27, 2018 · 4 comments

Comments

@tm-kn
Copy link
Member

tm-kn commented Jun 27, 2018

No description provided.

@tm-kn tm-kn changed the title Check permissions beforehand. Let non-essential actions fail if lack of permissions Check permissions beforehand. Let non-essential actions fail due to lack of permissions Jun 27, 2018
@tm-kn tm-kn changed the title Check permissions beforehand. Let non-essential actions fail due to lack of permissions Check IAM permissions beforehand. Let non-essential actions fail due to lack of permissions Jun 27, 2018
@nealtodd
Copy link
Member

nealtodd commented Jun 27, 2018

For reference, at the time of writing the minimum policies I needed to run through buckup without error were (in order of buckup needing them):

iam:ListAccountAliases
iam:GetUser
iam:CreateUser
iam:CreateAccessKey
iam:PutUserPolicy
s3:PutBucketPolicy

(If there are any errors due to lacking policies after ListAccountAliases the bucket name will be created but can't be used again on another run of buckup.)

@tm-kn
Copy link
Member Author

tm-kn commented Jun 27, 2018

The following policy seems to make it work. We probably need to document some better setup with restricting by bucket name, user name, etc.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowBuckup",
            "Effect": "Allow",
            "Action": [
                "iam:ListAccountAliases",
                "s3:PutBucketPolicy",
                "s3:CreateBucket",
                "iam:GetUser",
                "iam:CreateUser",
                "s3:PutBucketCORS",
                "s3:PutBucketVersioning",
                "iam:CreateAccessKey"
            ],
            "Resource": "*"
        }
    ]
}

@tm-kn
Copy link
Member Author

tm-kn commented Jun 28, 2018

Note: Tom suggests that we can try to check policies with https://docs.aws.amazon.com/IAM/latest/APIReference/API_SimulatePrincipalPolicy.html. That's probably a nice feature to have before stable release.

@thibaudcolas
Copy link
Member

This would be a very nice addition, especially since if you don’t set up the IAM permissions the bucket creation will succeed, meaning you have to go in the AWS console / use the AWS CLI to clean up after yourself before being able to use buckup again (which somewhat defeats the point of using buckup).

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

No branches or pull requests

3 participants