Security in IaC

Security in IaC

Dear Friend,

IaC allows us to automate the infrastructure with speed. But when writing infrastructure as code, there's possibility for security misconfigurations.

So, what we can do ?

We can use tools like Checkov to make sure there's no surprises.

How to get started with Checkov ?

  • Sign-in to Checkov
  • Navigate to Integrations --> API TOKENS --> Add Token --> Under Token name text box enter a string that you desire such as development, testing --> Click Create --> A Token would be generated like the one illustrated here.

No alt text provided for this image

  • Open Visual studio and navigate to extensions and search for "Checkov" and install the extension.

No alt text provided for this image

  • Go to Checkov settings and add the API Token generated at Checkov's website

No alt text provided for this image

Now you can scan your code against pre-built policies that Checkov provides and in addition you can also write your own custom policy.

Let's see an example which uses built in policies.

The main.tf illustrated below requires a new VPC.

No alt text provided for this image

After saving the terraform, checkov extension scanned the code and throws the below message

No alt text provided for this image

Then I fixed the medium level policy error by implementing VPC flow logging. And I suppressed the low level policy error.

The below illustration is after fix, Checkov didn't report any policy error now.

No alt text provided for this image

What's Next ?

Experiment checkov at your end and share your comments.

You can integrate Checko with CI tools such as GitLab, GitHub Actions ( Link has samples )

Mohamed Lemine Ahmedou Yassin

Cloud Architect x DevOps Engineer x 3 * AWS Certifications x Full Stack Developer

2 年

Thank you , those tools only help you with error and improvements in the IaC script but in your environment you should consider your cloud provider best practices and native services to help you secure your infrastructure.

要查看或添加评论,请登录

Rajesh Muthusamy的更多文章

  • Terraform in 6 Weeks - Week 2: Build a Scalable Static Website

    Terraform in 6 Weeks - Week 2: Build a Scalable Static Website

    Dear friend, The week 2 objective is to create a scalable and highly available static website hosted on S3, served…

    2 条评论
  • Terraform in 6 Weeks - Week 1: Architectural view

    Terraform in 6 Weeks - Week 1: Architectural view

    Dear Friend, In Week 0, we covered the basics of Terraform to get you started. Now, let’s dive deeper into Terraform’s…

    2 条评论
  • Terraform in 6 Weeks - Week 0: Laying the Foundation

    Terraform in 6 Weeks - Week 0: Laying the Foundation

    Dear Friend, Terraform is the gold standard in Infrastructure as Code (IaC), and mastering it is a skill that will stay…

    8 条评论
  • Understanding the OSI Model

    Understanding the OSI Model

    Dear Friend, The Open Systems Interconnection (OSI) model is a fundamental conceptual framework that illustrates how…

    2 条评论
  • Understanding Linux File Permissions

    Understanding Linux File Permissions

    Dear Friend, Linux file permissions are a fundamental aspect of the operating system's security model, determining who…

  • Kubernetes Networking

    Kubernetes Networking

    Dear Friend, In the world of kubernetes, we have different levels of networking requirements. Container-to-container…

    1 条评论
  • How To Design A Container-Based Application?

    How To Design A Container-Based Application?

    Dear Friend, Container is an important moving part of microservices architecture. You will need to place your…

  • The Journey Of A Code To Pod

    The Journey Of A Code To Pod

    Dear Friend, The journey of code towards Pod has multiple stages, and would feel overwhelming to dig the path. But…

    2 条评论
  • How Pods Connect Over Network?

    How Pods Connect Over Network?

    Dear Friend, Kubernetes allows unrestricted communication between pods by default. All pods can communicate with each…

    5 条评论
  • What The Helm?

    What The Helm?

    Dear Friend, In the Kubernetes world, there's no shortage of buzzwords. One among them is Helm.

    1 条评论

社区洞察

其他会员也浏览了