{"id":938,"date":"2018-12-21T12:43:51","date_gmt":"2018-12-21T12:43:51","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=938"},"modified":"2018-12-28T19:53:07","modified_gmt":"2018-12-28T19:53:07","slug":"your-guide-to-container-security","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/21\/your-guide-to-container-security\/","title":{"rendered":"Your Guide to Container Security"},"content":{"rendered":"<p>Your storage system should be locked down with all security and access<br \/>\ncontrol tools available to you as well. That is true whether the storage<br \/>\nserves containers or any other type of application environment. How do<br \/>\nyou secure containers? That may sound like a simple question, but it<br \/>\nactually has a six- or seven-part answer. That\u2019s because securing<br \/>\ncontainers doesn\u2019t involve just deploying one tool or paying careful<br \/>\nattention to one area where vulnerabilities can exist. Because a<br \/>\ncontainerized software stack involves so many different components, you<br \/>\nneed to secure many different layers. The tools designed to help you<br \/>\nharden one part of your environment won\u2019t protect other segments.<br \/>\nCommercial security tools do exist, and are designed to provide<br \/>\nrelatively comprehensive security or container environments. They are<br \/>\ngood tools, and they can certainly be useful parts of a container<br \/>\nsecurity strategy, but they have their limitations. To be truly secure,<br \/>\nyou need to analyze each of the layers in your stack, and be sure that<br \/>\nthey are covered adequately by the security tools or processes you put<br \/>\nin place. This post helps you plan a complete container security<br \/>\nstrategy by outlining all of the layers you need to secure, and<br \/>\nexplaining the primary considerations to keep in mind when securing each<br \/>\none.<\/p>\n<h3>Understanding the Layers<\/h3>\n<p>When planning your approach to container security, you should begin by<br \/>\nidentifying all of the different layers of the software stack that you<br \/>\nhave to secure. Those layers include:<\/p>\n<p>Your image registry. This is the part of your stack that hosts your<br \/>\nimages. Security vulnerabilities here could allow attackers to add<br \/>\nmalicious images to your environment, or steal private data. The<br \/>\norchestrator. Your orchestrator is the brains of your container<br \/>\ncluster. If it\u2019s not secured, an attacker could use it to disrupt<br \/>\nservice, or possibly intercept private information. Your hosting<br \/>\ninfrastructure. The operating system or cloud environment that hosts<br \/>\nyour container environment needs to be secure\u2014otherwise, it can become<br \/>\nthe front door for an attack against your environment. Storage<br \/>\nsystems. To protect the sensitive data hosted on your container<br \/>\ncluster, you need to keep the storage system you use free of<br \/>\nvulnerabilities. The container daemon. If the Docker daemon is<br \/>\ncompromised, attackers can shut down containers or gain unauthorized<br \/>\naccess to the ones you\u2019re running. Application code inside your<br \/>\ncontainers. Last but not least, you need to make sure the code that<br \/>\nruns inside your containers is free of vulnerabilities that could allow<br \/>\nattackers to disrupt or control your application when it is running.<\/p>\n<p><a href=\"http:\/\/www.rancher.com\/learn\"><img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/02\/16180354\/Training.png\" alt=\"\" \/><\/a><br \/>\nEnjoying this article? Check out all of our learning resources at<br \/>\n<a href=\"http:\/\/www.rancher.com\/learn\">rancher.com\/learn<\/a><\/p>\n<h3>Securing the Stack<\/h3>\n<p>There are two main considerations to bear in mind when securing your<br \/>\nimage registry. First, you need to make sure to lock down access<br \/>\ncontrol. Your approach to doing this will vary depending on which<br \/>\nregistry you use. Some registries offer finer-tuned access control<br \/>\nfeatures than others, but all of the mainstream registries provide some<br \/>\nsecurity controls. (For an overview of different registry options,<br \/>\nincluding a comparison of the security features built into them, check<br \/>\nout <a href=\"http:\/\/rancher.com\/container-registries-might-missed\/\">Container Registries You May Have<br \/>\nMissed<\/a>) The<br \/>\nsecond challenge is detecting security vulnerabilities inside container<br \/>\nimages themselves. For this task, two tools are available: Clair from<br \/>\nCoreOS and Docker Security Scanning from Docker. Both of these image<br \/>\nscanners will check an image for known malware signatures. They\u2019re<br \/>\ndesigned mainly to be integrated into CoreOS\u2019s and Docker\u2019s registries,<br \/>\nbut they can also work in standalones mode by manually scanning an<br \/>\nimage.<\/p>\n<h3>Orchestrator<\/h3>\n<p>Securing your orchestrator requires more work than simply turning on<br \/>\nsome access control features or running a scanner. Orchestrators are<br \/>\ncomplex tools, and their inner workings vary from one orchestrator to<br \/>\nanother. Explaining all of the details of configuring an orchestrator<br \/>\nfor maximum security is beyond the scope of this article. In general,<br \/>\nhowever, key principles to follow include:<\/p>\n<ul>\n<li>Making sure you install your orchestrator from an official source.<br \/>\nBe wary of third-party package repositories.<\/li>\n<li>Keep your orchestrator up-to-date.<\/li>\n<li>When configuring your orchestrator and the cluster it manages, limit<br \/>\npublic-facing network connections to the minimum necessary to run<br \/>\nyour application.<\/li>\n<li>Configure your orchestrator for automatic failover and high<br \/>\navailability in order to mitigate the impact of potential DDoS or<br \/>\nsimilar attacks.<\/li>\n<\/ul>\n<p>If you use Kubernetes, you may also find <a href=\"http:\/\/blog.kubernetes.io\/2016\/08\/security-best-practices-kubernetes-deployment.html\">this article on security best<br \/>\npractices<\/a><br \/>\nto be helpful. A similar guide for Mesos is available<br \/>\n<a href=\"https:\/\/devops.com\/mesos-security-awareness-considerations\/\">here<\/a>.<\/p>\n<h3>Hosting Infrastructure<\/h3>\n<p>The infrastructure you use to host your container environment could be<br \/>\non-premises, in the cloud, or in some cases, a mix of both. Whatever it<br \/>\nlooks like, you should be sure to secure the infrastructure as much as<br \/>\npossible. If you manage your host servers yourself, make sure they are<br \/>\nlocked down with kernel hardening tools like SELinux or AppArmor. For<br \/>\ncloud-based deployments, take advantage of access control features (such<br \/>\nas IAM roles on AWS) to configure access to your environment. Security<br \/>\nauditing and monitoring tools will help to keep your infrastructure<br \/>\nsecure, too.<\/p>\n<h3>Storage<\/h3>\n<p>When it comes to containers and storage, however, one important point to<br \/>\nkeep in mind is that, in many cases, many containers might share access<br \/>\nto the same storage directories. This happens if you map directories<br \/>\ninside containers to a shared location on the host. Under these<br \/>\nconditions, it\u2019s especially important to make sure that any container<br \/>\nwith access to a shared storage location is secure. You should also<br \/>\nlimit storage access to read-only in cases where a container does not<br \/>\nneed write permissions. And it\u2019s always a good idea to have rollback<br \/>\nfeatures built into your storage system so that you can undo changes to<br \/>\ndata if necessary.<\/p>\n<h3>Container Daemon<\/h3>\n<p>Running SELinux or AppArmor on the container host can help to defend the<br \/>\nDocker daemon against attack, but that is only one security challenge to<br \/>\nkeep in mind when it comes to the daemon. You should also make sure that<br \/>\ndaemon socket connections are <a href=\"https:\/\/docs.docker.com\/engine\/security\/https\/\">securely authenticated and<br \/>\nencrypted<\/a>. Of course,<br \/>\nit\u2019s also essential to keep your Docker installation up-to-date to avoid<br \/>\nsecurity vulnerabilities in the daemon.<\/p>\n<h3>Application Code<\/h3>\n<p>You should secure the code running inside your containers just as you<br \/>\nwould secure any type of application code\u2014by obtaining the code from a<br \/>\ntrusted source and auditing it with security tools designed to catch<br \/>\nvulnerabilities. Clair and Docker Security Scanning can help with the<br \/>\nlatter, but they are not designed to be all-purpose static application<br \/>\nsecurity testing solutions. For that reason, you may benefit from<br \/>\ndeploying a tool like Veracode or OWASP to scan your code for<br \/>\nvulnerabilities.<\/p>\n<h3>Conclusion<\/h3>\n<p>Keeping a container environment secure is a big task because there are<br \/>\nso many moving parts. The details of your security strategy will vary<br \/>\ndepending on exactly which types of registries, orchestrators, hosting<br \/>\ninfrastructure and so on that you choose to include in your stack. But<br \/>\nwhatever your environment looks like, the key to keeping it secure is to<br \/>\nremember that there is no one-stop shopping. You have to keep all of the<br \/>\ndifferent layers in mind, and develop a security plan that addresses<br \/>\neach one. <em>Chris Riley (@HoardingInfo) is a technologist who has<br \/>\nspent 12 years helping organizations transition from traditional<br \/>\ndevelopment practices to a modern set of culture, processes and tooling.<br \/>\nIn addition to being a research analyst, he is an O\u2019Reilly author,<br \/>\nregular speaker, and subject matter expert in the areas of DevOps<br \/>\nstrategy and culture. Chris believes the biggest challenges faced in the<br \/>\ntech market are not tools, but rather people and planning.<\/em><\/p>\n<p><a href=\"https:\/\/rancher.com\/complete-guide-container-security\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your storage system should be locked down with all security and access control tools available to you as well. That is true whether the storage serves containers or any other type of application environment. How do you secure containers? That may sound like a simple question, but it actually has a six- or seven-part answer. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/21\/your-guide-to-container-security\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Your Guide to Container Security&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-938","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=938"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":994,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/938\/revisions\/994"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}