Configure pipeline to use STO images from private registry
Store your scanner images in a private registry. Useful for air-gapped environments.
Harness maintains its own set of scan images for STO-supported scanners. By default, a Harness pipeline pulls scan images from the Harness DockerHub.
This topic describes how to override the default image pull behavior and use your own private registry instead of pulling directly from the public Harness DockerHub. You can download the scan images you need, perform your own security checks on the images, upload them to a private registry, and then set up your STO steps to download images from your private registry.
To do this, you need to:
Create STO scanner images with your own SSL certificates (optional)
Harness STO supports three workflows for running scans with custom certificates.
In this workflow, you set up your STO scan images and pipelines to run scans as non-root and establish trust for your own proxies using custom certificates. This workflow supports any STO-compatible scanner that can run natively without root access. This workflow also supports build environments that use a self-signed proxy server between the Harness Delegate and Harness Manager.
Save a copy of the following Dockerfile into a folder along with the certificates you want to copy to the image.
Update the
FROM,COPY, andUSERcommands as described in the Dockerfile comments.Build the new image and then publish it to your private registry.
Update the scan step in your pipeline as follows:
Update the Image setting to point to the new image in your registry.
If you specified a
USERin your Dockerfile, set the Run as User (runAsUser) setting to the user you specified in your Dockerfile.
Create a connector to your private registry
You need a Docker connector that points to your private container registry. For more information, go to Docker Connector Settings Reference.
Configure your pipeline to use images from your registry
Download the scan images you need from the Harness DockerHub, test and validate the images, and store them in your private registry.
Do not change the image names in your private registry. The image names must match the names specified by Harness; this includes the
harness/prefix.By default, STO will automatically use the latest image from the public Harness registry, you might want to specify the images to use in your pipelines. This ensures that your pipelines use specific image versions. You must update this specification when you want to adopt a new version of an image.
Set up your pipeline to use the images from your private registry. This can be done at both the stage level and the step level for scanner steps(Blackduck, Semgrep etc.,) and Custom Scan steps. Below are the detailed steps and configurations required for each scenario.
Override security test images for scanner steps:
Override security test images for scanner steps
Stage level override
If you want to use your private images for all steps within a stage, follow these steps:
Navigate to the Infrastructure section in your stage.
Go to the Advanced section.
Configure your private registry under the Override Image Connector section.
Step level override
If you want to override the image for a specific step within a stage, follow these steps:
Navigate to the specific STO step in the pipeline.
Go to the Additional Configuration section in the step configuration.
Set your private registry and tag under Override Security Test Image section. By default, the step will look for the
latesttag if no tag is provided.
Override security test images for Custom Scan steps
The Custom Scan step uses the sto-plugin image to launch the appropriate scanner image(internally called as runner) based on the step configuration. You have the option to either override both the sto-plugin image and the scanner image, or simply override the scanner image while keeping the sto-plugin image unchanged.
To override the scanner image in a Custom Scan step, add the following settings in the Additional Configuration section of the Custom Scan step:
runner_registry_domain: The URL of the registry where the images are stored. The supported format is<_domain_>/<_directory_>(such as, public.ecr.aws/r7c1u4s0/harness). Do not include the scheme (such as http:// or https://).runner_registry_image_prefix: set this toharness(Do not change this setting)runner_registry_username: The username of your registryrunner_registry_token: The token to access your registryrunner_tag: The image tag
If you want to override the sto-plugin image for the Custom Scan steps, you can configure your private registry either at the stage level or step level, based on your requirements. Refer to the stage level or step level sections above for instructions, as they are the same.
Last updated
Was this helpful?