Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Overview

This article provides instructions on how to integrate Azure with the Unified Agent in order to be able to scan Docker Images.

Prerequisites 

  1. An authorized account to Azure Container Registry
  2. Permissions for image pulling from Azure Container Registry
  3. Docker installed

  • Unified Agent will scan the images on your localhost (after they are pulled from Azure Container Registry).
  • Unified Agent requires downloading a JAR file and a configuration file. You can download them manually or by using the steps described below.

Download Unified Agent & Configuration File

Notice on periodically fetching the Unified Agent

It is advised to use the below commands only once a week to download the latest version of the Unified Agent for performance reasons and not as part of every build. You can do this using a scheduler task, such as cron.

Use the following options to download the latest version of the WhiteSource Unified Agent JAR file and configuration file to your local host.

Windows Using CURL

  1. Download CURL, and add it to your PATH environment variable.
  2. Open a new command prompt
  3. Run the following commands:

    Windows Using CURL
    curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
    ccurl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.config

Windows Using PowerShell

  1. Open a new command prompt
  2. Run the following commands:

    Windows Using PowerShell
    powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar $pwd\wss-unified-agent.jar 
    powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.config $pwd\wss-unified-agent.config 
    
    

    Make sure that Background Intelligent Transfer Service (BITS) is enabled if you want to use PowerShell on Windows

Linux/Unix

Run the following commands from the Linux/Unix bash prompt :

Linux/Unix Using CURL
curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.config

Updating the Configuration File

Update the configuration file (whitesource-fs-agent.config) that you downloaded in step 2 according to your specific requirements.
Enable the relevant lines by removing the '#' symbol at the beginning of the lines. You can find a description about each line and its meaning in the following link.
Example of values for uncommented lines:

ddocker.includes=.*alpine.*
docker.excludes=.*2017.10.01.* .*2017.06.01.*
docker.scanImages=true
docker.pull.enable=true
docker.pull.images=.*.*
docker.pull.tags=.*.*
docker.pull.digest=.*.*
docker.delete.force=false
docker.acr.enable=false
docker.acr.registryIds=XXXXXXXXXXXX
docker.pull.maxImages=10
docker.login.sudo=true

This configuration sets the Unified Agent to scan all the docker repositories named *alpine.* except for the two image tags in the 'exclude' section.
Alternatively, you can leave the docker.excludes parameter commented if you want to scan all your image containers.

Configuration Parameters

Attribute
Type
Description
Required
docker.azure.enable

Boolean

Enables pulling Docker Images from Azure Container registry. 

Note: Verify that the  'docker.scanImages' and 'docker.pull.enable' parameter values are also set to 'true'

Yes
docker.azure.userNameStringUsername for Azure Container registryYes
docker.azure.userPasswordStringPassword for Azure Container registryYes. Not mandatory if you already logged in manually to your Azure account via the Azure Client CLI. 
docker.azure.registryNamesStringDocker repository names in Azure Container registry separated by a spaceYes

docker.azure.authenticationType 

StringAuthentication Type for Azure Container registry. Either “containerRegistry” or "userAccount".Yes. Default is "userAccount" - case insensitive.

docker.azure.registryAuthenticationParameters 

String

Used in case login is by acr "docker.azure.authenticationType =containerRegistry.

Format: “<acr-username>:<acr-password>".

Only if login is by acr "docker.azure.authenticationType =containerRegistry.

Azure command:

$ az login -u <username> -p <password>

Parameters 'docker.scanImages' and 'docker.pull.enable' should be set to true.

Run the Unified Agent:


java -jar whitesource-wss-agent.jar -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c whitesource-wss-agent.config


Scanning Information
The scanner saves your required images and scans all the file system and installed packages.
It scans all the image layers and handles archive files in the layers based on the value in the property 'archiveExtractionDepth'.

The Docker image is saved to the temporary directory defined in your environment and is deleted immediately after the scan.
The scanning results are presented in a new WhiteSource project identified by the name of the image in the following format:  <image id> <repository> <tag>.
The project is created in the WhiteSource product specified in the configuration file or command line.



  • No labels