
NVD, Red Hat, Debian 등에서 보안 권고를 집계하여 Trivy 취약점 데이터베이스를 구축하고 관리합니다. 데이터베이스 생성, 압축, 배포를 위한 CLI 도구 및 라이브러리입니다.
trivy-db CLI 도구는 취약점 DB를 빌드합니다. GitHub Actions 워크플로우는 trivy-db를 사용하여 취약점 DB의 새 버전을 주기적으로 빌드하고 GitHub Container Registry에 업로드합니다(아래 취약점 데이터베이스 다운로드 참조).
NAME:
trivy-db - Trivy DB builder
USAGE:
main [global options] command [command options] image_name
VERSION:
0.0.1
COMMANDS:
build build a database file
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
로컬에서 trivy-db를 빌드하려면 Makefile에서 다음 명령 순서를 사용할 수 있습니다:
make db-fetch-langs db-fetch-vuln-list # To download all advisories and other required files (`./cache` dir by default)
make build # Build `trivy-db` binary
make db-build # Build database (`./out` dir by default)
make db-compact # Compact database (`./assets` dir by default)
make db-compress # Compress database into `db.tar.gz` file
trivy-db 이미지를 빌드하고 레지스트리에 푸시하려면 Oras CLI를 사용해야 합니다. 예를 들어 ghcr의 경우:
./oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json \
"ghcr.io/aquasecurity/trivy-db:2" \
db.tar.gz:application/vnd.aquasec.trivy.db.layer.v1.tar+gzip
Trivy DB는 6시간마다 빌드됩니다. 기본적으로 메타데이터 파일에 지정된 업데이트 주기는 24시간입니다. Trivy DB를 더 자주 업데이트해야 하는 경우 새 Trivy DB를 수동으로 업로드할 수 있습니다.
Trivy DB v1은 2023년 2월에 지원이 종료되었습니다. Trivy를 v0.23.0 이상으로 업그레이드하세요.
Trivy DB v1 사용 중단에 대한 자세한 내용은 이 토론을 참조하세요.
Trivy DB v2는 GHCR에서 호스팅됩니다.
GitHub는 기본적으로 docker pull 명령을 표시하지만, 컨테이너 이미지가 아니므로 docker pull을 사용하여 다운로드할 수 없다는 점에 유의하세요.
Trivy:
TRIVY_TEMP_DIR=$(mktemp -d)
trivy --cache-dir $TRIVY_TEMP_DIR image --download-db-only
tar -cf ./db.tar.gz -C $TRIVY_TEMP_DIR/db metadata.json trivy.db
rm -rf $TRIVY_TEMP_DIR
oras >= v0.13.0:
$ oras pull ghcr.io/aquasecurity/trivy-db:2
oras < v0.13.0:
$ oras pull -a ghcr.io/aquasecurity/trivy-db:2
이 데이터베이스는 Air-Gapped 환경에서 사용할 수 있습니다.