Host/container scan scripts for Dependency-Track
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Florian Overkamp a06393ce65 update README
2026-10-24 11:25:27 +02:00
defaults-example add new settings 2026-10-24 10:44:48 +02:00
dtrack-scan.service add systemd service 2026-10-24 10:41:24 +02:00
dtrack-scan.sh remove old references to dt-scan 2026-10-24 10:37:06 +02:00
dtrack-scan.timer add systemd service 2026-10-24 10:41:24 +02:00
install.sh install in to systemd 2026-10-24 10:42:36 +02:00
LICENSE Initial commit 2026-10-24 10:22:19 +02:00
README.md update README 2026-10-24 11:25:27 +02:00

dtrack-scan

Host/container scan scripts for OWASP Dependency-Track.

dtrack-scan generates a software bill of materials (SBOM) for a Linux host and for every container running on it, and uploads them to Dependency-Track. Run nightly on all hosts, this gives you an always-current inventory of what runs where, so that when a new vulnerability (or 0-day) is published you can see within minutes which systems need attention.

How it works

Each host becomes a small project tree in Dependency-Track:

web01.example.nl                  collection project (aggregates its children, no BOM of its own)
├── web01.example.nl/host         OS packages and applications on disk
├── web01.example.nl/ctr/nginx    one child per running container, scanned from its image
└── web01.example.nl/ctr/app-php
  • Host and containers are kept separate. The host scan skips container storage (/var/lib/docker, containerd, containers); containers are scanned from the exact image ID they run, so each has its own findings and triage.
  • Tags make cross-host queries easy: type:host, type:container, image:<name> (e.g. find every host running nginx), plus your own via DT_TAGS (e.g. env:prod,exposure:internet).
  • Containers that disappear have their project deactivated, not deleted, so history and triage decisions are kept.
  • Low impact by design: runs at the lowest CPU/I/O priority, limits syft's parallelism, skips per-file hashing, skips network/FUSE mounts and caches image SBOMs by image ID, so an unchanged image is never re-scanned.
  • Self-installing: syft is downloaded from the official release and checksum-verified if it is missing, or if a pinned version differs.

Requirements

  • Linux on amd64 or arm64 (syft publishes no 32-bit ARM builds)
  • bash, curl, jq, sha256sum, tar
  • Root, or membership of the docker group for container scans
  • Outbound HTTPS to github.com for the one-time syft install (or pre-install syft yourself)
  • A Dependency-Track 5.x instance and a service account with BOM_UPLOAD, PROJECT_CREATION_UPLOAD, VIEW_PORTFOLIO and PORTFOLIO_MANAGEMENT

Installation

git clone https://git.flrn.eu/florian/dtrack-scan
cd dtrack-scan
./install.sh

Then copy defaults-example to the environment file used by dtrack-scan.service, fill in at least DT_URL and DT_API_KEY, and enable the timer:

systemctl enable --now dtrack-scan.timer
systemctl start dtrack-scan.service     # first run now
journalctl -u dtrack-scan -f

If Dependency-Track uses a private CA (e.g. Caddy's tls internal), install its root certificate on each host and point DT_CACERT at it.

Configuration

Variable Default Description
DT_URL — (required) Base URL of Dependency-Track, e.g. https://dtrack.example.nl:8443
DT_API_KEY — (required) Service account API key (expires after 30 days by default)
DT_CACERT /usr/local/share/ca-certificates/dtrack-root.crt CA certificate used to verify the server
DT_INSECURE 0 1 skips TLS verification (curl -k). Testing only: the API key is sent unverified
DT_TAGS empty Extra comma-separated tags for this host's projects
DT_EXCLUDES empty Extra paths to skip on the host scan, space separated
DT_SKIP_REMOTE_FS 1 Skip NFS/CIFS/FUSE and similar mounts
DT_LOW_PRIORITY 1 Run at nice 19 and idle I/O class
DT_CACHE_DIR /var/cache/dt-scan Cache for container image SBOMs
SYFT_VERSION empty (latest) Pin a syft version; installed or upgraded to match
SYFT_INSTALL_DIR /usr/local/bin Where syft is installed
SYFT_PARALLELISM 2 syft worker count (syft's own default is CPUs × 4)
SYFT_FILE_METADATA_SELECTION none Disable per-file hashing (not used by Dependency-Track)

Any other SYFT_* variable is passed through to syft as well.

Scheduling

dtrack-scan.timer runs nightly between 02:00 and 05:00 (RandomizedDelaySec), so that hosts sharing a hypervisor, and the Dependency-Track server, aren't all hit at once. dtrack-scan.service caps the scan at CPUQuota=50%; raise it if scans take too long.

Using the results

  • New vulnerability: search the CVE under Vulnerabilities → Affected Projects, or search a component (e.g. php) under Components.
  • Get notified: add an alert for NEW_VULNERABILITY under Administration → Notifications, optionally limited to tags such as exposure:internet.
  • Distro packages: enable Google OSV with the Ubuntu/Debian/Alpine ecosystems under Administration → Vulnerability Sources. Without it, OS packages are only matched through NVD CPEs, which ignores distro backports.
  • Triage: expect findings on fully patched hosts too (tools outside apt, old kernels, unfixed or disputed CVEs). Mark them Not Affected/False Positive once; the analysis carries over to later uploads.

Limitations

  • An SBOM is a snapshot: if the timer stops, Dependency-Track keeps showing the last state. Watch Last BOM Import per project.
  • The same image on many hosts is scanned on each host. That's redundant, but it keeps the "which host is affected" answer direct.
  • Only Docker is supported for containers; Podman/Kubernetes are not scanned.

License

See LICENSE.