aquasecurity / trivy

Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
https://aquasecurity.github.io/trivy
Apache License 2.0
23.55k stars 2.32k forks source link

support scanning on container image in customer private repository #821

Closed shaolinyang2009 closed 1 year ago

shaolinyang2009 commented 3 years ago

support scanning on container image in popular public repository is good feature! Would you please extend this to support private repository as most users like us are using private repository?

E.g we are using Nexus server as our private repository, server link llke:

https://otaaplvlp05.,mycomparny.com:grpc_server.latest

thanks! shaolin

github-actions[bot] commented 3 years ago

This issue is stale because it has been labeled with inactivity.

danielefranceschi commented 3 years ago

We had the same requirement, solved using OCI layout scanning:

skopeo copy --src-creds $NEXUS_USER:$NEXUS_PASSWORD docker://$IMGWITHREPO oci://tmp/xxx
trivy image --input /tmp/xxx
nemethloci commented 3 years ago

The below seems to work as well. Of course it assumes docker being installed and the user having the rights to pull into the local registry:

docker image pull <private_registry>/<repo>:<image_tag>
trivy image <private_registry>/<repo>:<image_tag>
docker rmi <private_registry>/<repo>:<image_tag>
jleonard-r7 commented 1 year ago

Any plans to support this directly from trivy?

knqyf263 commented 1 year ago

Trivy should work with private registries. You need docker login <private_registry> or TRIVY_USERNAME and TRIVY_PASSWORD. https://aquasecurity.github.io/trivy/v0.36/docs/advanced/private-registries/ https://aquasecurity.github.io/trivy/v0.36/docs/advanced/private-registries/self/

knqyf263 commented 1 year ago

The latest doc https://aquasecurity.github.io/trivy/v0.41/docs/advanced/private-registries/