StrongerContainerSec AWS20
StrongerContainerSec AWS20
Container Security
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 2
Table of Contents
3 The fellowship of containers, an emerging developers’ community
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 3
58%
they play in developing with containers.
Compared to virtual machines, containers have a smaller footprint which means a smaller
attack surface. They also provide an additional layer of security through their ability to isolate
applications. However, this doesn’t mean that your containerized environment is not susceptible
to malicious attacks between containers or within the shared resources of the underlying host. of developers report
A strong container security strategy starts with a 360-degree awareness of the container and that their companies
how it interacts with its environment and ends up as automated governance policies woven into use containers or plan
the Continuous Integration/Continuous Delivery (CI/CD) pipeline. Planning a container security to use containers in the
strategy for the first time can feel a little like trial-and-error. And while DevOps is all about iterating next 12 months.
to get better, security isn’t something you should take a chance on.
Our container experts have developed, tested, and refined eight best practices for security in your environment. In the spirit of the
fellowship of containers, we are passing along these not-so-secret practices to you:
Read on for more explanation of these practices and some tips for how your Amazon Web Services (AWS) environment can help.
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 4
Set Who is
Permissions Accessing
For Users Your
And System Containers?
Resources
Two of the biggest differences between Set least-privilege access rules: As with any software
containers and other virtualized assets that system you run, it’s a good idea to use the lowest
affect your security strategy are 1) many privileges possible for your containers, as well as the
containers share a single operating system binaries and libraries within them. This helps prevent
(OS) and 2) containers ship with fully stocked privilege escalation and wrongful data access and all
libraries already built in. These are important kinds of bad habits.
because they create new entry points for
Tip: AWS Identity and Access Management
security threats. In the case of the shared
(IAM) offers a shortcut to implementing least
OS, or host, a single OS attack will likely
privilege restrictions based on AWS best practices
affect many connected containers. Likewise,
for leveraging roles established within one service
a library or binary can be used as a point of
to another. IAM policies can be automatically
entry between containers through privilege
applied based on a task definition that you set when
escalation.
launching the container and attached to either users
Thankfully, you can mitigate many of these or roles.
risks by thinking about your user permissions
Turn off root privileges: We recommend setting up
policies and how you allocate shared
a non-root user and making it the default in your
resources from the get-go. Here are detailed
container configuration. For the most part, Docker
steps to help you when you’re setting up your
and Kubernetes subprocesses do not run with root
containers for use in your DevOps pipelines. If
privileges out of the box, however, it never hurts to
you’re already in production, it’s not too late
double check. And when you absolutely must use the
to use these steps for future iterations of your
root account for container-based actions, be mindful
microservices.
of how you use it.
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 5
Tip: You can set Amazon ECS to perpetuate Tip: Amazon ECS allows you to configure CPU, RAM,
the segregation that you establish in your initial and ulimits to help you automate governance.
configuration.
Restrict kernel capabilities: Set limits on what the kernel
Disable inter-container communication:
can access by task.
Another way to cut down on inter-container
communication (icc)is to disable it.
Tip: With Amazon ECS, kernel capabilities are limited
by the service and can be set per task.
Tip: Amazon ECS lets you use a link flag to
connect containers and control communications
between them. You can set it up by marking docker Validate your host before launching: One of the
flags “–icc=false” and “–iptables=true”. biggest challenges in SecOps is incorporating repeatable
container governance policies into your pipeline. You can
Restrict network chatter: Of course, security use an automated service like Docker Bench to validate
threats can be transmitted between containers your container host against security best practices.
through your network, too. Be sure to consider your
network controls. Tip: In an AWS environment, you can use AWS
Lambda to build Docker Bench into your CI/CD pipeline so
Tip: Amazon ECS offers network control it automatically calls the service whenever you launch
through the container control for Elastic Network a new host.
Interface (ENI). You can use the ENI to customize
port configurations for your use case. Furthermore, Control file system access: There’s no reason for
AWS App Mesh allows you to standardize network the data in your file systems to be accessible to all
communication by giving you visibility into how your containers and users, but it is unless you specify
things are communicating on an application level. otherwise. By configuring the file systems directory default
to read only, you can make it so that only the host can
access the data. SELinux provides a default for docker
that enforces the read/execute to /usr.
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 6
Tip: Remove setuid/setgid binaries from images Tip: AWS Systems Manager Parameter Store will
store and encrypt your secrets separately from your app
and its container. Systems Manager Parameter Store
Tip: Debian ‘defanged’ image Dockerfile
is fully integrated with AWS which means you can use
configuration (removes access to those binaries)
IAM roles to call the System Manager Parameter Store to
retrieve the secret for the system task (i.e.
logging into the server) without embedding the secret into
the app. At the application level, AWS Secrets Manager
allows you to store secrets that manage application and
database passwords.
The same rules apply to your container environment. That’s where IDS and log
monitoring come in.An intrusion detection system (IDS) gives you a holistic view
of network traffic between your containers. It provides alerts on malicious traffic
to keep you informed of activity. Logs, on the other hand, record forensic data
you can use to get a picture of what is going on at the system level.
By using both of these together, you get a much better understanding about
what is happening within a single container and between multiple containers.
Not only is this important from a security perspective, but also a network and
general software perspective.
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 7
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 8
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 9
AlertLogic.com
S E C R E TS TO A S T RO N G E R S T R AT E GY FO R CO N TA I N E R S E C U R I T Y 10
Lock In Your
Container Strategy
With Alert Logic
Subscribe to Alert Logic Managed Threat
Detection on AWS Marketplace to get started
fast.
SIGN UP NOW
© 2020 Alert Logic, Inc. The information contained in this document is confidential and only for the use of the intended
recipient. You may not publish or redistribute this document without advance permission from Alert Logic