How to Integrate Progress Chef Compliance with Jenkins Pipelines

Introduction

When practicing DevSecOps, balancing automation and efficiency with strong compliance and security measures is vital. Integrating Progress Chef Compliance into your Jenkins pipelines verifies if your software delivery processes adhere to high-quality and security standards. This integration allows for automated compliance checks during continuous delivery, helping your organization meet regulatory requirements while minimizing risks.

In this article, we'll walk you through the steps to integrate Chef Compliance with Jenkins pipelines, enabling streamlined compliance verification throughout your deployment process.

Prerequisites for Integrating Chef Compliance into Jenkins Pipelines

  • Jenkins is installed and running
  • Chef Workstation is installed
  • A GitHub repository for your Chef cookbooks is created
  • SSH access to your Jenkins server is provided

Step 1: Install and Configure Jenkins

Installing Jenkins

First, get Jenkins up and running on the server. Open the terminal and execute the following commands:

$ wget -q -O -
https://pkg.jenkins.io/debian/jenkins.io.key | sudo
apt-key add - sudo sh -c 'echo deb

http://pkg.jenkins.io/debian-stable binary/ >
/etc/apt/sources.list.d/jenkins.list'

$ sudo apt-get update

$ sudo apt-get install jenkins

Start Jenkins and enable it to start on boot:

$ sudo systemctl start jenkins

$ sudo systemctl enable jenkins

Accessing Jenkins

Open the web browser and navigate to: http://localhost:8080.

Installing Necessary Plugins

We need to install a few plugins to integrate Chef and Chef InSpec plugins on Jenkins.

1. Go to Manage Jenkins > Manage Plugins

Manage Jenkins > Manage Plugins is critical to setting up Jenkins for any integration, including Chef Compliance. Here's why it matters:

Plugin Management: Jenkins is highly extensible through plugins. We must install the appropriate plugins to enable features like Chef and InSpec integration.

Accessing Plugin Management: From the Jenkins dashboard, navigate to Manage Jenkins > Manage Plugins. This section allows you to browse, install and update plugins. It's your gateway to extending Jenkins' capabilities.

Key Plugins for Chef Integration:

->Chef Plugin: Integrates Jenkins with Chef for configuration management.
->InSpec Plugin: Facilitates compliance checks using Chef InSpec.
->Ruby Plugin: Required for running Ruby scripts as part of your pipeline.

screenshot of a web browser

2. Install the following plugins:

->Chef
->InSpec
->Ruby

Step 2: Set Up Chef and InSpec

Installing Chef Workstation

The Chef Workstation is essential for managing your cookbooks and running compliance checks. Install it using:

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

Installing Chef InSpec

Chef InSpec is included with Chef Workstation, but you can install it separately too.

Preparing Chef Cookbooks and Chef InSpec Profiles

Confirm that the Chef cookbooks and Chef InSpec profiles are ready. We can create new ones or use existing profiles to define your compliance standards.

Step 3: Jenkins Job Configuration

Create a Jenkins Job and install the necessary plugins.

Create a new pipeline job in Jenkins. This job will execute Chef and InSpec commands to maintain compliance.

  • Access Jenkins Dashboard: Log in and click "New Item."
  • Name the Job: Enter a name like Chef-Compliance-Pipeline and select "Pipeline" as the job type.

Click " OK" to proceed.

Build Pipeline Configuration

Pipeline Script Configuration

  • Define Stages: Break down the pipeline into stages to represent separate phases of the build process:
  • Build Stage: Compile or prepare your application (optional).
  • Compliance Check Stage: Run Chef and InSpec commands to verify infrastructure compliance.

The test results showed no failures or skipped controls, indicating that the profile works as intended. This outcome confirms that our compliance check is adequate.

Step 4: Execution and Monitoring

  • Running the Jenkins Job: Trigger the Jenkins job to execute Chef cookbooks and compliance checks. This will automate the process of checking whether your infrastructure is compliant.
  • Monitoring Outputs: Monitor the job outputs through Jenkins to check for success or failure. This helps in keeping your infrastructure compliant and secure.

Step 5: Continuous Integration and Alerts

  • Automating Compliance: Verification Schedule the Jenkins job to run at regular intervals to verify compliance continuously. This helps in adherence to compliance standards.
  • Setting Up Notifications: Configure Jenkins to send notifications for compliance failures. Use plugins like Email Extension or Slack Notification to alert your team immediately.

Conclusion

Integrating Chef Compliance with Jenkins Pipelines automates the process of maintaining a compliant infrastructure. This integration enhances security and streamlines the deployment process, making it more efficient and reliable.

Key Takeaways

  • Automation: Automating compliance checks with Jenkins and Chef reduces manual errors and improves security.
  • Efficiency: Streamlining the deployment process with automated compliance checks.
  • Reliability: Maintaining consistent compliance across your infrastructure.

References

 

 

Tags:

Saikeerthi M

I'm Saikeerthi M, a Coop/Intern Technical at Progress, based in Bangalore, India. I love collaborating with different teams; each day presents a new challenge and learning opportunity. Progress has become like a second family to me, and I’m proud of the growth and contributions I've been making to my team. I’m passionate about technology, continuous learning and exploring new ways to make a meaningful impact in the tech world.