SlideShare uma empresa Scribd logo
1 de 103
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
Architecting Container Infrastructure
for Security and Compliance
M i t c h B e a u m o n t , S o l u t i o n s A r c h i t e c t , A W S
K e l v i n Z h u , P r o d u c t i v i t y T e a m L e a d D e v e l o p e r , O k t a
C O N 4 0 6
N o v e m b e r 3 0 , 2 0 1 7
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
“If everything seems under control,
you're not going fast enough.”
—Mario Andretti
Picture: 1990 Indy 500 / DoctorIndy / License
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Mario Andretti crashed in the 1992 Indianapolis 500. The reason?
He lost control of his car under acceleration and smashed into the wall.
Mario Andretti crashed in the 1992 Indianapolis 500.
The reason? He lost control of his car under
acceleration and smashed into the wall.
Picture: F1 Collision / TMWolf / License© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image Security Credentials and Secrets
Kernel Security Denial of Service Container Breakouts
Architecting a secure infrastructure
Runtime Security
503
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Containers as opposed to VMs
Server
Host OS
Hypervisor
Guest OS Guest OS
Bins/Libs Bins/Libs
Cats App Cats App
Server
Host OS
Container Engine
Bins/Libs
CatsApp
CatsApp
Bins/Libs
DogsApp
DogsApp
Virtual Machines Containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Containers and VMs
Server
Host OS
Container Engine
Bins/Libs
CatsApp
CatApp
Bins/Libs
DogsApp
DogsApp
Hypervisor
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Machine Image builds
EC2 instance
ECS Optimized
AMI
• ECS Optimised Amazon Linux
• RHEL
• Ubuntu
• Container Centric OS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Machine Image builds
EC2 instance EC2 instance
Foundational AMI
• Security best
practices
• Provisioners
• Loggers
• Config, and so on
ECS Optimized
AMI
• ECS Optimised Amazon Linux
• RHEL
• Ubuntu
• Container Centric OS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Machine Image Builds
EC2 instance
• ECS Optimised Amazon Linux
• RHEL
• Ubuntu
• Container Centric OS
EC2 instance
Foundational
AMI
• Frameworks
• Applications
EC2 instance
Full Stack AMI
• Security best
practices
• Provisioners
• Loggers
• Config, and so on
ECS Optimized
AMI
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building an AMI pipeline
DevOps
Persona
Code
Repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building an AMI pipeline
DevOps
Persona
Code
Repository
CI/CD
Pipeline
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building an AMI pipeline
DevOps
Persona
Code
Repository
CI/CD
Pipeline
Base AMI
AMI
Builder
ECS
Optimized
AMI
Public
Catalog
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building an AMI pipeline
DevOps
Persona
Code
Repository
CI/CD
Pipeline
Base AMI
AMI
Builder
ECS
Optimized
AMI
Public
Catalog
Customer
AMI
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building an AMI pipeline
DevOps
Persona
Code
Repository
CI/CD
Pipeline
Base AMI
AMI
Builder
ECS
Optimized
AMI
Public
Catalog
CloudFormation
Customer
AMI
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Limiting resources
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Limiting resources
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Limiting resources
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Limiting resources
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Limiting resources
• Define your resource limits up front
• It’s not just memory and CPU.
• Monitor usage
• Leverage Auto Scaling
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation – Placement constraints
aws ecs put-attributes --cluster mycatsanddogscluster --attributes 
“name=CDE,value=true,targettype=container-instance,targetId=<blahblahblah>”
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation – Placement constraints
aws ecs put-attributes --cluster mycatsanddogscluster --attributes 
“name=CDE,value=true,targettype=container-instance,targetId=<blahblahblah>”
"placementConstraints": [
{
"expression":"attribute:CDE==true",
"type": "memberOf"
}]
Task Definition
Container
Instance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation- Placement constraints
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
C D E
E C S T a s k
C a t s
C o n t a i n e r
E C S T a s k
D o g s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
N o n - C D E
E C S T a s k
D o g s
C o n t a i n e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation- Placement Constraints
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
C D E
E C S T a s k
C a t s
C o n t a i n e r
E C S T a s k
D o g s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
N o n - C D E
E C S T a s k
D o g s
C o n t a i n e r
This doesn’t
need to happen!
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Segmentation – Task ENI
E C S T a s k
C a t s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
S e c u r i t y
G r o u p
E C S T a s k
C a t s
C o n t a i n e r
S e c u r i t y
G r o u p
E C S T a s k
D o g s
C o n t a i n e r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
S e c u r i t y
G r o u p
E C S T a s k
D o g s
C o n t a i n e r
S e c u r i t y
G r o u p
1. Pre ENI Attachment: The primary ENI
(eth0) is in the default namespace
Default/Root Global Namespace
docker0
eth0
lo
1. Pre ENI Attachment: The primary ENI
(eth0) is in the default namespace
2. ENI Attached: The new ENI (eth1) is in
the default namespace.
Default/Root Global Namespace Default/Root Global Namespace
docker0 docker0
eth0
lo lo
eth0
eth1
Default/Root Global Namespace Default/Root Global Namespace
Default/Root Global Namespace
docker0 docker0
eth0
lo lo
eth0
eth1
lo
eth0
docker0
ecs0
eth1
lo ve-
c1
3. ENI Provisioned: The ECS Agent
invokes CNI plugins to move the new ENI
into a new namespace and configure it
with the addresses and routes.
1. Pre ENI Attachment: The primary ENI
(eth0) is in the default namespace
2. ENI Attached: The new ENI (eth1) is in
the default namespace.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Capabilities
Kernel
Server
Cats Container Dogs Container
NET_BIND_SERVICE CHOWN
• AUDIT_CONTROL
• BLOCK_SUSPEND
• DAC_OVERRIDE
• MKNOD
• …
• …
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
”LinuxParameters": {
”capabilities": {
add: [“AUDIT_CONTROL”, ...],
drop: [“MKNOD”, ...]
}
}
docker run --cap-drop ALL --cap-add ..
Dropping and adding capabilities
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Do you really know your image?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Layers, binaries, and dependencies, oh my!
/usr/bin/passwd
/usr/bin/gpasswd
/usr/bin/chsh
/usr/bin/chfn
/usr/bin/newgrp
/bin/su
/bin/umount
/bin/mount
$ find / -user root -perm -4000 -print
Do I need binaries with SUID flag?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Layers, binaries, and dependencies, oh my!
IMAGE CREATED CREATED BY SIZE
a8bdc7fdaa4f 2 weeks ago /bin/sh -c #(nop) CMD ["httpd-foreground"] 0B
<missing> 2 weeks ago /bin/sh -c #(nop) EXPOSE 80/tcp 0B
<missing> 2 weeks ago /bin/sh -c #(nop) COPY file:761e313354b918... 133B
<missing> 2 weeks ago /bin/sh -c set -eux; buildDeps=" bzip2... 9.72MB
<missing> 2 weeks ago /bin/sh -c #(nop) ENV APACHE_DIST_URLS=ht... 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_PATCHES= 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_SHA256=777753... 0B
<missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_VERSION=2.4.29 0B
<missing> 4 weeks ago /bin/sh -c apt-get update && apt-get inst... 44.2MB
<missing> 4 weeks ago /bin/sh -c { echo 'deb http://deb.debian... 161B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV OPENSSL_VERSION=1.0... 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV NGHTTP2_VERSION=1.1... 0B
<missing> 4 weeks ago /bin/sh -c #(nop) WORKDIR /usr/local/apache2 0B
<missing> 4 weeks ago /bin/sh -c mkdir -p "$HTTPD_PREFIX" && ch... 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PATH=/usr/local/apa... 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV HTTPD_PREFIX=/usr/l... 0B
<missing> 4 weeks ago /bin/sh -c echo 'deb http://deb.debian.org... 55B
<missing> 4 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ADD file:55b071e2cfc3ea2... 123MB
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Best practices
• Signing container images (Docker content trust)
• Set filesystems to be read-only (readonlyRootFilesystem)
• Remove setuid/setgid binaries from images (defang)
• Set containers to run as non-root user
• Consider running static binaries
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image security
Trusted Images
• ECR
• docker-hub-enterprise
• elastic.io/running-a-
docker-private-registry-
on-ec2
Minimal OS Base
Images
• Minimum OS (alpine etc)
• Docker cis-docker-bench
• Image signing
Container
Vulnerability
Scanning
• TwistLock
• Clair
• NueVector
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevSecOps container pipeline
Developers Security Engineers Ops Engineers
AWS CodeCommit
Task Definition
Dockerfile
FROM centos:centos7
MAINTAINER cb@demo.com
RUN yum -y update
RUN yum -y install openssh-
server U
SER sshduser
EXPOSE 5432
ENTRYPOINT sshd
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevSecOps container pipeline
Docker image
AWS
CodeBuild
Developers Security Engineers Ops Engineers
Task Definition
AWS CodeCommit
Dockerfile
FROM centos:centos7
MAINTAINER cb@demo.com
RUN yum -y update
RUN yum -y install openssh-
server U
SER sshduser
EXPOSE 5432
ENTRYPOINT sshd
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevSecOps container pipeline
Docker image
AWS
CodeBuild
Validate Configuration > Merge >
 python ./check_dockerfile.py
./examples/Dockerfile-demo
|jq ".warnings.warnings[].message"
"yum clean all is not used"
"installing SSH in a container is not recommended"
"No 'USER' instruction"
Developers Security Engineers Ops Engineers
AWS CodeCommit
Task Definition
Dockerfile
FROM centos:centos7
MAINTAINER cb@demo.com
RUN yum -y update
RUN yum -y install openssh-
server U
SER sshduser
EXPOSE 5432
ENTRYPOINT sshd
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevSecOps container pipeline
Docker image
AWS
CodeBuild
Validate Configuration > Merge >
 python ./check_dockerfile.py
./examples/Dockerfile-demo
|jq ".warnings.warnings[].message"
"yum clean all is not used"
"installing SSH in a container is not recommended"
"No 'USER' instruction"
Developers Security Engineers Ops Engineers
AWS CodeCommit
0
50
100
150
DEV INT
TEST QA
PROD
Vulnerabilities
Low Medium High
Scan Docker Image > Publish >
Task Definition
Dockerfile
FROM centos:centos7
MAINTAINER cb@demo.com
RUN yum -y update
RUN yum -y install openssh-
server U
SER sshduser
EXPOSE 5432
ENTRYPOINT sshd
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DevSecOps container pipeline
Amazon ECR
Docker image
AWS
CodeBuild
Validate Configuration > Merge >
 python ./check_dockerfile.py
./examples/Dockerfile-demo
|jq ".warnings.warnings[].message"
"yum clean all is not used"
"installing SSH in a container is not recommended"
"No 'USER' instruction"
Developers Security Engineers Ops Engineers
AWS CodeCommit
0
50
100
150
DEV INT
TEST QA
PROD
Vulnerabilities
Low Medium High
Scan Docker Image > Publish >
Task Definition
Dockerfile
FROM centos:centos7
MAINTAINER cb@demo.com
RUN yum -y update
RUN yum -y install openssh-
server U
SER sshduser
EXPOSE 5432
ENTRYPOINT sshd
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Storing secrets in environment variables
• Suggested by 12-factor apps (III. Config)
• Environment variables can be seen in too many
places
• Linked containers
• ECS API calls
• Docker inspect
• Can’t be deleted
https://12factor.net/
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Protecting secrets using IAM roles for
tasks
Benefits
• Simplify usage of AWS SDKs in containers
• Credential isolation between tasks/container
• Authorization per task/container
• Auditability in Amazon CloudTrail with taskArn
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM EC2 roles
Cats
Contai ner
Dogs
Contai ner
C o n t a i n e r I n s t a n c e
E C S T a s k E C S T a s k
C a t s B u c k e t
D o g s
B u c k e t
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM task roles
Cats
Contai ner
Dogs
Contai ner
C o n t a i n e r I n s t a n c e
E C S T a s k E C S T a s k
C a t s B u c k e t
D o g s
B u c k e t
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM roles for tasks, explained
1. ECS agent periodically queries ECS control plane
2. Control plane generates ID token
 Auto-rotated
3. ECS agent:
 Constructs HTTP URL for each container
 Sets AWS_CREDENTIALS_ENDPOINT in HostConfig
4. AWS SDK extracts URL
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon S3-based secrets storage
• Secrets stored in S3 bucket
• Accessed via IAM roles for EC2 or IAM roles for tasks
• Enforce encryption at rest and flight via IAM policies and KMS
• Use VPC endpoint for S3 to lock down access from certain VPCs
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2 systems manager parameter
store
• Secrets stored in SSM parameter store
• Accessed via IAM roles for EC2 or IAM roles for tasks
• Enforce encryption at rest and flight via IAM policies and KMS
• Govern permission to decrypt using specific KMS through IAM policy
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using IAM roles to retrieve secrets
Cats
Contai ner
C o n t a i n e r I n s t a n c e
E C S T a s k
Parameter Store
secretStringAWS KMS
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Kernel and Host
Security
Denial of
Service
Container
Breakouts
Image
Security
Secrets Runtime
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
VPC flow logs and Task ENI
E C S T a s k
C a t s
C o n t a i n e
r
C o n t a i n e r I n s t a n c e
S e c u r i t y G r o u p
S e c u r i t y
G r o u p
E C S T a s k
D o g s
C o n t a i n e
r
S e c u r i t y
G r o u p
630247214269 eni-0123456a 10.0.1.221
10.76.2.101 27039 22 6 5 268 1466491141
1466491200 REJECT OK
22
StopTask: {
task: “52c…”
}
$ docker diff / inspect
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Access Control Cloud Native
Firewalling
Runtime Defense
Compliance Vulnerability
Management
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
Container Security at Okta
K e l v i n Z h u – P r o d u c t i v i t y T e a m L e a d D e v e l o p e r
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Topics
• How we use containers
• How we secure:
• Hosts
• Containers
• Images
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What security is to us
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Keeping it reliable
• Security breaches have the potential to bring down our infrastructure
• Improper use of secrets can cause unexpected and damaging effects
• Bad security results in costly problems! But with automation it doesn’t have to
be hard!
• We’ll focus on a few examples of how we apply security principles to our Docker
containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How we use containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
High-level flow
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
High level flow
• Developer writes code and commits to GitHub
• Bacon Web application receives commit and processes into test runs
• Test runs inserted as messages to an AWS SQS queue
• ECS cluster of instances pick up messages from SQS queue and run them on
Docker containers
• Test results reported back to Bacon Web application
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container generation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container generation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container generation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container generation and usage
• Individual runs generate artifacts, some of which are Docker artifacts
• Docker images uploaded to repositories
• Individual Amazon ECS clusters brought up by AWS CloudFormation for either CI
or application images
• Application images deployed to Amazon ECS services
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deployment scale
• Two different types of deployments:
• CI scales up to thousands and down to just a few containers according to
messages in queue
• One time use containers that finish a task within an hour
• Almost no containers necessary overnight and during weekends
• Applications scale up and down according to web traffic
• Longer lived containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container host security
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Components of host security
• AMI
• Accessibility
• Ease of change
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Locking down the AMI
• The very packages we install are potential threats!
• Viruses
• Backdoors
• Creation of a hardened AMI
• Even if an installed package is unused, if a vulnerability is discovered
patching is required!
• AMI with only minimum necessary to run application
• Follow Center of Internet Security (CIS) checklists to ensure generated
AMIs are secure
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Locking down the AMI
Steps to build, test, and certify an AMI
• Define packer template
• Test: run CIS
• Share foundation AMI to DMZ account
• Share foundation AMI to other AWS
accounts
• Delete foundation AMI from originating
AWS account
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Preventing unauthorized access
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Preventing unauthorized access
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Preventing unauthorized access
• All hosts behind the VPC
• Only users with VPN can communicate with hosts
• Security groups to limit approved traffic between hosts
• SSH keys given only to trusted set of users
• Regular rotation to prevent leaking
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ease of change
• Always prepare for the worst case
• Zero days!
• Time is of the essence in minimizing damage
• To enable easy patching, AMI creation is hooked into the CI system
aws ec2 run-instances --count 1
aws ec2 wait instance-status-ok --instance-id ${INSTANCE_ID}
aws ec2 create-image --instance-id ${INSTANCE_ID}
aws ec2 wait image-available --image-ids ${IMAGE_ID}
aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
UpdatePolicy:
AutoScalingRollingUpdate
MaxBatchSize: 5
MinInstancesInService: 5
PauseTime: “PT10M”
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Malicious users
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Ease of change
• AWS CloudFormation for each Amazon ECS service
• Auto Scaling used to reduce reliance on individual hosts staying alive
• If a host becomes compromised or starts failing, terminate it
and allow a new one to come up
• Auto replacement of all hosts every day ensures manual
patches do not occur
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container security
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Credentials on containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Credentials on containers
• Industry standards
• Pull credentials from external protected storage encrypted both on disk
and in transit into flat file available within container
• Pull credentials from external protected storage encrypted both on disk
and in transit into memory (slightly better)
• Both approaches allow anyone with access to code run in container to retrieve the
secrets!
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Protecting creds
• The next step up!
• Containers run in protected networks to prevent unauthorized direct
access
• Standard and parameterized code that is run on containers and
modification disallowed
• Sanitize logs and output files for any retrieved secrets
• Prevents ability to sniff out secrets and prevents leaks
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Service access
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Minimizing service access
• Containers need access to services, but only the minimal set they actually need!
• Task definitions associated with each Amazon ECS task/service type given their
own task IAM role
• Avoid use of “*” in access policies!
• Access advisor – Remove access to unnecessary services
• CloudTrail logs – More granular view into exactly which resources are
accessed
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image security
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Container generation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Docker within Docker!
• By mounting Docker from the host to the container, we can run Docker and
Docker Compose inside the container
• -v /usr/bin/docker:/usr/bin/docker
• Utilized in the CI system to test Docker images the same way the are deployed
• Allows repeatable building of Docker images in ECS within immutable containers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image creation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image creation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image creation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image creation and usage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image creation and usage
• No repository code built into images
• First step: pull down credentials (locked behind IAM roles)
• Second step: clone code or artifacts to actually run onto images
• Prevents leakage of information if images are stolen
• Even if image stolen, running the image will fail if user does not have the
right IAM role to get credentials
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Packages and registries
• Images build off of internal base image configured to only pull from internal
package repository
• Packages in internal repository vetted by security team
• Installed packages pinned to specific versions
• Amazon ECR
• More performant so utilize as storage for security approved images that
are used on clusters
• Artifactory
• Storage for intermediate images and artifacts for longer-term storage
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key takeaways
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Key takeaways
• Protect from unauthorized access
• VPC and security groups to limit approved network traffic
• IAM roles to limit per task access to creds and services
• Minimize surface area for problems
• Limit packages installed
• Be prepared to fix issues
• Constant patching necessitates agile change infrastructure
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

Mais conteúdo relacionado

Mais procurados

CON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolCON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolAmazon Web Services
 
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017Amazon Web Services
 
Containers on AWS - State of the Union - CON201 - re:Invent 2017
Containers on AWS - State of the Union - CON201 - re:Invent 2017Containers on AWS - State of the Union - CON201 - re:Invent 2017
Containers on AWS - State of the Union - CON201 - re:Invent 2017Amazon Web Services
 
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...Amazon Web Services
 
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Amazon Web Services
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeAmazon Web Services
 
CON307_Building Effective Container Images
CON307_Building Effective Container ImagesCON307_Building Effective Container Images
CON307_Building Effective Container ImagesAmazon Web Services
 
Deep Dive into Amazon EKS - CON409 - re:Invent 2017
Deep Dive into Amazon EKS - CON409 - re:Invent 2017Deep Dive into Amazon EKS - CON409 - re:Invent 2017
Deep Dive into Amazon EKS - CON409 - re:Invent 2017Amazon Web Services
 
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Amazon Web Services
 
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Amazon Web Services
 
STG203_Get Rid of Tape and Modernize Backup with AWS
STG203_Get Rid of Tape and Modernize Backup with AWSSTG203_Get Rid of Tape and Modernize Backup with AWS
STG203_Get Rid of Tape and Modernize Backup with AWSAmazon Web Services
 
CMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSCMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSAmazon Web Services
 
DEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceDEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceAmazon Web Services
 
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017Amazon Web Services
 
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...Amazon Web Services
 
Amazon EC2 Foundations - CMP203 - re:Invent 2017
Amazon EC2 Foundations - CMP203 - re:Invent 2017Amazon EC2 Foundations - CMP203 - re:Invent 2017
Amazon EC2 Foundations - CMP203 - re:Invent 2017Amazon Web Services
 
NET302_Global Traffic Management with Amazon Route 53
NET302_Global Traffic Management with Amazon Route 53NET302_Global Traffic Management with Amazon Route 53
NET302_Global Traffic Management with Amazon Route 53Amazon Web Services
 
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)Amazon Web Services
 
SRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeSRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeAmazon Web Services
 
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...Amazon Web Services
 

Mais procurados (20)

CON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lolCON317_Advanced container management at catsndogs.lol
CON317_Advanced container management at catsndogs.lol
 
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
Interstella 8888: CICD for Containers on AWS - CON319 - re:Invent 2017
 
Containers on AWS - State of the Union - CON201 - re:Invent 2017
Containers on AWS - State of the Union - CON201 - re:Invent 2017Containers on AWS - State of the Union - CON201 - re:Invent 2017
Containers on AWS - State of the Union - CON201 - re:Invent 2017
 
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...
CTD307_Case Study How Mobile Device Service Company Asurion Architected Its A...
 
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
Build a Java Spring Application on Amazon ECS - CON332 - re:Invent 2017
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
 
CON307_Building Effective Container Images
CON307_Building Effective Container ImagesCON307_Building Effective Container Images
CON307_Building Effective Container Images
 
Deep Dive into Amazon EKS - CON409 - re:Invent 2017
Deep Dive into Amazon EKS - CON409 - re:Invent 2017Deep Dive into Amazon EKS - CON409 - re:Invent 2017
Deep Dive into Amazon EKS - CON409 - re:Invent 2017
 
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017Batch Processing with Containers on AWS - CON304 - re:Invent 2017
Batch Processing with Containers on AWS - CON304 - re:Invent 2017
 
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
 
STG203_Get Rid of Tape and Modernize Backup with AWS
STG203_Get Rid of Tape and Modernize Backup with AWSSTG203_Get Rid of Tape and Modernize Backup with AWS
STG203_Get Rid of Tape and Modernize Backup with AWS
 
CMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWSCMP209_Getting started with Docker on AWS
CMP209_Getting started with Docker on AWS
 
DEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceDEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 Service
 
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017
Birds of a Feather: Containers and Open Source at AWS - CON205 - re:Invent 2017
 
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...
Living on the Edge, It’s Safer Than You Think! Building Strong with Amazon Cl...
 
Amazon EC2 Foundations - CMP203 - re:Invent 2017
Amazon EC2 Foundations - CMP203 - re:Invent 2017Amazon EC2 Foundations - CMP203 - re:Invent 2017
Amazon EC2 Foundations - CMP203 - re:Invent 2017
 
NET302_Global Traffic Management with Amazon Route 53
NET302_Global Traffic Management with Amazon Route 53NET302_Global Traffic Management with Amazon Route 53
NET302_Global Traffic Management with Amazon Route 53
 
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)
STG307_Deep Dive on Amazon Elastic File System (Amazon EFS)
 
SRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeSRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the Edge
 
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...
STG330_Case Study How Experian Leverages Amazon EC2, EBS, and S3 with Clouder...
 

Semelhante a Architecting Container Infrastructure for Security and Compliance - CON406 - re:Invent 2017

Introduction to EKS (AWS User Group Slovakia)
Introduction to EKS (AWS User Group Slovakia)Introduction to EKS (AWS User Group Slovakia)
Introduction to EKS (AWS User Group Slovakia)Vladimir Simek
 
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017Amazon Web Services
 
Containers on AWS - re:Invent Comes to London 2.0
Containers on AWS - re:Invent Comes to London 2.0Containers on AWS - re:Invent Comes to London 2.0
Containers on AWS - re:Invent Comes to London 2.0Amazon Web Services
 
re:Invent CON320 Tracing and Debugging for Containerized Services
re:Invent CON320 Tracing and Debugging for Containerized Servicesre:Invent CON320 Tracing and Debugging for Containerized Services
re:Invent CON320 Tracing and Debugging for Containerized ServicesCalvin French-Owen
 
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017Amazon Web Services
 
K8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSK8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSAmazon Web Services
 
Amazon Elastic Container Service for Kubernetes (Amazon EKS)
Amazon Elastic Container Service for Kubernetes (Amazon EKS)Amazon Elastic Container Service for Kubernetes (Amazon EKS)
Amazon Elastic Container Service for Kubernetes (Amazon EKS)Amazon Web Services
 
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...Amazon Web Services
 
CON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesCON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesAmazon Web Services
 
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...Amazon Web Services
 
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesGPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesAmazon Web Services
 
Alexa連携デバイスクラウドを構成するAWS ソリューション
Alexa連携デバイスクラウドを構成するAWS ソリューションAlexa連携デバイスクラウドを構成するAWS ソリューション
Alexa連携デバイスクラウドを構成するAWS ソリューションToshiaki Enami
 
Devoxx: Building AI-powered applications on AWS
Devoxx: Building AI-powered applications on AWSDevoxx: Building AI-powered applications on AWS
Devoxx: Building AI-powered applications on AWSAdrian Hornsby
 
Latam virtual event_keynote-pt-br_americo
Latam virtual event_keynote-pt-br_americoLatam virtual event_keynote-pt-br_americo
Latam virtual event_keynote-pt-br_americoSandro Borges
 
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...Amazon Web Services
 
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...Amazon Web Services
 
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...Amazon Web Services
 
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...Amazon Web Services
 

Semelhante a Architecting Container Infrastructure for Security and Compliance - CON406 - re:Invent 2017 (20)

Introduction to EKS (AWS User Group Slovakia)
Introduction to EKS (AWS User Group Slovakia)Introduction to EKS (AWS User Group Slovakia)
Introduction to EKS (AWS User Group Slovakia)
 
Containers - Amazon EKS
Containers - Amazon EKSContainers - Amazon EKS
Containers - Amazon EKS
 
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017
NEW LAUNCH! Introducing Amazon EKS - CON215 - re:Invent 2017
 
Containers on AWS - re:Invent Comes to London 2.0
Containers on AWS - re:Invent Comes to London 2.0Containers on AWS - re:Invent Comes to London 2.0
Containers on AWS - re:Invent Comes to London 2.0
 
re:Invent CON320 Tracing and Debugging for Containerized Services
re:Invent CON320 Tracing and Debugging for Containerized Servicesre:Invent CON320 Tracing and Debugging for Containerized Services
re:Invent CON320 Tracing and Debugging for Containerized Services
 
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017
NEW LAUNCH! Introduction to Amazon GuardDuty - SID218 - re:Invent 2017
 
K8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSK8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKS
 
Kubernetes on AWS
Kubernetes on AWSKubernetes on AWS
Kubernetes on AWS
 
Amazon Elastic Container Service for Kubernetes (Amazon EKS)
Amazon Elastic Container Service for Kubernetes (Amazon EKS)Amazon Elastic Container Service for Kubernetes (Amazon EKS)
Amazon Elastic Container Service for Kubernetes (Amazon EKS)
 
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
NEW LAUNCH! AWS PrivateLink: Bringing SaaS Solutions into Your VPCs and Your ...
 
CON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesCON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized Services
 
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...
Building the Largest Repo for Serverless Compliance-as-Code - SID205 - re:Inv...
 
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesGPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
 
Alexa連携デバイスクラウドを構成するAWS ソリューション
Alexa連携デバイスクラウドを構成するAWS ソリューションAlexa連携デバイスクラウドを構成するAWS ソリューション
Alexa連携デバイスクラウドを構成するAWS ソリューション
 
Devoxx: Building AI-powered applications on AWS
Devoxx: Building AI-powered applications on AWSDevoxx: Building AI-powered applications on AWS
Devoxx: Building AI-powered applications on AWS
 
Latam virtual event_keynote-pt-br_americo
Latam virtual event_keynote-pt-br_americoLatam virtual event_keynote-pt-br_americo
Latam virtual event_keynote-pt-br_americo
 
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
DEV325_Application Deployment Techniques for Amazon EC2 Workloads with AWS Co...
 
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...
Security at Scale: How Autodesk Leverages Native AWS Technologies to Provide ...
 
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...
ARC306_High Resiliency & Availability Of Online Entertainment Communities Usi...
 
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...
Cache Me If You Can Minimizing Latency While Optimizing Cost Through Advanced...
 

Mais de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Mais de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Architecting Container Infrastructure for Security and Compliance - CON406 - re:Invent 2017

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Architecting Container Infrastructure for Security and Compliance M i t c h B e a u m o n t , S o l u t i o n s A r c h i t e c t , A W S K e l v i n Z h u , P r o d u c t i v i t y T e a m L e a d D e v e l o p e r , O k t a C O N 4 0 6 N o v e m b e r 3 0 , 2 0 1 7
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. “If everything seems under control, you're not going fast enough.” —Mario Andretti Picture: 1990 Indy 500 / DoctorIndy / License © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Mario Andretti crashed in the 1992 Indianapolis 500. The reason? He lost control of his car under acceleration and smashed into the wall. Mario Andretti crashed in the 1992 Indianapolis 500. The reason? He lost control of his car under acceleration and smashed into the wall. Picture: F1 Collision / TMWolf / License© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image Security Credentials and Secrets Kernel Security Denial of Service Container Breakouts Architecting a secure infrastructure Runtime Security 503
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Containers as opposed to VMs Server Host OS Hypervisor Guest OS Guest OS Bins/Libs Bins/Libs Cats App Cats App Server Host OS Container Engine Bins/Libs CatsApp CatsApp Bins/Libs DogsApp DogsApp Virtual Machines Containers
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Containers and VMs Server Host OS Container Engine Bins/Libs CatsApp CatApp Bins/Libs DogsApp DogsApp Hypervisor
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Machine Image builds EC2 instance ECS Optimized AMI • ECS Optimised Amazon Linux • RHEL • Ubuntu • Container Centric OS
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Machine Image builds EC2 instance EC2 instance Foundational AMI • Security best practices • Provisioners • Loggers • Config, and so on ECS Optimized AMI • ECS Optimised Amazon Linux • RHEL • Ubuntu • Container Centric OS
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Machine Image Builds EC2 instance • ECS Optimised Amazon Linux • RHEL • Ubuntu • Container Centric OS EC2 instance Foundational AMI • Frameworks • Applications EC2 instance Full Stack AMI • Security best practices • Provisioners • Loggers • Config, and so on ECS Optimized AMI
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building an AMI pipeline DevOps Persona Code Repository
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building an AMI pipeline DevOps Persona Code Repository CI/CD Pipeline
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building an AMI pipeline DevOps Persona Code Repository CI/CD Pipeline Base AMI AMI Builder ECS Optimized AMI Public Catalog
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building an AMI pipeline DevOps Persona Code Repository CI/CD Pipeline Base AMI AMI Builder ECS Optimized AMI Public Catalog Customer AMI
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Building an AMI pipeline DevOps Persona Code Repository CI/CD Pipeline Base AMI AMI Builder ECS Optimized AMI Public Catalog CloudFormation Customer AMI
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Limiting resources E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Limiting resources E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Limiting resources E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Limiting resources E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Limiting resources • Define your resource limits up front • It’s not just memory and CPU. • Monitor usage • Leverage Auto Scaling
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation – Placement constraints aws ecs put-attributes --cluster mycatsanddogscluster --attributes “name=CDE,value=true,targettype=container-instance,targetId=<blahblahblah>”
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation – Placement constraints aws ecs put-attributes --cluster mycatsanddogscluster --attributes “name=CDE,value=true,targettype=container-instance,targetId=<blahblahblah>” "placementConstraints": [ { "expression":"attribute:CDE==true", "type": "memberOf" }] Task Definition Container Instance
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation- Placement constraints E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e C D E E C S T a s k C a t s C o n t a i n e r E C S T a s k D o g s C o n t a i n e r C o n t a i n e r I n s t a n c e N o n - C D E E C S T a s k D o g s C o n t a i n e r
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation- Placement Constraints E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e C D E E C S T a s k C a t s C o n t a i n e r E C S T a s k D o g s C o n t a i n e r C o n t a i n e r I n s t a n c e N o n - C D E E C S T a s k D o g s C o n t a i n e r This doesn’t need to happen!
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Segmentation – Task ENI E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p S e c u r i t y G r o u p E C S T a s k C a t s C o n t a i n e r S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r S e c u r i t y G r o u p
  • 29. 1. Pre ENI Attachment: The primary ENI (eth0) is in the default namespace Default/Root Global Namespace docker0 eth0 lo
  • 30. 1. Pre ENI Attachment: The primary ENI (eth0) is in the default namespace 2. ENI Attached: The new ENI (eth1) is in the default namespace. Default/Root Global Namespace Default/Root Global Namespace docker0 docker0 eth0 lo lo eth0 eth1
  • 31. Default/Root Global Namespace Default/Root Global Namespace Default/Root Global Namespace docker0 docker0 eth0 lo lo eth0 eth1 lo eth0 docker0 ecs0 eth1 lo ve- c1 3. ENI Provisioned: The ECS Agent invokes CNI plugins to move the new ENI into a new namespace and configure it with the addresses and routes. 1. Pre ENI Attachment: The primary ENI (eth0) is in the default namespace 2. ENI Attached: The new ENI (eth1) is in the default namespace.
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Capabilities Kernel Server Cats Container Dogs Container NET_BIND_SERVICE CHOWN • AUDIT_CONTROL • BLOCK_SUSPEND • DAC_OVERRIDE • MKNOD • … • …
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ”LinuxParameters": { ”capabilities": { add: [“AUDIT_CONTROL”, ...], drop: [“MKNOD”, ...] } } docker run --cap-drop ALL --cap-add .. Dropping and adding capabilities
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Do you really know your image?
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Layers, binaries, and dependencies, oh my! /usr/bin/passwd /usr/bin/gpasswd /usr/bin/chsh /usr/bin/chfn /usr/bin/newgrp /bin/su /bin/umount /bin/mount $ find / -user root -perm -4000 -print Do I need binaries with SUID flag?
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Layers, binaries, and dependencies, oh my! IMAGE CREATED CREATED BY SIZE a8bdc7fdaa4f 2 weeks ago /bin/sh -c #(nop) CMD ["httpd-foreground"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) EXPOSE 80/tcp 0B <missing> 2 weeks ago /bin/sh -c #(nop) COPY file:761e313354b918... 133B <missing> 2 weeks ago /bin/sh -c set -eux; buildDeps=" bzip2... 9.72MB <missing> 2 weeks ago /bin/sh -c #(nop) ENV APACHE_DIST_URLS=ht... 0B <missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_PATCHES= 0B <missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_SHA256=777753... 0B <missing> 2 weeks ago /bin/sh -c #(nop) ENV HTTPD_VERSION=2.4.29 0B <missing> 4 weeks ago /bin/sh -c apt-get update && apt-get inst... 44.2MB <missing> 4 weeks ago /bin/sh -c { echo 'deb http://deb.debian... 161B <missing> 4 weeks ago /bin/sh -c #(nop) ENV OPENSSL_VERSION=1.0... 0B <missing> 4 weeks ago /bin/sh -c #(nop) ENV NGHTTP2_VERSION=1.1... 0B <missing> 4 weeks ago /bin/sh -c #(nop) WORKDIR /usr/local/apache2 0B <missing> 4 weeks ago /bin/sh -c mkdir -p "$HTTPD_PREFIX" && ch... 0B <missing> 4 weeks ago /bin/sh -c #(nop) ENV PATH=/usr/local/apa... 0B <missing> 4 weeks ago /bin/sh -c #(nop) ENV HTTPD_PREFIX=/usr/l... 0B <missing> 4 weeks ago /bin/sh -c echo 'deb http://deb.debian.org... 55B <missing> 4 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B <missing> 4 weeks ago /bin/sh -c #(nop) ADD file:55b071e2cfc3ea2... 123MB
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Best practices • Signing container images (Docker content trust) • Set filesystems to be read-only (readonlyRootFilesystem) • Remove setuid/setgid binaries from images (defang) • Set containers to run as non-root user • Consider running static binaries
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image security Trusted Images • ECR • docker-hub-enterprise • elastic.io/running-a- docker-private-registry- on-ec2 Minimal OS Base Images • Minimum OS (alpine etc) • Docker cis-docker-bench • Image signing Container Vulnerability Scanning • TwistLock • Clair • NueVector
  • 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DevSecOps container pipeline Developers Security Engineers Ops Engineers AWS CodeCommit Task Definition Dockerfile FROM centos:centos7 MAINTAINER cb@demo.com RUN yum -y update RUN yum -y install openssh- server U SER sshduser EXPOSE 5432 ENTRYPOINT sshd
  • 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DevSecOps container pipeline Docker image AWS CodeBuild Developers Security Engineers Ops Engineers Task Definition AWS CodeCommit Dockerfile FROM centos:centos7 MAINTAINER cb@demo.com RUN yum -y update RUN yum -y install openssh- server U SER sshduser EXPOSE 5432 ENTRYPOINT sshd
  • 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DevSecOps container pipeline Docker image AWS CodeBuild Validate Configuration > Merge >  python ./check_dockerfile.py ./examples/Dockerfile-demo |jq ".warnings.warnings[].message" "yum clean all is not used" "installing SSH in a container is not recommended" "No 'USER' instruction" Developers Security Engineers Ops Engineers AWS CodeCommit Task Definition Dockerfile FROM centos:centos7 MAINTAINER cb@demo.com RUN yum -y update RUN yum -y install openssh- server U SER sshduser EXPOSE 5432 ENTRYPOINT sshd
  • 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DevSecOps container pipeline Docker image AWS CodeBuild Validate Configuration > Merge >  python ./check_dockerfile.py ./examples/Dockerfile-demo |jq ".warnings.warnings[].message" "yum clean all is not used" "installing SSH in a container is not recommended" "No 'USER' instruction" Developers Security Engineers Ops Engineers AWS CodeCommit 0 50 100 150 DEV INT TEST QA PROD Vulnerabilities Low Medium High Scan Docker Image > Publish > Task Definition Dockerfile FROM centos:centos7 MAINTAINER cb@demo.com RUN yum -y update RUN yum -y install openssh- server U SER sshduser EXPOSE 5432 ENTRYPOINT sshd
  • 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DevSecOps container pipeline Amazon ECR Docker image AWS CodeBuild Validate Configuration > Merge >  python ./check_dockerfile.py ./examples/Dockerfile-demo |jq ".warnings.warnings[].message" "yum clean all is not used" "installing SSH in a container is not recommended" "No 'USER' instruction" Developers Security Engineers Ops Engineers AWS CodeCommit 0 50 100 150 DEV INT TEST QA PROD Vulnerabilities Low Medium High Scan Docker Image > Publish > Task Definition Dockerfile FROM centos:centos7 MAINTAINER cb@demo.com RUN yum -y update RUN yum -y install openssh- server U SER sshduser EXPOSE 5432 ENTRYPOINT sshd
  • 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Storing secrets in environment variables • Suggested by 12-factor apps (III. Config) • Environment variables can be seen in too many places • Linked containers • ECS API calls • Docker inspect • Can’t be deleted https://12factor.net/
  • 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Protecting secrets using IAM roles for tasks Benefits • Simplify usage of AWS SDKs in containers • Credential isolation between tasks/container • Authorization per task/container • Auditability in Amazon CloudTrail with taskArn
  • 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM EC2 roles Cats Contai ner Dogs Contai ner C o n t a i n e r I n s t a n c e E C S T a s k E C S T a s k C a t s B u c k e t D o g s B u c k e t
  • 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM task roles Cats Contai ner Dogs Contai ner C o n t a i n e r I n s t a n c e E C S T a s k E C S T a s k C a t s B u c k e t D o g s B u c k e t
  • 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. IAM roles for tasks, explained 1. ECS agent periodically queries ECS control plane 2. Control plane generates ID token  Auto-rotated 3. ECS agent:  Constructs HTTP URL for each container  Sets AWS_CREDENTIALS_ENDPOINT in HostConfig 4. AWS SDK extracts URL
  • 51. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon S3-based secrets storage • Secrets stored in S3 bucket • Accessed via IAM roles for EC2 or IAM roles for tasks • Enforce encryption at rest and flight via IAM policies and KMS • Use VPC endpoint for S3 to lock down access from certain VPCs
  • 52. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon EC2 systems manager parameter store • Secrets stored in SSM parameter store • Accessed via IAM roles for EC2 or IAM roles for tasks • Enforce encryption at rest and flight via IAM policies and KMS • Govern permission to decrypt using specific KMS through IAM policy
  • 53. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Using IAM roles to retrieve secrets Cats Contai ner C o n t a i n e r I n s t a n c e E C S T a s k Parameter Store secretStringAWS KMS
  • 54. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Kernel and Host Security Denial of Service Container Breakouts Image Security Secrets Runtime
  • 55. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. VPC flow logs and Task ENI E C S T a s k C a t s C o n t a i n e r C o n t a i n e r I n s t a n c e S e c u r i t y G r o u p S e c u r i t y G r o u p E C S T a s k D o g s C o n t a i n e r S e c u r i t y G r o u p 630247214269 eni-0123456a 10.0.1.221 10.76.2.101 27039 22 6 5 268 1466491141 1466491200 REJECT OK 22 StopTask: { task: “52c…” } $ docker diff / inspect
  • 56. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Access Control Cloud Native Firewalling Runtime Defense Compliance Vulnerability Management
  • 57. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Container Security at Okta K e l v i n Z h u – P r o d u c t i v i t y T e a m L e a d D e v e l o p e r
  • 58. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Topics • How we use containers • How we secure: • Hosts • Containers • Images
  • 59. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What security is to us
  • 60. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Keeping it reliable • Security breaches have the potential to bring down our infrastructure • Improper use of secrets can cause unexpected and damaging effects • Bad security results in costly problems! But with automation it doesn’t have to be hard! • We’ll focus on a few examples of how we apply security principles to our Docker containers
  • 61. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How we use containers
  • 62. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. High-level flow
  • 63. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. High level flow • Developer writes code and commits to GitHub • Bacon Web application receives commit and processes into test runs • Test runs inserted as messages to an AWS SQS queue • ECS cluster of instances pick up messages from SQS queue and run them on Docker containers • Test results reported back to Bacon Web application
  • 64. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container generation and usage
  • 65. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container generation and usage
  • 66. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container generation and usage
  • 67. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container generation and usage • Individual runs generate artifacts, some of which are Docker artifacts • Docker images uploaded to repositories • Individual Amazon ECS clusters brought up by AWS CloudFormation for either CI or application images • Application images deployed to Amazon ECS services
  • 68. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Deployment scale • Two different types of deployments: • CI scales up to thousands and down to just a few containers according to messages in queue • One time use containers that finish a task within an hour • Almost no containers necessary overnight and during weekends • Applications scale up and down according to web traffic • Longer lived containers
  • 69. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container host security
  • 70. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Components of host security • AMI • Accessibility • Ease of change
  • 71. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Locking down the AMI • The very packages we install are potential threats! • Viruses • Backdoors • Creation of a hardened AMI • Even if an installed package is unused, if a vulnerability is discovered patching is required! • AMI with only minimum necessary to run application • Follow Center of Internet Security (CIS) checklists to ensure generated AMIs are secure
  • 72. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Locking down the AMI Steps to build, test, and certify an AMI • Define packer template • Test: run CIS • Share foundation AMI to DMZ account • Share foundation AMI to other AWS accounts • Delete foundation AMI from originating AWS account
  • 73. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Preventing unauthorized access
  • 74. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Preventing unauthorized access
  • 75. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Preventing unauthorized access • All hosts behind the VPC • Only users with VPN can communicate with hosts • Security groups to limit approved traffic between hosts • SSH keys given only to trusted set of users • Regular rotation to prevent leaking
  • 76. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ease of change • Always prepare for the worst case • Zero days! • Time is of the essence in minimizing damage • To enable easy patching, AMI creation is hooked into the CI system aws ec2 run-instances --count 1 aws ec2 wait instance-status-ok --instance-id ${INSTANCE_ID} aws ec2 create-image --instance-id ${INSTANCE_ID} aws ec2 wait image-available --image-ids ${IMAGE_ID} aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
  • 77. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 78. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 79. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 80. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 81. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 82. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 83. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users UpdatePolicy: AutoScalingRollingUpdate MaxBatchSize: 5 MinInstancesInService: 5 PauseTime: “PT10M”
  • 84. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Malicious users
  • 85. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Ease of change • AWS CloudFormation for each Amazon ECS service • Auto Scaling used to reduce reliance on individual hosts staying alive • If a host becomes compromised or starts failing, terminate it and allow a new one to come up • Auto replacement of all hosts every day ensures manual patches do not occur
  • 86. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container security
  • 87. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Credentials on containers
  • 88. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Credentials on containers • Industry standards • Pull credentials from external protected storage encrypted both on disk and in transit into flat file available within container • Pull credentials from external protected storage encrypted both on disk and in transit into memory (slightly better) • Both approaches allow anyone with access to code run in container to retrieve the secrets!
  • 89. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Protecting creds • The next step up! • Containers run in protected networks to prevent unauthorized direct access • Standard and parameterized code that is run on containers and modification disallowed • Sanitize logs and output files for any retrieved secrets • Prevents ability to sniff out secrets and prevents leaks
  • 90. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Service access
  • 91. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Minimizing service access • Containers need access to services, but only the minimal set they actually need! • Task definitions associated with each Amazon ECS task/service type given their own task IAM role • Avoid use of “*” in access policies! • Access advisor – Remove access to unnecessary services • CloudTrail logs – More granular view into exactly which resources are accessed
  • 92. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image security
  • 93. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Container generation and usage
  • 94. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Docker within Docker! • By mounting Docker from the host to the container, we can run Docker and Docker Compose inside the container • -v /usr/bin/docker:/usr/bin/docker • Utilized in the CI system to test Docker images the same way the are deployed • Allows repeatable building of Docker images in ECS within immutable containers
  • 95. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image creation and usage
  • 96. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image creation and usage
  • 97. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image creation and usage
  • 98. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image creation and usage
  • 99. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Image creation and usage • No repository code built into images • First step: pull down credentials (locked behind IAM roles) • Second step: clone code or artifacts to actually run onto images • Prevents leakage of information if images are stolen • Even if image stolen, running the image will fail if user does not have the right IAM role to get credentials
  • 100. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Packages and registries • Images build off of internal base image configured to only pull from internal package repository • Packages in internal repository vetted by security team • Installed packages pinned to specific versions • Amazon ECR • More performant so utilize as storage for security approved images that are used on clusters • Artifactory • Storage for intermediate images and artifacts for longer-term storage
  • 101. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Key takeaways
  • 102. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Key takeaways • Protect from unauthorized access • VPC and security groups to limit approved network traffic • IAM roles to limit per task access to creds and services • Minimize surface area for problems • Limit packages installed • Be prepared to fix issues • Constant patching necessitates agile change infrastructure
  • 103. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you!