Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWS Security

Avatar for Jason Chan Jason Chan
October 22, 2014

AWS Security

Talk on AWS Security I gave at SaintCon 2014.

Avatar for Jason Chan

Jason Chan

October 22, 2014

More Decks by Jason Chan

Other Decks in Technology

Transcript

  1. AWS

  2. Create a user account Inventory your systems Update a firewall

    config Make a forensic image Disable a MFA token
  3. Guidance High-level • CSA and ENISA guidance AWS specific •

    Security Whitepaper • Risk and Compliance Whitepaper • Security Center and Compliance Center
  4. Shared responsibility tips Understand the model, and what AWS can't

    do Engage AWS for support - SSAE 16, PCI, etc.
  5. curl http://169.254.169.254/latest/meta-data/iam/security-credentials/s3access { "Code" : "Success", "LastUpdated" : "2012-04-26T16:39:16Z", "Type"

    : "AWS-HMAC", "AccessKeyId" : "AKIAIOSFODNN7EXAMPLE", "SecretAccessKey" : "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "Token" : "token", "Expiration" : "2012-04-27T22:39:16Z" }
  6. Users in AWS - Tips Don't use the root account

    Protect IAM keys Use IAM roles for EC2
  7. Users in AWS - Traps Keys have a way of

    finding themselves in GitHub No way to control access to EC2 metadata
  8. Two Permission Types 1. User-Based - Attached to a user,

    controls what the user can do (also applies to groups and roles) 2. Resource-Based - Attached to a resource, controls what can be done to the resource
  9. Bonus, Confusing Third Type • Resource-Level - Attached to a

    user, controls what the user can do, to which resource
  10. { "Statement": [ { "Action": [ "ses:SendEmail" ], "Effect": "Allow",

    "Resource": "*", "Condition": { "IpAddress": { "aws:SourceIp": "1.1.1.1" } } } ] }
  11. { "Statement": [ { "Effect": "Allow", "Action": "*", "Resource": "*"

    } ] } { "Statement": [ { "Action": "ses:*", "Effect": "Deny", "Resource": "*" }, { "Action": "iam:*", "Effect": "Deny", "Resource": "*" } ] }
  12. Creating policies • AWS has dozens of services • Hundreds

    of API calls across those services • Resource-level control and conditions provides tremendous granularity
  13. Permissions and policies - Traps Be careful with tag-based security

    Be careful with policy size limitations Be careful with non-specific policies
  14. Account segregation - Tips Test / Dev / Staging /

    Prod Compliance requirements Business units (billing boundaries) Core/platform vs. end-user
  15. Account segregation - Traps Cross-account limitations (VPC security groups, S3)

    Logistics and planning - AZ mapping, reservations and limits
  16. { "Records": [{ "eventVersion": "1.0", "userIdentity": { "type": "IAMUser", "principalId":

    "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:user/Alice", "accessKeyId": "EXAMPLE_KEY_ID", "accountId": "123456789012", "userName": "Alice" }, "eventTime": "2014-03-06T21:22:54Z", "eventSource": "ec2.amazonaws.com", "eventName": "StartInstances", "awsRegion": "us-west-2", "sourceIPAddress": "205.251.233.176", "userAgent": "ec2-api-tools 1.6.12.2", "requestParameters": { "instancesSet": { "items": [{ "instanceId": "i-ebeaf9e2" }] } },
  17. "responseElements": { "instancesSet": { "items": [{ "instanceId": "i-ebeaf9e2", "currentState": {

    "code": 0, "name": "pending" }, "previousState": { "code": 80, "name": "stopped" } }] } } }, ... additional entries ... ] }
  18. What is the most recent change to a security group?

    $ curl "http://edda/api/v2/aws/securityGroups/sg-0123456789;_diff;_all;_limit=2"
  19. $ curl "http://edda/api/v2/aws/securityGroups/sg-0123456789;_diff;_all;_limit=2" --- /api/v2/aws.securityGroups/sg-0123456789;_pp;_at=1351040779810 +++ /api/v2/aws.securityGroups/sg-0123456789;_pp;_at=1351044093504 @@ -1,33 +1,33

    @@ { "class" : "com.amazonaws.services.ec2.model.SecurityGroup", "description" : "App1", "groupId" : "sg-0123456789", "groupName" : "app1-frontend", "ipPermissions" : [ { "class" : "com.amazonaws.services.ec2.model.IpPermission", "fromPort" : 80, "ipProtocol" : "tcp", "ipRanges" : [ "10.10.1.1/32", "10.10.1.2/32", + "10.10.1.3/32", - "10.10.1.4/32" ], "toPort" : 80, "userIdGroupPairs" : [ ] } ], "ipPermissionsEgress" : [ ], "ownerId" : "2345678912345", "tags" : [ ], "vpcId" : null }