Containerised applications workload security
What is container security?
Containerised application workloads are often more complex than traditional application workloads. Therefore, deploying such workloads in a production environment may involve launching a large number of containers. As a result, system administrators and security specialists need more time and effort, along with more complex procedures, to secure containerised workloads compared to traditional workloads.
Container security is the process of implementing and maintaining security controls that protect containers and their underlying infrastructure during the application development lifecycle. Those processes need to be integrated into the development pipeline to ensure that all application components are secure, from the initial development phase until the end-of-development lifecycle.
Container security challenges
While the process of containerising applications has benefits, it can introduce security challenges that could sometimes be challenging to overcome. Some of these challenges include:
1. Larger attack surface of containerised applications
Because a containerised application may need to launch a large number of containers derived from the same base images, for example a web server image, and if that particular base image has known vulnerabilities, then all containers based on that image will inherit the vulnerability. In that case, the attack surface is multiplied by the number of containers. Similarly, when containers are based on different base images, for example two web server images derived from different operating system releases, then the attack surface will be proportional to the total number of vulnerabilities in all base images combined.
2. Shared kernel architecture
Since the container host’s kernel is shared by all containers running on it by design, additional configuration is required to limit container permissions and ensure proper isolation of containers. For example, containers by default have access to the host’s network, where the internet or other private networks might be reachable. In most cases, containers of a microservices application are only supposed to interact with each other within an isolated network. Therefore, configuring container network isolation is necessary, and this can be achieved by creating isolated Docker networks when launching containers with Docker Compose, or creating a network policy in Kubernetes. Another example is the default kernel capabilities assigned by Docker when launching containers, such as CAP_NET_RAW, where this capability is not needed for most application containers to function properly, and therefore can be removed.
3. Visibility in a dynamic environment
Containerised workloads are highly dynamic and their orchestration platforms abstract the underlying infrastructure, including the network. As a result, traditional monitoring tools may not be able to see which containers are running, what they are running, or analyse their network behaviour. For example, containers communicate with each other over network overlays managed by the container orchestration platform. Therefore, traditional network monitoring tools that analyse network flows going through the container’s host network interfaces, or through network infrastructure devices, will not be able to monitor the required network metrics.
Container security best practices
1. Securing images
2. Securing container registries
3. Securing deployment
4. Securing container runtime
5. Monitoring container activity
As containerised workloads are highly dynamic, where many containers may be launched from the same or different images and new versions of those images may get introduced at a high pace, it is critical to identify security or other operational issues quickly and remediate them at the source. Therefore, containerised workloads require a granular level of monitoring to provide visibility for IT and security teams into elements running in the environment. Monitoring tools can help with identifying anomalous behaviour and responding to events in a timely manner. For example, the timely identification of a faulty or vulnerable image ensures the ability to fix the image and rebuild all containers based on it.
Common container security mistakes to avoid
1. Failure to implement basic security practices
Even though containers are relatively new technology that require the implementation of new security practices and tools, certain basic security principles and practices still apply. These include keeping operating systems and container runtimes updated and patched.
2. Failure to implement logging, monitoring, and testing
This is especially the case for highly distributed systems spanning multiple or hybrid clouds, as this would result in loss of visibility into the health of applications and environments, leading to critical security risks.
3. Failure to secure all stages of CI/CD pipelines
If security testing is performed only at the end of the development lifecycle, that would result in unnecessary delays with the deployment of application releases to production. Those delays can be eliminated by implementing security early in the development lifecycle, and by using appropriate security tools at every stage within the pipeline.
By avoiding these common mistakes and following container security best practices, the risk of security breaches can be significantly decreased for a containerised application and its infrastructure.