harbor-scanner-trivy

by deployment-aqua

Helm chartv0.31.2App 0.31.2

Harbor scanner adapter for Trivy

About this chart

Harbor Scanner Trivy

Trivy as a plug-in vulnerability scanner in the Harbor registry.

TL;DR;

$ helm repo add aqua https://helm.aquasec.com

Without TLS

$ helm install harbor-scanner-trivy aqua/harbor-scanner-trivy \
    --namespace harbor

With TLS

  1. Generate certificate and private key files:
    $ openssl genrsa -out tls.key 2048
    $ openssl req -new -x509 \
        -key tls.key \
        -out tls.crt \
        -days 365 \
        -subj /CN=harbor-scanner-trivy.harbor
    
  2. Install the harbor-scanner-trivy chart:
    $ helm install harbor-scanner-trivy aqua/harbor-scanner-trivy \
        --namespace harbor \
        --set service.port=8443 \
        --set scanner.api.tlsEnabled=true \
        --set scanner.api.tlsCertificate="`cat tls.crt`" \
        --set scanner.api.tlsKey="`cat tls.key`"
    

Introduction

This chart bootstraps a scanner adapter deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.12+
  • Helm 2.11+ or Helm 3+

Installing the Chart

To install the chart with the release name my-release:

$ helm install my-release aqua/harbor-scanner-trivy

The command deploys scanner adapter on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Parameters

The following table lists the configurable parameters of the scanner adapter chart and their default values.

ParameterDescriptionDefault
image.registryImage registrydocker.io
image.repositoryImage nameaquasec/harbor-scanner-trivy
image.tagImage tag{TAG_NAME}
image.pullPolicyImage pull policyIfNotPresent
replicaCountNumber of scanner adapter Pods to run1
scanner.logLevelThe log level of trace, debug, info, warn, warning, error, fatal or panic. The standard logger logs entries with that level or anything above itinfo
scanner.api.tlsEnabledThe flag to enable or disable TLS for HTTPtrue
scanner.api.tlsCertificateThe absolute path to the x509 certificate file
scanner.api.tlsKeyThe absolute path to the x509 private key file
scanner.api.readTimeoutThe maximum duration for reading the entire request, including the body15s
scanner.api.writeTimeoutThe maximum duration before timing out writes of the response15s
scanner.api.idleTimeoutThe maximum amount of time to wait for the next request when keep-alives are enabled60s
scanner.trivy.cacheDirTrivy cache directory/home/scanner/.cache/trivy
scanner.trivy.reportsDirTrivy reports directory/home/scanner/.cache/reports
scanner.trivy.debugModeThe flag to enable or disable Trivy debug modefalse
scanner.trivy.vulnTypeComma-separated list of vulnerability types. Possible values are os and library.os,library
scanner.trivy.ignorepolicyThe OPA rego script used by Trivy to evaluate each vulnerability
scanner.trivy.severityComma-separated list of vulnerabilities severities to be displayedUNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
scanner.trivy.ignoreUnfixedThe flag to display only fixed vulnerabilitiesfalse
scanner.trivy.timeoutThe duration to wait for scan completion5m0s
scanner.trivy.skipUpdateThe flag to enable or disable Trivy DB downloads from GitHubfalse
scanner.trivy.skipJavaDBUpdateThe flag to enable or disable Trivy Java DB downloads from GitHubfalse
scanner.trivy.offlineScanThe flag to disable external API requests to identify dependenciesfalse
scanner.trivy.gitHubTokenThe GitHub access token to download Trivy DB
scanner.trivy.insecureThe flag to skip verifying registry certificatefalse
scanner.store.redisNamespaceThe namespace for keys in the Redis storeharbor.scanner.trivy:store
scanner.store.redisScanJobTTLThe time to live for persisting scan jobs and associated scan reports1h
scanner.jobQueue.redisNamespaceThe namespace for keys in the scan jobs queue backed by Redisharbor.scanner.trivy:job-queue
scanner.jobQueue.workerConcurrencyThe number of workers to spin-up for a jobs queue1
scanner.redis.poolURLThe Redis server URI. The URI supports schemas to connect to a standalone Redis server, i.e. redis://:password@standalone_host:port/db-number and Redis Sentinel deployment, i.e. redis+sentinel://:password@sentinel_host1:port1,sentinel_host2:port2/monitor-name/db-number.
scanner.redis.poolMaxActiveThe max number of connections allocated by the Redis connection pool5
scanner.redis.poolMaxIdleThe max number of idle connections in the Redis connection pool5
scanner.redis.poolIdleTimeoutThe duration after which idle connections to the Redis server are closed

Deploy harbor-scanner-trivy with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has harbor-scanner-trivy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartharbor-scanner-trivy is pinned at v0.31.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply