Chef Premium Content delivers curated content for compliance audits and remediation based on the Center for Internet Security (CIS) certified benchmarks and Defense Information Systems Agency (DISA) Security Technical Implementation Guides (STIGs). Chef
offers premium content for operating systems, databases, web server applications, cloud and container systems, and other applications.
In this blog, we explain:
- How to run an audit on a target node
- How to run remediation on a target node
- Accessibility of audit and remediation content
Setting up the Environment
Install Chef Workstation
A collection of developer tools enables devices in your fleet to interact securely with your Chef Server. This includes Chef Knife, Chef InSpec, Cookstyle, Chef Habitat, and Test Kitchen. Ruby and other dependencies are also included, so you don’t have to install anything else to start with all the Chef tools.
Prerequisites
Steps for running an audit on a target node
To audit a raw node by specifying and scanning a profile, select a benchmark from the listed profiles under the Compliance tab. In this example, you have an Ubuntu raw node, so filter and select Ubuntu from profiles based on its version.
![Selecting Ubuntu Raw Mode in Chef Automate](/images/cheflibraries/about/image-187c960d5-d75d-4c89-83e8-75ec592be2c5.png?sfvrsn=6db8cc7b_0)
Once you have selected the profile based on the operating system, you can add and scan the node. To do this, under the Nodes added
section, fill in the remote node IP address with an optional name for your node. Next, select the credential
file to validate and click on add node.
![Add node](/images/cheflibraries/about/image-2.png?sfvrsn=7f608732_0)
In a few seconds, you will see whether this node is in a reachable or un-reachable state. The client node will be unreachable if the wrong credential file is selected and sent across server.
Next, scan the node with the selected profile. Give specific naming conventions for the generated reports and click on Save. When the status changes to "completed," you can view detailed information under "Failed and Passed Controls."
![Scanning the node](/images/cheflibraries/about/image-4.png?sfvrsn=3fac5213_0)
Information about the node will be available in the Report section under the Compliance tab, report section. In addition, you can view the detailed report under "Failed and Passed Controls." Information about the node IP, platform details, Scan
details, etc., is also available.
![Information about the node](/images/cheflibraries/about/image-5.png?sfvrsn=33699069_0)
After the scan, note the control that has failed and passed. These are the results from the scan using the Center for Internet Security (CIS) or Defense Information Systems Agency (DISA) audit profiles.
Steps for running remediation on a target node
Download the remediation content based on your machine information. In this example, you will have to download Ubuntu remediation content since it is an Ubuntu a raw node.
![Download Ubuntu Remediation](/images/cheflibraries/about/image-6.png?sfvrsn=35428f68_0)
Once downloaded, unzip the file, copy the content inside the folder, and paste it into the cookbooks folder in Chef Workstation.
Upload the cookbooks to Chef Server through this command from workstation
“Knife cookbook upload remediation_cis_ubuntu20_v_1_0_0”
Bootstrap the node (target) from Chef WorkStation
knife bootstrap 18.212.213.148 -N awsubuntu -U ubuntu --sudo -
i ~/Desktop/akshay.pem
![Example of how to bootstrap the node from Chef WorkStation](/images/cheflibraries/about/image-7.png?sfvrsn=e8c8169e_0)
Here, “18.212.213.148” is the client node IP address, “awsubuntu” is the naming convention given to the node, and ubuntu is the machine name.
In the screenshot below we can see the added node under the infrastructure tab.
![Node under Infrastructure Tab in Chef Automate](/images/cheflibraries/about/image-8.png?sfvrsn=5fc41dcc_0)
You can search for the added node using the command knife node list
. You can also verify the nodes by looking at the Automate dashboard.
Add the run-list “Cookbook name” to the node with the command
knife node run_list add <node_name> ‘recipe[<cookbook name>]’
Uploaded cookbook successfully – From Workstation to Server
Once the cookbook has been uploaded to the server, login to a remote client and run
sudo chef-client
ssh -i "akshay.pem" ubuntu@ec2-172-31-56-
155.compute.1.amazonaws.com
![Login to a remote client example](/images/cheflibraries/about/image-9.png?sfvrsn=69fac15f_0)
When the chef-client execution is completed, perform an audit
scan again on the remote node with the same profile but with a different naming convention. This will make it easier to differentiate the two scans when analyzing the result of the remediation.
After the scan, you'll see a drastic fall in error rates under failed controls and an increase in the number of passed controls. This is because the remediation cookbook has fixed the controls failing in the initial scan.
Before executing remediation, cookbook there were 86 failed Controls.
![View in Chef before executing remediation cookbook](/images/cheflibraries/about/image-10.png?sfvrsn=5657d12_0)
After executing remediation cookbook, the number of failed controls fall to 48.
We were able to automate the remediation of 38 controls using a remediation cookbook.
![View in Chef after executing remediation cookbook](/images/cheflibraries/about/image-11204dfb93-d7ca-4922-a0ef-c84057cddd4e.png?sfvrsn=32799f69_0)
Conclusion
Learn more about Chef Premium Content
Enterprise customers can reach out to their respective customer success managers, customer architects or technical support team for any clarifications.