Secure Access to 100 AWS Accounts
segment.com
segment.com
It doesn't really explain it but to do this, the root account has to be enrolled for AWS Organization[1]. This is what is being used to handle all the accounts and consolidate the billing. It also allows to create rules span all the accounts. Recently terraform gained support for the Organization API[2] so it's possible to control the account list in a declarative manner.
The biggest issue is that now that there are a lot of accounts, the developers need a way to switch between them. Using the IAM assume-role mechanism is a good way to avoid needing a lot of AWS keys per developer.
I don't know if I agree with using Okta as it adds another party that now has access to AWS. I don't see the difference between having a AWS secret or and Okta secret in the keychain security-wise. Okta might provide audit logging facilities but so does AWS.
In either case you will need to generate a `~/.aws/config` per developer. There is also a Chrome plugin[3] that can read this file format and populate the AWS Console switch role. I don't know if the extension publisher is reputable yet as it gives a lot of access to the extension.
[1]: https://aws.amazon.com/organizations/
[2]: https://github.com/terraform-providers/terraform-provider-aw...
[3]: https://chrome.google.com/webstore/detail/aws-extend-switch-...
In particular, in Okta's SWA apps they have a setting for those apps to use the same password as the user's Okta password. If there's a way they do this without storing all of their user passwords unhashed, I couldn't figure it out and the Okta reps weren't able to provide a clear answer.
Edit: I _can_ think of one potential solution: Okta initially sets user's password to a random string, when you authenticate with Okta / change your Okta password, they use the unhashed version to make admin calls to update the apps' password and never persist it. But they didn't give any indication that this was the case.
I can see Amazon displacing these services over time (they have a lot of the components already) but last time I looked they weren’t there yet.
I don’t want it to seem like this is a sales pitch either. Okta has plenty of warts, odd decisions, glaringly obvious missing features and has done some bizarre 180s in terms of organizational direction.
It was a long time ago but one bug I won’t forget that was shocking: a combination of special characters in a password resulted in a sync failure for a couple of accounts. That’s bad on its own because it raises all kinds of questions about how they’re handling and sanitizing strings. But the whopper was that the errors presented to admins had the passwords in clear text. You would assume masking would be a key thing in their code and logging systems and it made me question if they even had masking at all if a user password made it all the way to the dashboard.
EDIT: https://docs.aws.amazon.com/organizations/latest/userguide/o...
"Warning: We strongly recommend that you do not attach SCPs to the root of your organization without thoroughly testing the impact that the policy has on accounts. Instead, create an OU that you can move your accounts into one at a time, or at least in small numbers, to ensure that you don't inadvertently lock users out of key services."
* create a new AWS account
* setup IAM and AWS Org
* add 2nd factor on the root account, put the Gemalto in a safe
Then add the "legacy" account to the org and slowly port all the resources to fresh new accounts.
Users authenticate to an internal website with ADFS (including MFA) and are then presented with a list of roles where they can either click through to the website assuming a role in that account for an hour, or click an option to access temporary credentials.
The AWS roles are deployed from our CI/CD pipeline to all of our AWS accounts, so we don't have to have user accounts anywhere and can still deploy features from our Pipeline without logging in.
We are also in the process of setting up automated account provisioning from our HR system, Workday. Based on the users team and job title, they'll be added into an Active Directory group which would then give them access to the resources required for their role.
Once complete, this will save the support team a lot of time!
I'll bring it up again. Personally I don't see why not!
If there was an emergency we have our root accounts to recover access, but it's a good point that we should probably have a second IDP as a backup.
P.S. Any chance of a link back in the mention of aws-vault in the article? (aws-vault author here)
We are sometimes wary about contributing stuff like this upstream because it's not always accepted, and then we are in a weird spot maintaining a fork (it happened with the bitly oauth proxy when we added okta support). I'll see what type of work it would take to make it fit in to aws-vault nicely!
This used to be the way Okta recommended integrating to AWS, but in the guide you linked[1] they are using pretty much exactly the same approach you did - authentication to an identity account (ops account in your terminology) then assume-role into the target account.
I can't see any major differences between the standard Okta approach and the way you outlined in your blog. Could let me know if I missed something?
[1] https://support.okta.com/help/servlet/fileField?retURL=/help...
- Detailed instructions for Google-federated login to the AWS Management Console through SAML are available [1], and worked more or less as described.
- CLI/API access is a bit trickier and less thoroughly documented, but is possible using the 'Web Identity Federation' feature [2]. Basically, you generate/refresh temporary AWS credentials by passing a Google OIDC token to the AssumeRoleWithWebIdentity API. The tricky part is keeping both your Google OIDC and AWS STS tokens conveniently refreshed. I wrote some open-source glue code for this that hooks into the AWS Ruby SDK and CLI [3]. It's still a little rough around the edges and not yet extracted into a standalone project, but it's been working well enough for my team over the last year.
[1] https://aws.amazon.com/blogs/security/how-to-set-up-federate...
[2] https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_pr...
[3] https://github.com/code-dot-org/code-dot-org/blob/staging/li...
https://aws.amazon.com/blogs/security/how-to-set-up-federate...
For example, if you want to run the Athena JDBC driver locally or read something from S3 in a longish (>1h) running Python script.
https://developer.atlassian.com/blog/2017/12/introducing-clo...
Is it because teams in different locations (US, EU etc.) can run semi-independently? How do you manage shared resources (e.g. S3 or RDS SQL servers) that need to be accessed from multiple regions, yet still maintain GDPR compliance?
The GDPR line is about improving our least privilege access story. There's a lot more to GDPR than that, though
For S3, it's more complicated because of object permissions and all the insanity that comes with cross-account writing etc.
Edit for more info: No explicit promotion process for containers. Engineers build images in our CI pipeline when their pull request is approved and merged to master, which is pushed to the hub account.
Generally you have: VPC peering between accounts, Network Access Control List (NACL) for VPC port control, security groups between instances (and some AWS services which uses SG to limit port access), IAM roles to authenticate and authorized certain AWS services to do things (e.gz Lambda to read S3 bucket) - but IAM and policies (bucket policies, SQS policies) govern authentication and authorization. Finally there is also organization service which allows you to control what AWS services are allowrd in a group of AWS accounts.
Sorry, on mobile so I can’t make a prettier list. I am generally disappointed at the complexity of authentication and authorization mechanisms exists for AWS services to be really honest.
Another option would be to allow only access from the internal network, but then you have to connect them somehow.
* internal traffic goes through VPC, AWS backone, and Direct Connect / VPN (company and AWS accessing each other). Worth noting that, all S3 requests used to go through the Internet, but now we can enable S3 endpoint so requests originated from VPC is now made within AWS backbones).
* incoming public traffic comes through AWS public infrastructure (e.g. load balancer) before handing off to some EC2 instances (the instance could either be in "public" subnet, or "private subnet")
There is a whole lot of architecture approaches highly dependent on the requirements, and I don't think we can discuss them here.
For one microservice to talk to the other one, if all within the same VPC, you just use security group (Network ACL "defends" subnet, but you are better off just using route table). If not within the same VPC, you can peer. If not within the same account, you can peer. I believe now you can peer region too. In some cases, you have to route traffic from VPC1 to VPC2 through your corporate routing...
That's putting too much trust in the network. You don't want one phished internal user to expose the entire set of services that developers all think of as "on a trusted network".
"You can create your own application in your VPC and configure it as an AWS PrivateLink-powered service (referred to as an endpoint service). Other AWS principals can create a connection from their VPC to your endpoint service using an interface VPC endpoint. You are the service provider, and the AWS principals that create connections to your service are service consumers."
[1] https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/endpo...
For example, IAM doesn't provide the granularity in resources and conditions that you'd want to effectively isolate the blast radius of developer keys. ec2:TerminateInstances didn't (doesn't?) support VPC level conditions, so being able to terminate one instance meant you could terminate all instances.
Similarly, you might want your engineering team to iam:PutUserPolicy in development, but have a much more restricted group in production which isn't possible with IAM today.
I've taken this pretty far in the past to attempt segmenting within one account, but always run into limits: https://github.com/witoff/self-service-iam
In theory yes. In practice, you will achieve the opposite of that.
Developers and ops will have to juggle between 10 keys and accounts to get anything. The keys will end up saved and written all over the systems. It will be impossible to have audit between all the accounts and access.
Per-account isolation is great for security and especially reliability, if you run in to constant ratelimit issues like we do.
That said, it’s not perfect and there’s probably plenty of resources it wouldn’t work for. It’s also comparatively fragile.
Tools like aws-vault and now aws-okta make securing credentials a piece of cake.
---
There are advantages in multiple accounts, for organization and security. Random example: adding tags to ec2 instances is an account-wide permission, for all ec2 instances. Multiple various things by 100 and accounts make sense.
You end up needing to constantly grant and revoke access to individual resources if you went this route. Instead, it's nice to give engineers access to everything that's in their account, and not worry about IAM policies.
As with all of AWS (and software, and life) there is no one size fits all answer.
It sucks not being able to fix the production A record because somebody did a lot of changes on the staging zone.