-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FATAL DB error: failed to download vulnerability DB: OCI artifact error: OCI artifact error: OCI repository error: #1877
Comments
Hello @eoraita If trivy is running behind corporate firewall, you have to add the following urls to your allowlist.:
Read more about some of the issues here Regards, Dmitriy |
This issue is stale because it has been labeled with inactivity. |
I have the same error, but in my case I'm using a private oci registry for the trivy-db. The solution offered here to open firewalls to allow ghcr.io doesn't apply. Also worth noting that if I use a custom trivy image that includes my internal CA, everything works fine; however I would prefer to use the public aquasec/trivy: images. I should be able to pass something like the --insecure option when downloading the DB as well as images. |
@flngen could you take a look at #2373? |
I have seen that discussion. My local registry does not require authentication. As I mentioned above, there probably isn't an option to bypass ssl verification when downloading the DB. Granted I haven't taken the time to read the code. Pure guess. |
@flngen do you use the latest trivy with |
yes |
I tried using the public trivy docker image and mounted the node certs path to the docker container on /etc/ssl/certs, and was able to download the db from my private repo. So that's probably an acceptable workaround, provided your docker nodes contain your local CA certs/chain. |
Hello @flngen We added insecure skip to download Trivy-db earlier: #2140 To investigate your problem, can you send me:
Regards, Dmitriy |
@DmitriyLewen trivy 0.31.2 is already installed
2022-08-18T00:33:59.929+0100 DEBUG Severities: ["HIGH" "CRITICAL" "MEDIUM"]
2022-08-18T00:33:59.970+0100 DEBUG cache dir: /Users/cathex-matt/Library/Caches/trivy
2022-08-18T00:33:59.970+0100 DEBUG There is no valid metadata file: unable to open a file: open /Users/cathex-matt/Library/Caches/trivy/db/metadata.json: no such file or directory
2022-08-18T00:33:59.970+0100 INFO Need to update DB
2022-08-18T00:33:59.970+0100 INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-08-18T00:33:59.970+0100 INFO Downloading DB...
2022-08-18T00:33:59.970+0100 DEBUG no metadata file
2022-08-18T00:34:00.330+0100 FATAL init error:
github.com/aquasecurity/trivy/pkg/commands/artifact.Run
/home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:362
- DB error:
github.com/aquasecurity/trivy/pkg/commands/artifact.NewRunner
/home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:121
- failed to download vulnerability DB:
github.com/aquasecurity/trivy/pkg/commands/operation.DownloadDB
/home/runner/work/trivy/trivy/pkg/commands/operation/operation.go:117
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).Download
/home/runner/work/trivy/trivy/pkg/db/db.go:154
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).initOCIArtifact
/home/runner/work/trivy/trivy/pkg/db/db.go:194
- OCI repository error:
github.com/aquasecurity/trivy/pkg/oci.NewArtifact
/home/runner/work/trivy/trivy/pkg/oci/artifact.go:69
- GET https://ghcr.io/token?scope=repository%3Aaquasecurity%2Ftrivy-db%3Apull&service=ghcr.io: DENIED: denied
task: Failed to run task "docker:security:trivy": exit status 1 |
hm... it looks like a problem with authorization. |
Thanks! It worked simply with authenticating to ghcr. I wasn't aware it was a requirement, was wrongly assuming it was all public. The problem occured when bumping from trivy 0.22.0 to 0.31.2. |
I think you had an expired token in local. You re-logged in ghcr.io and the expired token was overwritten. I suppose |
I just installed trivy k8s --report summary cluster --debug and got this error 2022-11-23T22:52:05.060-0500 DEBUG Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2022-11-23T22:52:17.322-0500 DEBUG cache dir: /home/iseiryu/.cache/trivy
2022-11-23T22:52:17.323-0500 DEBUG There is no valid metadata file: unable to open a file: open /home/iseiryu/.cache/trivy/db/metadata.json: no such file or directory
2022-11-23T22:52:17.323-0500 INFO Need to update DB
2022-11-23T22:52:17.323-0500 INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-23T22:52:17.323-0500 INFO Downloading DB...
2022-11-23T22:52:17.323-0500 DEBUG no metadata file
2022-11-23T22:52:49.935-0500 FATAL init error:
github.com/aquasecurity/trivy/pkg/k8s/commands.(*runner).run
/home/runner/work/trivy/trivy/pkg/k8s/commands/run.go:74
- DB error:
github.com/aquasecurity/trivy/pkg/commands/artifact.NewRunner
/home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:121
- failed to download vulnerability DB:
github.com/aquasecurity/trivy/pkg/commands/operation.DownloadDB
/home/runner/work/trivy/trivy/pkg/commands/operation/operation.go:117
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).Download
/home/runner/work/trivy/trivy/pkg/db/db.go:154
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).initOCIArtifact
/home/runner/work/trivy/trivy/pkg/db/db.go:194
- OCI repository error:
github.com/aquasecurity/trivy/pkg/oci.NewArtifact
/home/runner/work/trivy/trivy/pkg/oci/artifact.go:69
- Get "https://ghcr.io/v2/": dial tcp: lookup ghcr.io: i/o timeout |
Not like this trivy k8s --report summary cluster --debug --insecure
2022-11-28T16:39:57.865-0500 DEBUG Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2022-11-28T16:40:09.890-0500 DEBUG cache dir: /home/iseiryu/.cache/trivy
2022-11-28T16:40:09.892-0500 DEBUG There is no valid metadata file: unable to open a file: open /home/iseiryu/.cache/trivy/db/metadata.json: no such file or directory
2022-11-28T16:40:09.892-0500 INFO Need to update DB
2022-11-28T16:40:09.892-0500 INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-28T16:40:09.892-0500 INFO Downloading DB...
2022-11-28T16:40:09.892-0500 DEBUG no metadata file
35.34 MiB / 35.34 MiB [------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 4.34 MiB p/s 8.3s
2022-11-28T16:40:33.917-0500 DEBUG Updating database metadata...
2022-11-28T16:40:33.917-0500 DEBUG DB Schema: 2, UpdatedAt: 2022-11-28 18:07:09.629105676 +0000 UTC, NextUpdate: 2022-11-29 00:07:09.629105376 +0000 UTC, DownloadedAt: 2022-11-28 21:40:33.9176202 +0000 UTC
16 / 198 [------------->_______________________________________________________________________________________________________________________________________________________] 8.08% 0 p/s
2022-11-28T16:45:11.955-0500 WARN Increase --timeout value
2022-11-28T16:45:11.958-0500 FATAL k8s scan error:
github.com/aquasecurity/trivy/pkg/k8s/commands.(*runner).run
/home/runner/work/trivy/trivy/pkg/k8s/commands/run.go:101
- scanning misconfigurations error:
github.com/aquasecurity/trivy/pkg/k8s/scanner.(*Scanner).Scan
/home/runner/work/trivy/trivy/pkg/k8s/scanner/scanner.go:73
- scan error:
github.com/aquasecurity/trivy/pkg/commands/artifact.(*runner).scanArtifact
/home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:230
- scan failed:
github.com/aquasecurity/trivy/pkg/commands/artifact.scan
/home/runner/work/trivy/trivy/pkg/commands/artifact/run.go:555
- failed analysis:
github.com/aquasecurity/trivy/pkg/scanner.Scanner.ScanArtifact
/home/runner/work/trivy/trivy/pkg/scanner/scan.go:127
- failed to call hooks:
github.com/aquasecurity/trivy/pkg/fanal/artifact/local.Artifact.Inspect
/home/runner/work/trivy/trivy/pkg/fanal/artifact/local/fs.go:126
- post handler error:
github.com/aquasecurity/trivy/pkg/fanal/handler.Manager.PostHandle
/home/runner/work/trivy/trivy/pkg/fanal/handler/handler.go:75
- scan config error:
github.com/aquasecurity/trivy/pkg/fanal/handler/misconf.misconfPostHandler.Handle
/home/runner/work/trivy/trivy/pkg/fanal/handler/misconf/misconf.go:293
- context deadline exceeded But it worked like this trivy k8s --report summary cluster --debug --insecure --timeout 60m0s
2022-11-28T16:46:45.011-0500 DEBUG Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2022-11-28T16:46:57.666-0500 DEBUG cache dir: /home/iseiryu/.cache/trivy
2022-11-28T16:46:57.667-0500 DEBUG DB update was skipped because the local DB is the latest
2022-11-28T16:46:57.667-0500 DEBUG DB Schema: 2, UpdatedAt: 2022-11-28 18:07:09.629105676 +0000 UTC, NextUpdate: 2022-11-29 00:07:09.629105376 +0000 UTC, DownloadedAt: 2022-11-28 21:40:33.9176202 +0000 UTC
198 / 198 [------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 1 p/s
2022-11-28T16:52:10.072-0500 ERROR Error during vulnerabilities scan: scan error: unable to initialize a scanner: unable to initialize a docker scanner: 4 errors occurred:
* <redacted>
* unable to initialize Podman client: no podman socket found: stat /mnt/wslg/runtime-dir/podman/podman.sock: no such file or directory
* containerd socket not found: /run/containerd/containerd.sock
* <redacted> What is that DB for? Cannot the process be simplified? |
A subsequent run causes it to download the DB again...why? |
We upgraded to trviy version 0.24.4 and when running the trivy Scan we are getting the following error:
FATAL DB error: failed to download vulnerability DB: OCI artifact error: OCI artifact error: OCI repository error: Get "https://ghcr.io/v2/": x509: certificate signed by unknown authority
We where using release 0.21.3 prior and had now issues and then yesterday afternoon we started getting 👍
FATAL DB error: failed to download vulnerability DB: failed to download vulnerability DB: failed to list releases: Get "https://api.github.com/repos/aquasecurity/trivy-db/releases": x509: certificate signed by unknown authority
The text was updated successfully, but these errors were encountered: