fugue / credstash

A little utility for managing credentials in the cloud
Apache License 2.0
2.06k stars 215 forks source link

Access control based on Groups (idea) #13

Open joonathan opened 9 years ago

joonathan commented 9 years ago

Would be good to see some sort of ACL capabilities for example based on IAM groups where Test applications would not have access to Production secrets etc.

As an example "myapp.db.prod" secret should be available only to IAM Groups "Admins" and "Production Environment" but not to "Test Environment" and "Developers". Admin group user should be able to list all secrets in the store.

Maybe somehow doable via transparently managing multiple KMS master keys?

a5an0 commented 9 years ago

You can actually already do something like that, but I suspect we could make it easier to manage.

Right now, let's say that you have two KMS master keys, dev and prod. If you do credstash -k dev put myapp.db.dev pass1234, it will do the key wrapping with the dev key (and doing -k prod will wrap with the prod key). now, when it comes time to get the value, KMS will use the correct master key to unwrap the data key. so if a particular IAM principal has access to do KMS.Decrypt with dev, but not with prod, then doing credstash get myapp.db.dev will work, but credstash get myapp.db.prod will fail.

So right now, you can use IAM policy (as well as policy on the keys themselves) to keep groups from accessing each others materials. That said, there are a bunch of things we could do to improve the experience. For example:

I love the idea of making it easy to set access control around things in credstash. Right now you can technically do it, but it's kind of ham handed, and you need to know a lot about IAM and KMS to make it work well without either shooting yourself in the foot or letting too many people touch things they shouldn't. What other things do you think would make this easier to manage?

joonathan commented 9 years ago

Thanks for your response.

Indeed, we can get pretty far with specifying the key on put and as it gets resolved correctly during get there is no additional overhead on services/deployment side.

I like your first idea of tracking the permissions on DDB as well. Maybe also make it possible to switch AWS profiles similarly to aws --profile <profile_name> cli usage.

a5an0 commented 9 years ago

Support for KMS encryption contexts (#18) was just merged in. This change gives us more nobs to turn with restricting the use of keys. You still have to manage the policy yourself, but the plumbing is there.

AlWilliamson commented 8 years ago

Just a thought, but you can also separate using different tables. For example using a Dev table and a Prod table. That allows use to limit access with IAM at a table level, lets you use the same credential name (i.e. myapp.db) and just make calls specifying the table based on an environment variable (or EC2 Tag). It would also keep list cleaner.

DanyC97 commented 8 years ago

i like what @AlWilliamson said, +1

rmmeans commented 8 years ago

You can get even more granular that this right now just using IAM directly. DynamoDB supports record level access - so technically, you could have an IAM role for an app server to access the DDB table, but only for (records) needed for that system - the credstash cli running on that server couldn't ask for the DB password of another product, for instance. See here: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/FGAC_DDB.html specifically with the conditions clauses

artburkart commented 6 years ago

With flags for passing in keys (-k), tables (-t), arns (-n) and/or profiles (p/AWS_PROFILE), I think all the bases have been covered by credstash. With these three/four pieces, I am able to separate access—for example—by AWS region with kms keys, by environment with dynamodb tables, and by users/groups with item conditions in my dynamodb IAM policies. Personally, I think it's convenient that credstash can help establish a default setup, but I don't really think it's necessary for it to generate all the tables, keys, and IAM policies for advanced use cases. As such, I would argue this ticket can be closed.