Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/khulnasoft/harbor-scanner-tunnel

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/khulnasoft/harbor-scanner-tunnel

  • v0.0.0-20240404204119-98d65bbf0898
  • Source
  • Go
  • Socket score

Version published
Created
Source

GitHub Release GitHub Build Actions Go Report Card License Docker Pulls / Khulnasoft Docker Pulls / Harbor

Harbor Scanner Adapter for Tunnel

The Harbor Scanner Adapter for Tunnel is a service that translates the Harbor scanning API into Tunnel commands and allows Harbor to use Tunnel for providing vulnerability reports on images stored in Harbor registry as part of its vulnerability scan feature.

Harbor Scanner Adapter for Tunnel is the default static vulnerability scanner in Harbor >= 2.2.

Vulnerabilities

For compliance with core components Harbor builds the adapter service binaries into Docker images based on Photos OS (goharbor/tunnel-adapter-photon), whereas in this repository we build Docker images based on Alpine (khulnasoft/harbor-scanner-tunnel). There is no difference in functionality though.

TOC

Version Matrix

The following matrix indicates the version of Tunnel and Tunnel adapter installed in each Harbor release.

HarborTunnel AdapterTunnel
-v0.30.23[tunnel v0.50.1]
-v0.30.22[tunnel v0.49.1]
-v0.30.21[tunnel v0.48.3]
-v0.30.20tunnel v0.48.1
-v0.30.19tunnel v0.47.0
-v0.30.18tunnel v0.46.1
-v0.30.17tunnel v0.46.0
-v0.30.16tunnel v0.45.0
-v0.30.15tunnel v0.44.0
-v0.30.14tunnel v0.43.0
-v0.30.13tunnel v0.43.0
-v0.30.12tunnel v0.42.0
-v0.30.11tunnel v0.40.0
-v0.30.10tunnel v0.39.0
-v0.30.9tunnel v0.38.2
-v0.30.8tunnel v0.38.2
-v0.30.7tunnel v0.37.2
-v0.30.6tunnel v0.35.0
-v0.30.5tunnel v0.35.0
-v0.30.4tunnel v0.35.0
-v0.30.3tunnel v0.35.0
-v0.30.2tunnel v0.32.1
-v0.30.0tunnel v0.29.2
-v0.29.0tunnel v0.28.1
harbor v2.5.1v0.28.0tunnel v0.26.0
-v0.27.0tunnel v0.25.0
harbor v2.5.0v0.26.0tunnel v0.24.2
-v0.25.0tunnel v0.22.0
harbor v2.4.1v0.24.0tunnel v0.20.1
harbor v2.4.0v0.24.0tunnel v0.20.1
-v0.23.0tunnel v0.20.0
-v0.22.0tunnel v0.19.2
-v0.21.0tunnel v0.19.2
-v0.20.0tunnel v0.18.3
harbor v2.3.3v0.19.0tunnel v0.17.2
harbor v2.3.0v0.19.0tunnel v0.17.2
harbor v2.2.3v0.18.0tunnel v0.16.0
harbor v2.2.0v0.18.0tunnel v0.16.0
harbor v2.1.6v0.14.1tunnel v0.9.2
harbor v2.1.0v0.14.1tunnel v0.9.2

Deployment

Harbor >= 2.0 on Kubernetes

In Harbor >= 2.0 Tunnel can be configured as the default vulnerability scanner, therefore you can install it with the official Harbor Helm chart, where HARBOR_CHART_VERSION >= 1.4:

helm repo add harbor https://helm.goharbor.io
helm install harbor harbor/harbor \
  --create-namespace \
  --namespace harbor

The adapter service is automatically registered under the Interrogation Service in the Harbor interface and designated as the default scanner.

Harbor 1.10 on Kubernetes

  1. Install the harbor-scanner-tunnel chart:

    helm repo add khulnasoft https://khulnasoft.github.io/helm-charts
    
    helm install harbor-scanner-tunnel khulnasoft/harbor-scanner-tunnel \
      --namespace harbor --create-namespace
    
  2. Configure the scanner adapter in the Harbor interface.

    1. Navigate to Interrogation Services and click + NEW SCANNER. Interrogation Services
    2. Enter http://harbor-scanner-tunnel.harbor:8080 as the Endpoint URL and click TEST CONNECTION. Add scanner
    3. If everything is fine click ADD to save the configuration.
  3. Select the Tunnel scanner and set it as default by clicking SET AS DEFAULT. Set Tunnel as default scanner Make sure the Default label is displayed next to the Tunnel scanner's name.

Configuration

Configuration of the adapter is done via environment variables at startup.

NameDefaultDescription
SCANNER_LOG_LEVELinfoThe log level of trace, debug, info, warn, warning, error, fatal or panic. The standard logger logs entries with that level or anything above it.
SCANNER_API_SERVER_ADDR:8080Binding address for the API server
SCANNER_API_SERVER_TLS_CERTIFICATEN/AThe absolute path to the x509 certificate file
SCANNER_API_SERVER_TLS_KEYN/AThe absolute path to the x509 private key file
SCANNER_API_SERVER_CLIENT_CASN/AA list of absolute paths to x509 root certificate authorities that the api use if required to verify a client certificate
SCANNER_API_SERVER_READ_TIMEOUT15sThe maximum duration for reading the entire request, including the body
SCANNER_API_SERVER_WRITE_TIMEOUT15sThe maximum duration before timing out writes of the response
SCANNER_API_SERVER_IDLE_TIMEOUT60sThe maximum amount of time to wait for the next request when keep-alives are enabled
SCANNER_API_SERVER_METRICS_ENABLEDtrueWhether to enable metrics
SCANNER_TUNNEL_CACHE_DIR/home/scanner/.cache/tunnelTunnel cache directory
SCANNER_TUNNEL_REPORTS_DIR/home/scanner/.cache/reportsTunnel reports directory
SCANNER_TUNNEL_DEBUG_MODEfalseThe flag to enable or disable Tunnel debug mode
SCANNER_TUNNEL_VULN_TYPEos,libraryComma-separated list of vulnerability types. Possible values are os and library.
SCANNER_TUNNEL_SECURITY_CHECKSvuln,config,secretcomma-separated list of what security issues to detect. Possible values are vuln, config and secret. Defaults to vuln.
SCANNER_TUNNEL_SEVERITYUNKNOWN,LOW,MEDIUM,HIGH,CRITICALComma-separated list of vulnerabilities severities to be displayed
SCANNER_TUNNEL_IGNORE_UNFIXEDfalseThe flag to display only fixed vulnerabilities
SCANNER_TUNNEL_IGNORE_POLICY``The path for the Tunnel ignore policy OPA Rego file
SCANNER_TUNNEL_SKIP_UPDATEfalseThe flag to disable Tunnel DB downloads.
SCANNER_TUNNEL_SKIP_JAVA_DB_UPDATEfalseThe flag to disable [Tunnel JAVA DB] downloads.
SCANNER_TUNNEL_OFFLINE_SCANfalseThe flag to disable external API requests to identify dependencies.
SCANNER_TUNNEL_GITHUB_TOKENN/AThe GitHub access token to download Tunnel DB (see GitHub rate limiting)
SCANNER_TUNNEL_INSECUREfalseThe flag to skip verifying registry certificate
SCANNER_TUNNEL_TIMEOUT5m0sThe duration to wait for scan completion
SCANNER_STORE_REDIS_NAMESPACEharbor.scanner.tunnel:storeThe namespace for keys in the Redis store
SCANNER_STORE_REDIS_SCAN_JOB_TTL1hThe time to live for persisting scan jobs and associated scan reports
SCANNER_JOB_QUEUE_REDIS_NAMESPACEharbor.scanner.tunnel:job-queueThe namespace for keys in the scan jobs queue backed by Redis
SCANNER_JOB_QUEUE_WORKER_CONCURRENCY1The number of workers to spin-up for the scan jobs queue
SCANNER_REDIS_URLredis://harbor-harbor-redis:6379The 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_POOL_MAX_ACTIVE5The max number of connections allocated by the Redis connection pool
SCANNER_REDIS_POOL_MAX_IDLE5The max number of idle connections in the Redis connection pool
SCANNER_REDIS_POOL_IDLE_TIMEOUT5mThe duration after which idle connections to the Redis server are closed. If the value is zero, then idle connections are not closed.
SCANNER_REDIS_POOL_CONNECTION_TIMEOUT1sThe timeout for connecting to the Redis server
SCANNER_REDIS_POOL_READ_TIMEOUT1sThe timeout for reading a single Redis command reply
SCANNER_REDIS_POOL_WRITE_TIMEOUT1sThe timeout for writing a single Redis command.
HTTP_PROXYN/AThe URL of the HTTP proxy server
HTTPS_PROXYN/AThe URL of the HTTPS proxy server
NO_PROXYN/AThe URLs that the proxy settings do not apply to

Documentation

  • Architecture - architectural decisions behind designing harbor-scanner-tunnel.
  • Releases - how to release a new version of harbor-scanner-tunnel.

Troubleshooting

Error: database error: --skip-db-update cannot be specified on the first run

If you set the value of the SCANNER_TUNNEL_SKIP_UPDATE to true, make sure that you download the Tunnel DB and mount it in the /home/scanner/.cache/tunnel/db/tunnel.db path.

Error: failed to list releases: Get https://api.github.com/repos/khulnasoft/tunnel-db/releases: dial tcp: lookup api.github.com on 127.0.0.11:53: read udp 127.0.0.1:39070->127.0.0.11:53: i/o timeout

Most likely it's a Docker DNS server or network firewall configuration issue. Tunnel requires internet connection to periodically download vulnerability database from GitHub to show up-to-date risks.

Try adding a DNS server to docker-compose.yml created by Harbor installer.

version: 2
services:
  tunnel-adapter:
    # NOTE Adjust IPs to your environment.
    dns:
      - 8.8.8.8
      - 192.168.1.1

Alternatively, configure Docker daemon to use the same DNS server as host operating system. See DNS services section in the Docker container networking documentation for more details.

Error: failed to list releases: GET https://api.github.com/repos/khulnasoft/tunnel-db/releases: 403 API rate limit exceeded

Tunnel DB downloads from GitHub are subject to rate limiting. Make sure that the Tunnel DB is mounted and cached in the /home/scanner/.cache/tunnel/db/tunnel.db path. If, for any reason, it's not enough you can set the value of the SCANNER_TUNNEL_GITHUB_TOKEN environment variable (authenticated requests get a higher rate limit).

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.


Harbor Scanner Adapter for Tunnel is an Khulnasoft Security open source project.
Learn about our open source work and portfolio here.

FAQs

Package last updated on 04 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc