Jenkins Container Scan¶
The AccuKnox Container Scan Jenkins Plugin is designed to integrate AccuKnox's container scanning capabilities into your Jenkins pipelines. This plugin allows you to perform container image scans and automatically upload the results to AccuKnox SaaS.
Features¶
-
Container Image Scans: Scan Docker images for vulnerabilities.
-
Severity Levels: Specify the severity levels to be scanned.
-
Automatic Results Upload: Upload scan results to AccuKnox SaaS for centralized management and reporting.
-
Exit Code Handling: Specify exit codes as 0 to pass the build and 1 to fail the build having specified vulnerabilities of high, medium, etc.
-
Repository and Branch Information: Include repository and branch information in the scan results for better traceability.
Installation¶
Current Installation Method¶
-
Download the plugin in
.hpi
format from here. -
Navigate to the Jenkins dashboard.
-
Go to Manage Jenkins > Manage Plugins.
-
Click on the Advanced tab.
-
In the Deploy Plugin section, click Choose File and select the downloaded
.hpi
file. -
Click Deploy to install the plugin.
-
Restart Jenkins if required.
Configuration¶
Job Configuration¶
-
Open the configuration page of your Jenkins job.
-
Under the Build section, click on Add build step and select AccuKnox Container Scan.
Parameters¶
The plugin provides the following parameters:
-
Image Name: The name of the Docker image to be scanned.
-
Image Tag: The tag of the Docker image to be scanned (default is "latest").
-
Exit Code: The exit code(default is 0).
-
Tenant ID: The tenant ID for AccuKnox API.
-
AccuKnox Token: The access token for authenticating with AccuKnox.
-
Label: The label for AccuKnox SaaS.
-
Severity: The severity levels to be scanned (default is "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL").
Token Generation from AccuKnox SaaS and Viewing Tenant ID¶
-
Navigate to Tokens within the Settings section in the sidebar.
-
Click on Create Token: After clicking on 'Create Token,' the Tenant ID will be visible.
-
Click on Generate.
Example Configuration¶
Here is an example of how to configure the plugin in your Jenkins job:
-
Add a new build step and select AccuKnox Container Scan.
-
Configure the parameters:
-
Image Name: your-image-name
-
Image Tag: latest
-
Exit Code: 0
-
Tenant ID: your-tenant-id
-
AccuKnox Token: your-access-token
-
Label: your-label
-
Severity: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
-
Running the Scan¶
When you run the Jenkins job, the plugin will:
-
Print the configuration parameters to the Jenkins console output.
-
Validate the provided AccuKnox Token and Tenant ID.
-
Execute the AccuKnox container scan using the specified parameters.
-
Upload the scan results to AccuKnox SaaS.
-
Mark the build as failed if the scan or upload process encounters errors (unless soft fail is enabled).
Sample Console Output¶
accuknox-image-scan running...
AccuKnox Container Scan executed. Output is suppressed.
Pushing results to AccuKnox SaaS...
Scan results uploaded successfully.
Build completed successfully.
Finished: SUCCESS
Viewing Findings¶
To view the findings in AccuKnox SaaS, navigate to Issues -> Findings and select 'Container Findings'.
Troubleshooting¶
Missing AccuKnox Token or Tenant ID¶
-
Ensure both fields are filled in the job configuration.
-
Verify the accuracy of the provided credentials.
Scan Failure¶
-
Check the Jenkins console output for detailed error messages.
-
Ensure the specified image name and tag exist and are accessible.
Upload Failure¶
-
Verify network connectivity to the AccuKnox SaaS endpoint.
-
Check the accuracy of the Tenant ID and AccuKnox Token.