Building Secure Images Using Prisma Jenkins Plugin

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
L4 Transporter
No ratings

By Tushir Pruthi, Customer Success Engineer

 

Welcome to our presentation on Building Secure Images Using Prisma Jenkins Plugin. This topic comes under Shift Left, which is the best practice to create Secure Images. This document is restricted to Continuous Integration. You can even parse the IAC templates using the Application Security Module of Prisma Cloud. However that topic is beyond the scope of this Article.

 

We'll explore the fundamentals of Continuous Integration, CI tool Jenkins and its Integration with Prisma Cloud and GitHub, and at last we will discuss creating a Docker Image using Jenkins Pipeline leveraging Prisma Plugin for Jenkins. We will define the CI rules/Quality Gates in Prisma Compute, which will govern the Result of CI.

 

Environment/Tools Used:

 

  • Ubuntu Linux Host, Jenkins Installed
  • Docker
  • Prisma Compute Version 33.
  • GitHub

 

What is Continuous Integration?

 

Continuous Integration (CI) is a software development practice where developers frequently merge their code changes into a shared repository, usually multiple times a day. Each integration is automatically verified by building the project and running tests to detect errors early. This helps in identifying and fixing bugs faster, improving software quality, and reducing integration issues.

 

A CI pipeline typically includes steps like code compilation, automated testing, static code analysis, and artifact generation. Tools like Jenkins, GitHub Actions, GitLab CI/CD, and CircleCI facilitate CI implementation.

 

We will focus on Jenkins as it is among the most popular tools and Prisma Compute Provides a native Plugin for Jenkins, However Prisma Cloud can be Integrated with any CI tool or Automation Framework since it provides a cli utility called as twiscli. 

 

Jenkins Plugin also uses twistcli underneath.

 

Key benefits of CI include:

  • Early bug detection: Frequent testing ensures issues are caught early.
  • Improved collaboration: Developers work with the latest code, reducing integration conflicts.
  • Faster development cycles: Automation speeds up code validation.
  • Higher code quality: Continuous testing leads to better software stability.

 

CI is often used alongside Continuous Deployment (CD), where tested code is automatically deployed to production. Together, they enable faster, more reliable software delivery. Companies adopting CI/CD improve efficiency, reduce manual work, and enhance customer satisfaction through rapid feature releases.

 

Jenkins

 

Jenkins is an open-source automation server used for Continuous Integration (CI) and Continuous Deployment (CD). It helps automate building, testing, and deploying applications, ensuring faster and more reliable software delivery. Written in Java, Jenkins supports numerous plugins for integrating with various tools like Git, Docker, and Kubernetes. 

 

It allows developers to set up CI/CD pipelines using a simple web interface or declarative pipelines in code. Jenkins runs on multiple platforms and can be extended with plugins for customized workflows. Its benefits include improved efficiency, early bug detection, and streamlined software development, making it a popular choice for DevOps teams.

 

Docker

 

Docker is an open-source platform that enables developers to build, package, and run applications in lightweight, portable containers. These containers include everything needed to run the application—code, libraries, dependencies—ensuring consistency across different environments. Docker helps streamline development, testing, and deployment, reducing compatibility issues and simplifying DevOps workflows.

 

Docker Images

 

A Docker Image is a lightweight, standalone, and executable package that contains the application code, runtime, dependencies, and configurations. Images serve as blueprints for containers, and multiple containers can be created from the same image. Images are stored in repositories like Docker Hub and can be versioned for easy updates and rollbacks.

 

GitHub

 

GitHub can be integrated with Jenkins for Continuous Integration (CI) to automate building, testing, and deploying applications. Using webhooks, Jenkins can be triggered whenever code is pushed to a GitHub repository. The GitHub plugin in Jenkins allows seamless integration, enabling developers to fetch code, run tests, and generate artifacts automatically.

 

A typical Jenkins pipeline pulls the latest code from GitHub, runs CI steps (build, test, analyze), and provides feedback. This setup helps detect bugs early, ensures code quality, and speeds up development. Jenkins can also deploy successful builds, making it a powerful tool for GitHub-based CI/CD workflows.

 

Prisma Compute Plugin For Jenkins

 

The Prisma Cloud Compute plugin for Jenkins integrates Palo Alto Networks' security capabilities into Jenkins CI/CD pipelines. This plugin enables automated security scanning of container images and serverless functions during the build process, identifying vulnerabilities, compliance issues, and malware before deployment. 

 

By incorporating these security checks early in the development cycle, teams can proactively address potential risks, ensuring that only secure and compliant artifacts progress through the pipeline. The plugin supports both freestyle and pipeline jobs, offering flexibility in how security scans are configured and executed within Jenkins. Integrating Prisma Cloud Compute with Jenkins enhances the security posture of applications by embedding continuous security assessments into the CI/CD workflow.

 

image2.png

Figure01:CI_Pipeline_Prisma_Cloud _PaloAltoNetworks

 

The above diagram depicts a CI Job, in which a user commits a Dockerfile to the GitHub Repo, which triggers a Jenkins BuildJob as it is invoked by the Webhook. Jenkins Job Builds a new Image, and the power of Prisma Compute comes in, which scans the Images against the CI Rules defined in Prisma Cloud. If the Build meets the criteria wrt to vulnerabilities and compliance, then Build job continues, or else it is marked as Failed.

 

Creating the Jenkins Job

 

1.  Installing Prisma Cloud Plugin

 

Download Plugin from Prisma Compute Console. (Manage ⇒ System ⇒ Utilities)

 

image4.png

Figure02:Prisma_Jenkins_Plugin_Cloud _PaloAltoNetworks

 

      Open Jenkins Console, Click Manage Jenkins, Plugins, Advanced Settings. Upload the Plugin to Jenkins and click on Deploy.

 

image8.png

Figure03:Prisma_Jenkins_Plugin_Cloud_Install _PaloAltoNetworks

 

        You will see the success message.

 

  2.  Configure Jenkins Prisma Plugin to communicate with Prisma Compute

 

   Open Jenkins Console, Clock Manage Jenkins, Locate Prisma Cloud Section. Enter the values for Address, User and Password from your setup, then click on the Test Button, you will       see a success message. Refer to the below screenshot:

 

 
image6.png

 Figure04:Configure_Prisma_Jenkins_Plugin_Cloud_PaloAltoNetworks



3. Create a GitHub Repo with a Dockerfile and Configure GitHub Webhook to trigger a Job when a commit is made.

 

            Click on Repo Settings ⇒ Webhooks and then Add Webhook. 

 

 
image1.png

Figure05:Configure_GitHub_Repo_WebHook_PaloAltoNetworks

 

4. Defining the Prisma CI Rules.

 

          CI Rules can be created under Defend ⇒ Vulnerabilities and Defend ⇒ Compliance Sections. 

 

    In the below screenshot for vulnerabilities, we are defining the pipeline to fail in case the Image has any vulnerability (low,moderate, high,critical). You can customize the rule to        meet your Project needs. You have the possibility to add exception CVE’s within the Rule. Refer Prisma Compute Admin Guide for more details about this.  

 

 
image3.png

Figure06:Prisma_CI_Vulnerability_Rule_PaloAltoNetworks

 

5. Create a FreeStyle Jenkins Job

 

For Simplicity we are creating a freestyle project, feel free to create a pipeline as well.

  • It pulls the GitRepo with a Dockerfile.

 

You may need to add credentials in case your Repo is not Public.

 

image5.png

Figure07:Pull_GitHub_Repo_PaloAltoNetworks

 

  • Builds the Docker Image using Docker Plugin or docker cli:

                    As Repo contains the Dockerfile, run 

                    docker build -t image_name:tage_name . 

                    The Image name must match the criteria which is defined in the Prisma Rule Collection.

 

  • It scans the Image using the Prisma Plugin

Specify the Image Name, which you used in the previous step.

 

 
image9.png

Figure08: Scan_Image_Prisma_PaloAltoNetworks

 

  • Pushes the Image to DockerHub.

 

Use the Docker Plugin or docker push command to publish the Image to DockerHub.

 

Sample Screenshot of a Failed and Passed CI Build.

 

You can validate the Build Status in Jenkins Console as well as Prisma Console.

In Prisma, you can validate  by clicking on Monitor ⇒ Vulnerabilities ⇒ CI Tab, Locate your Image, you would be able to see your Jenkins Job Name, Job Number as well.

 

 

 

image7.png

Figure09: Scan_Results_Prisma_PaloAltoNetworks


Conclusion: Building Secure Images Using Prisma Jenkins Plugin

 

Shift Left : Prisma Jenkins Plugin provides early feedback to the developers to fix the Vulnerability and Compliance issues. It ensures that only Images which meet the defined Standards are moved to the Production Environment. It significantly reduces the associated Risk and Attack Surface 

 

References

 

Admin Guide

 

Git Jenkins Plugin



Rate this article:
  • 586 Views
  • 0 comments
  • 0 Likes
Register or Sign-in
Labels
Article Dashboard
Version history
Last Updated:
‎02-10-2025 05:46 PM
Updated by: