<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Frederick Fernando</title>
    <description>The latest articles on DEV Community by Frederick Fernando (@securetty).</description>
    <link>https://dev.to/securetty</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F38385%2F01871990-d78c-464b-8428-2135c83fa627.jpg</url>
      <title>DEV Community: Frederick Fernando</title>
      <link>https://dev.to/securetty</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/securetty"/>
    <language>en</language>
    <item>
      <title>Enforcing Image Trust on Docker Containers using Notary</title>
      <dc:creator>Frederick Fernando</dc:creator>
      <pubDate>Tue, 05 Oct 2021 06:42:51 +0000</pubDate>
      <link>https://dev.to/securetty/enforcing-image-trust-on-docker-containers-using-notary-3jp1</link>
      <guid>https://dev.to/securetty/enforcing-image-trust-on-docker-containers-using-notary-3jp1</guid>
      <description>&lt;h2&gt;
  
  
  Why worry about software supply chain security while deploying containers?
&lt;/h2&gt;

&lt;p&gt;In the past few years, we have seen attacks such as &lt;a href="https://www.csoonline.com/article/3233210/petya-ransomware-and-notpetya-malware-what-you-need-to-know-now.html"&gt;NotPetya&lt;/a&gt; and &lt;a href="https://blog.checkpoint.com/2020/12/16/solarwinds-sunburst-attack-what-do-you-need-to-know/"&gt;Sunburst&lt;/a&gt;, which has shifted the industry’s focus to secure their supply chain. With the growing usage of Open source software, we inherit many third-party dependencies into our application. An upstream vulnerability in one of your dependencies can affect your application, making it susceptible to a potential compromise. A software supply chain is anything that goes into or affects your code from development, through your CI/CD pipeline, until it gets deployed into production. &lt;/p&gt;

&lt;p&gt;The first step in getting supply chain security right is to start with visualizing the supply chain components which you use from scratch. You can use something like Dependency-Track to analyze your supply chain components. Once we have the end-to-end visibility, the next step is to build upward with carefully governed and secured access to analytics and visibility capabilities. From there, continuously monitor every layer for anomalous behavior. Every step in a supply chain should be “trustworthy” as a result of a combination of cryptographic attestation and verification. No step in the supply chain should rely on assumptions about the trustworthiness of any previous steps or outputs, trust relationships must be explicitly defined. Let’s look at some of the tools which help us with supply chain security in a cloud native environment.&lt;/p&gt;

&lt;p&gt;We will be verifying container images using &lt;a href="https://github.com/theupdateframework/notary"&gt;Notary&lt;/a&gt;. Notary uses the &lt;a href="https://github.com/theupdateframework/"&gt;The Update Framework (TUF)&lt;/a&gt; specification for publishing and verifying content. Before we deep dive into enforcing image trust on Docker containers, let's take a quick look at both of these projects.&lt;br&gt;
a quick overview before deep dive.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is The Update Framework (TUF)
&lt;/h2&gt;

&lt;p&gt;The Update Framework (TUF) aims to provide a framework (a set of libraries, file formats, and utilities) that can be used to secure new and existing software update systems. These systems can be package managers that are responsible for all of the software that is installed on a system, updaters that are only responsible for individual installed applications, or software library managers that install software that adds functionality such as plugins or programming language libraries. You can find the &lt;a href="https://theupdateframework.github.io/specification/latest/"&gt;full specifications of TUF here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Notary?
&lt;/h2&gt;

&lt;p&gt;Notary is an implementation of the TUF specification. It is a tool for publishing and managing trusted collections of content. Publishers can digitally sign collections and consumers can verify the integrity and origin of content. This capability is built on a straightforward key management and signing interface to create signed collections and configure trusted publishers.&lt;/p&gt;

&lt;p&gt;With Notary, anyone can provide trust over arbitrary collections of data. Using The Update Framework (TUF) as the underlying security framework, Notary takes care of the operations necessary to create, manage, and distribute the metadata necessary to ensure the integrity and freshness of your content. It performs signing of an image using TUF’s roles and keys &lt;a href="https://docs.docker.com/engine/security/trust/"&gt;hierarchy&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to implement image trust in Docker?
&lt;/h2&gt;

&lt;p&gt;We can reduce the attack surface of malicious containers running in your environment by implementing container image trust. With this, we can be sure that only the images you have signed are allowed to run in your environment, thus improving the supply chain security. Docker uses Notary for signing and verifying container images. Let us look at how to enforce container image trust using Docker.&lt;/p&gt;

&lt;p&gt;We will be running the Notary server and Docker registry locally. We will then enable Docker content trust so that we can only pull images from the local Docker registry which are signed by the Notary server.&lt;/p&gt;
&lt;h3&gt;
  
  
  Steps to encforce container image trust using Docker:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Make sure you have docker and docker-compose installed on your system&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Clone the Git repository&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/theupdateframework/notary
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The following command will build the Notary images&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;notary
   &lt;span class="nv"&gt;$ &lt;/span&gt;docker-compose build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run docker-compose, Notary server will be running on &lt;code&gt;localhost:4443&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;docker-compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Copy the config file and testing certs to your local Notary config directory. The config file has information about the notary server URL and the CA certificate.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.notary &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cp &lt;/span&gt;cmd/notary/config.json cmd/notary/root-ca.crt ~/.notary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In development setup, Notary server uses self-signed certificates, this root-ca.crt is required to successfully connect to it from the client i.e. docker and notary CLI. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run a docker-registry locally, the registry server will be running on localhost:5000
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 5000:5000 &lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;always &lt;span class="nt"&gt;--name&lt;/span&gt; registry registry:2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Pull an image from docker.io
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;docker pull nginx:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Tag the image so that we can push it to the local docker registry
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;docker tag nginx:latest localhost:5000/nginx:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add these variables to enable Docker content trust, these are read by docker CLI.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;DOCKER_CONTENT_TRUST_SERVER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://localhost:4443
   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;DOCKER_CONTENT_TRUST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Login to local Docker registry with username and password as admin:admin&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker login localhost:5000
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When you push the image to the local Docker registry, it will ask you for a passphrase for root key and repository key. You will be prompted to enter these passwords automatically. When we push the image to the private registry it is signed by the Notary server&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker push localhost:5000/nginx:latest
The push refers to repository &lt;span class="o"&gt;[&lt;/span&gt;localhost:5000/nginx]
5b8c72934dfc: Pushed 
latest: digest: sha256:dca71257cd2e72840a21f0323234bb2e33fea6d949fa0f21c5102146f583486b size: 527
Signing and pushing trust metadata
Enter passphrase &lt;span class="k"&gt;for &lt;/span&gt;root key with ID 9a1dd40: 
Enter passphrase &lt;span class="k"&gt;for &lt;/span&gt;new repository key with ID 4d1832f: 
Repeat passphrase &lt;span class="k"&gt;for &lt;/span&gt;new repository key with ID 4d1832f: 
Finished initializing &lt;span class="s2"&gt;"localhost:5000/nginx"&lt;/span&gt;
Successfully signed localhost:5000/nginx:latest
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The root and the repository (targets) keys are created once, and stored locally on the client machine which pushes the first image to the repository. The passphrases you entered above will be required when you want to push a new tag to the &lt;code&gt;localhost:5000/nginx&lt;/code&gt; repository. You can read more about different types of the keys involved in content trust and their management &lt;a href="https://docs.docker.com/engine/security/trust/trust_key_mng/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install notary cli&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;notary
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can verify whether the image pushed to the local registry is signed by the Notary server with this command&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;notary &lt;span class="nt"&gt;-s&lt;/span&gt; https://localhost:4443 &lt;span class="nt"&gt;-d&lt;/span&gt; ~/.docker/trust list localhost:5000/nginx

NAME    DIGEST                                                              SIZE &lt;span class="o"&gt;(&lt;/span&gt;BYTES&lt;span class="o"&gt;)&lt;/span&gt;    ROLE
&lt;span class="nt"&gt;----&lt;/span&gt;    &lt;span class="nt"&gt;------&lt;/span&gt;                                                              &lt;span class="nt"&gt;------------&lt;/span&gt;    &lt;span class="nt"&gt;----&lt;/span&gt;
latest  2f1cd90e00fe2c991e18272bb35d6a8258eeb27785d121aa4cc1ae4235167cfd    1570            targets
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The &lt;code&gt;-s&lt;/code&gt; flag indicates the location of the Notary server. The directory specified by &lt;code&gt;-d&lt;/code&gt; flag has all the keys which were generated in previous steps along with the cache of already downloaded trust metadata.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let’s try to download any other image which has not been signed by notary&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker pull alpine:latest
Error: error contacting notary server: x509: certificate is valid &lt;span class="k"&gt;for &lt;/span&gt;notary-server, notaryserver, localhost, not localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We won’t be able to pull images which aren’t signed by the Notary server as we have content trust enabled, and have successfully implemented container image trust in our environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  State of content trust in Kubernetes
&lt;/h2&gt;

&lt;p&gt;Kubernetes does not support content trust natively as of now. But there are some ways you can achieve a similar result. To implement content trust in Kubernetes, you can use a container runtime which supports content trust. Docker is the only container runtime which supports this as of now. This feature is not supported by other runtimes such as CRI-O. You can read more on this in this GitHub issue &lt;a href="https://github.com/cri-o/cri-o/issues/2065#issuecomment-462443671"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Similar to the approach we used in the previous section, you can make sure the environment variables &lt;code&gt;DOCKER_CONTENT_TRUST&lt;/code&gt; and &lt;code&gt;DOCKER_CONTENT_TRUST_SERVER&lt;/code&gt; are set correctly on each of the worker nodes of the cluster. Each image which gets pulled on to the nodes will get verified with the Notary server before running. This approach enables content trust globally in your Kubernetes environment. It also assumes that you will be using a private container repository and will be pulling the images exclusively from this private repository.&lt;/p&gt;

&lt;p&gt;An alternative approach is to use an admission controller in the Kubernetes cluster. This controller will intercept each workload creation request, verify if the image being used in the workload spec is signed. If it is not signed, then the request to create or update the workload will be rejected by the controller. &lt;a href="https://siegert-maximilian.medium.com/ensure-content-trust-on-kubernetes-using-notary-and-open-policy-agent-485ab3a9423c"&gt;OPA + Rego can be used to build such admission controller&lt;/a&gt;. These are some ways we can achieve content trust in Kubernetes environments.&lt;/p&gt;

&lt;p&gt;We've explored the importance of supply chain security, enabling content trust in Docker using Notary and ways to implement content trust in Kubernetes. That’s all folks, we will be looking more on supply chain and cloud-native security in the upcoming posts.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/theupdateframework/notary/tree/master/docs"&gt;Notary documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/security/trust/"&gt;Docker content trust documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://theupdateframework.github.io/specification/latest/"&gt;The Update Framework documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://goharbor.io/docs"&gt;Harbor documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://siegert-maximilian.medium.com/ensure-content-trust-on-kubernetes-using-notary-and-open-policy-agent-485ab3a9423c"&gt;Ensure Content Trust on Kubernetes using Notary and Open Policy Agent - Maximilian Siegert&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This blog post was originally posted on InfraCloud's &lt;a href="https://www.infracloud.io/blogs/enforcing-image-trust-docker-containers-notary/"&gt;blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>cloudnative</category>
      <category>cloudsecurity</category>
    </item>
    <item>
      <title>Starting your Cloud Security Journey</title>
      <dc:creator>Frederick Fernando</dc:creator>
      <pubDate>Tue, 05 Oct 2021 06:33:55 +0000</pubDate>
      <link>https://dev.to/securetty/starting-your-cloud-security-journey-57j9</link>
      <guid>https://dev.to/securetty/starting-your-cloud-security-journey-57j9</guid>
      <description>&lt;p&gt;When you start building your cloud infrastructure, security might not be a top priority as much as getting your project up and running. This might lead you to delay security considerations for later and end up having an insecure cloud environment for a long period of time. The more this is put off, the more difficult and expensive it is going to be to fix this. In worst cases, it might be necessary to re-architect your environment. Worse yet if you do have a security attack, it will cost you considerably more money and effort to respond to these threats. In some cases, external incident response teams have to be brought in and making them do this work is exponentially more expensive. This blog post is to guide you through the basic steps you can take to improve your cloud security posture in the early stages of building your cloud infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some of the important focus areas of starting your cloud security journey are:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threat modeling&lt;/li&gt;
&lt;li&gt;Fixing security misconfigurations&lt;/li&gt;
&lt;li&gt;Containing network access&lt;/li&gt;
&lt;li&gt;Improving access to cloud resources&lt;/li&gt;
&lt;li&gt;Securing IAM policies&lt;/li&gt;
&lt;li&gt;Implementing logging and monitoring&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide is focused towards AWS environments, but almost all of these implementations can be carried forward to other cloud providers. You can also find similar tools for the cloud provider of your choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Threat modeling
&lt;/h2&gt;

&lt;p&gt;Threat modeling is the process of identifying threats and then defining countermeasures to prevent or mitigate the threats to the system. This works for  a wide range of systems including cloud architectures, applications, IoT devices and business processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps involved in threat modeling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build an architecture diagram&lt;/li&gt;
&lt;li&gt;Identify threats&lt;/li&gt;
&lt;li&gt;Mitigate&lt;/li&gt;
&lt;li&gt;Validate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first step involved in threat modelling is to build an architecture diagram of the system you are protecting. This also involves building a list of assets in the system. You cannot protect something which you don’t have visibility over. We can use tools such as CloudMapper from the previous step for building an architecture diagram of an AWS cloud environment. There are similar tools for threat modeling for other cloud service providers like &lt;a href="https://github.com/lyft/cartography"&gt;Cartography&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you have an architecture diagram and inventory list, you can start identifying threats which can occur to the system. You can use &lt;a href="https://insights.sei.cmu.edu/blog/threat-modeling-12-available-methods/"&gt;threat modeling methods like STRIDE or PASTA&lt;/a&gt; to achieve this.&lt;/p&gt;

&lt;p&gt;An example of this would be: What is the likelihood of an attack if a developer's cloud credentials were to be leaked? What are the mitigating controls to minimize damage if the credentials were to be compromised?&lt;/p&gt;

&lt;p&gt;Take action by implementing the mitigating controls. This would help you architect a system keeping the security of it as a crucial part of the design process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixing security misconfigurations
&lt;/h2&gt;

&lt;p&gt;One of the major cloud vulnerabilities are security misconfigurations. According to &lt;a href="https://securityboulevard.com/2019/04/most-cloud-breaches-are-due-to-misconfigurations-2/"&gt;this report&lt;/a&gt;, over 95% of the cloud vulnerabilities are related to cloud misconfigurations. Similar to the previous challenge, having visibility into your current cloud environment is quite difficult. Common misconfigurations include having overly permissive firewall rules/security groups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prowler
&lt;/h3&gt;

&lt;p&gt;Prowler is an open source security auditing tool which can help us identify cloud security misconfigurations. Prowler is AWS only. Prowler is a command line tool that helps you with AWS security assessment, auditing, hardening, and incident response. It follows CIS benchmarks for AWS and can also assist in GDPR, HIPAA, PCI-DSS, ISO 27001, SOC2, and others.&lt;/p&gt;

&lt;p&gt;You can find the &lt;a href="https://github.com/toniblyx/prowler#requirements-and-installation"&gt;Prowler installation steps here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Prowler will give you a list of security vulnerabilities in your cloud account. You can take an export of the findings in HTML, CSV, JSON or json-asff format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integration with Security Hub
&lt;/h3&gt;

&lt;p&gt;Prowler integrates natively with &lt;a href="https://aws.amazon.com/security-hub/"&gt;AWS Security Hub&lt;/a&gt;. With Security Hub, you have a single place that aggregates, organizes, and prioritizes the security alerts or findings from multiple AWS services such as AWS GuardDuty, Inspector, Macie and others. The json-asff format comes in handy for integration with AWS Security Hub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Containing network access
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Building a network diagram
&lt;/h3&gt;

&lt;p&gt;We need a network diagram to assess the architecture of the cloud environment. It might be difficult for teams to have an updated network diagram, and due to the dynamic nature of the cloud, you might not know what your cloud environment looks like at any moment. Cloud resources are more often than not spun up without visibility and it gets difficult to have a controlled environment.&lt;br&gt;&lt;br&gt;
For these reasons, it is good to use tools like CloudMapper to visualize the current layout of your cloud environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  CloudMapper
&lt;/h3&gt;

&lt;p&gt;CloudMapper helps you analyze your Amazon Web Services (AWS) environments. It aids in building network diagrams and displays them in your browser. You can find the &lt;a href="https://github.com/duo-labs/cloudmapper#installation"&gt;CloudMapper setup steps here&lt;/a&gt;&lt;br&gt;
and &lt;a href="https://github.com/duo-labs/cloudmapper#using-a-docker-container"&gt;using a Docker container&lt;/a&gt;.&lt;br&gt;
Make sure that you create required read only IAM roles with these privileges.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;arn:aws:iam::aws:policy/SecurityAudit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;arn:aws:iam::aws:policy/job-function/ViewOnlyAccess&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Network segmentation
&lt;/h3&gt;

&lt;p&gt;By implementing network segmentation we reduce the network attack surface. Consider adopting a fail safe network access approach rather than fail open. Explicit network access should be allowed for required applications. You can implement micro segmentation by using Kubernetes network policies for container workloads. Different environments like staging, development and production should reside in segmented networks or different accounts. Different cloud accounts for business units, workloads, logging, monitoring, identity etc. should be used to further reduce the attack surface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improving access to cloud resources
&lt;/h2&gt;

&lt;p&gt;Connectivity to your cloud resources should have secure and private access. There can be multiple ways to achieve this, through a VPN setup to a bastion/jump box. Or have a central authentication system with something like &lt;a href="https://www.keycloak.org/"&gt;Keycloak&lt;/a&gt; or &lt;a href="https://goteleport.com/"&gt;Teleport&lt;/a&gt;. You can integrate these systems with federated authentication mechanisms similar to Okta or any other SSO implementations.&lt;br&gt;
Another way of doing this is by using AWS SSM, this takes away the overhead of managing your own central authentication system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Securing IAM policies
&lt;/h2&gt;

&lt;p&gt;User access policies (IAM policies) is another core control which can help you secure your cloud infrastructure. By having good security hygiene around IAM policies you can reduce the potential of an attacker doing extensive damage in case of a breach. Here are some of the minimal security controls for a new project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some IAM controls you should consider implementing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lock away your cloud account root user access keys&lt;/li&gt;
&lt;li&gt;Create individual IAM users&lt;/li&gt;
&lt;li&gt;Use user groups to assign permissions to IAM users&lt;/li&gt;
&lt;li&gt;Grant least privilege&lt;/li&gt;
&lt;li&gt;Configure a strong password policy for your users&lt;/li&gt;
&lt;li&gt;Enable MFA&lt;/li&gt;
&lt;li&gt;Use roles to delegate permissions&lt;/li&gt;
&lt;li&gt;Do not share access keys&lt;/li&gt;
&lt;li&gt;Rotate credentials regularly&lt;/li&gt;
&lt;li&gt;Remove unnecessary credentials&lt;/li&gt;
&lt;li&gt;Monitor activity in your cloud account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use tools like &lt;a href="https://github.com/salesforce/policy_sentry"&gt;policy_sentry&lt;/a&gt; to create least privilege IAM policies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security logging and monitoring
&lt;/h2&gt;

&lt;p&gt;Security logging and monitoring is an essential part of your cloud security program. This will help you identify what went wrong in your cloud environment and is the only way you can uncover malicious events.&lt;/p&gt;

&lt;p&gt;For starters, you can at least have Cloudtrail enabled in all regions and put it in cloud storage. Next, you should set alerts for common security use cases, like multiple authentication denies or privilege escalation failures.&lt;/p&gt;

&lt;p&gt;What else to log?&lt;br&gt;&lt;br&gt;
API Call Logs (Cloudtrail), DNS logs (Route53), Network Access logs (VPC Flow logs), Cloud storage logs (S3), Security services logs like Security Hub, GuardDuty, WAF logs and application logs need to be logged to build detection rules.&lt;br&gt;
It is recommended to have a separate logging account for long term storage and have a centralized monitoring account and shipping the data into an SIEM like Elasticsearch. Build detection rules for cloud and application security use cases here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By keeping security as one of the core principles while building out your cloud infrastructure, you save time on security efforts when you have to scale your operations. By doing these steps you can start building your cloud security. Security is a hard problem for businesses to solve and it's best you get working on these challenges from the get go.&lt;/p&gt;

&lt;p&gt;That’s all folks, lookout for more posts on security for the next steps in your cloud security journey. I’d love to hear your thoughts on this post, do start a conversation with me on &lt;a href="https://twitter.com/securetty_"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/frederick-fernando-7a43211a/"&gt;LinkedIn&lt;/a&gt; :).&lt;/p&gt;

&lt;p&gt;This post was originally published on InfraCloud's &lt;a href="https://www.infracloud.io/blogs/starting-cloud-security-journey/"&gt;blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cloudnative</category>
      <category>cloudsecurity</category>
      <category>securityengineering</category>
      <category>security</category>
    </item>
  </channel>
</rss>
