Enables scanning of docker builds in Jenkins for OS package vulnerabilities.
-
Docker must be installed on the same machine Jenkins is installed. If your job is configured to use a node other than Master node, then Docker is required only on the build Jenkins node (slave).
-
The jenkins user must be added to the docker group so it has permission to run Docker:
sudo usermod -aG docker jenkins
- In Jenkins, select Manage Jenkins and then select Manage Plugins from the list. Make sure that the list of available plugins is up to date.
- Select the Available tab, search for Aqua MicroScanner, and select it. Click on Download the Plugin. This will install the plugin.
-
Follow the instructions here to obtain a token to use the microscanner.
-
In Jenkins, select Manage Jenkins, then select Configure System. Enter the token value.
You can use the MicroScanner plugin in the build process in Freestyle and Pipelines jobs. You can configure the job to scan the image during the build process.
In Freestyle jobs add a build step to scan the image with the Aqua MicroScanner, as part of the job configuration.
- In Jenkins, in the Configure page for a job, click Add Build Step.
- Select Aqua MicroScanner.
-
Select the action to be taken when high severity vulnerabilities are found in the build. You can optionally include a shell command.
-
Enter the image name.
In Pipeline jobs, the build step to scan the image with the MicroScanner is included in a pipeline script, as part of the job configuration.
- In Jenkins, in the **Configure **page for a job, scroll to the **Pipeline **section.
- Add the a snippet such as the following to the pipeline script, to include a step to scan the image.
3. Alternatively, you can use the Snippet Generator to create the snippet.
You can see the results of the scan in the Console Output.
You can also see results of the scan as an HTML page. An artifact named "scanout.html" will be created in the project's workspace. In the Jenkins build menu, select Aqua MicroScanner, and then select the job whose results you wish to see.
- If JDK 7 is not installed, install it
sudo apt-get update
sudo apt-get install openjdk-7-jdk
-
Install Maven3 (must be 3)
-
Build
When in the root directory, where pom.xml resides:
mvn package
Note: the first time this command is invoked, many downloads will occur and it will take quite some time.
Copy the target/aqua-docker-scanner.hpi file to $JENKINS/plugins/ where JENKINS is the Jenkins root directory, by default it is /var/lib/jenkins/.
Restart Jenkins:
sudo /etc/init.d/jenkins restart
See https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Releasingtojenkinsci.org. It describes several alternatives; use the following:
- If not already done, create a settings.xml file with your credentials as described
- Execute and accept defaults for prompts :
mvn release:prepare release:perform