Chef Inspec Configuration Steps

close up photo of programming of codes
Reading Time: 2 minutes

Introduction:

Hello Readers. In this blog, we are going to see how to configure chef inspec in our local system to execute the tests.

Chef is an open-source testing framework. They are used to test or validate the configurations, security components as per the client’s requirements or organization’s requirements. It is mainly used to test infrastructure configurations. we can even test cloud services such as AWS, Google (GCP), Azure.

Steps to configure chef inspec in our local system

  • First we download visual studio code IDE.

  • Then we download Chef workstation software from their official website and install it.

About Chef Workstation: 

Chef Workstation helps to get started with Chef Infra or Chef InSpec. Components like remote scanning and reusable copybook tools all are available in one package.

The URL for downloading the software: https://downloads.chef.io/tools/workstation#windows.

  • After that we cross-check CW PowerShell shortcut icon is created or not upon installing Chef Workstation. The PowerShell shortcut icon looks like this:

  • Then we download and install AWS CLI software.

AWS CLI: 

The AWS Command Line Interface (CLI) helps to manage our AWS services. With just one unified tool, you can control and automate multiple AWS services. 

It is a mandatory step to test AWS services from Chef Inspec scripts.

The URL to download the software: https://aws.amazon.com/cli/

  • Then we double click on CW PowerShell shortcut icon. 
  • After that we type “AWS configure” to configure AWS credentials. ( AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format).

The following curl script will install Chef InSpec for Ubuntu and Red Hat Enterprise Linux:

curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P inspec

For Ubuntu, use the following command to install:

sudo dpkg -i /path/to/inspec.deb

For Red Hat Enterprise Linux, use the following command to install:

sudo rpm -U /path-to/inspec.rpm

Conclusion

In short, it is an open-source framework for testing and auditing your applications and infrastructure. They work by comparing the actual state of your system with the desired state that you express in easy-to-read and easy-to-write Chef InSpec code. The minimum skills required to write the test scripts and test AWS services include basic knowledge of AWS, Ruby, and Chef Inspec framework.

knoldus

Written by 

I am reliable, hard-working with strong attention to detail and eager to learn about new technologies and business issues. I am able to work well both on my own initiative and as part of a team.