Skip to content
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

Allow InitContainer to pull vulnerability-db from private registry #2221

Closed
crtvmn opened this issue Aug 9, 2024 · 5 comments
Closed

Allow InitContainer to pull vulnerability-db from private registry #2221

crtvmn opened this issue Aug 9, 2024 · 5 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@crtvmn
Copy link

crtvmn commented Aug 9, 2024

Hello,

I'm trying to deploy the Trivy Operator in standalone mode with the provided Helm chart in an offline environment with a private registry. Credentials are required to access this registry.

Unfortunately, it is not possible to forward or add env variables (TRIVY_USER and TRIVY_PASSWORD) to allow the Trivy init-container to pull the vulnerability database from my private registry.

Moreover the dbRepositoryPassword and dbRepositoryUsername seem useless.

dbRepositoryUsername: ~
# -- The password for dbRepository authentication
#
dbRepositoryPassword: ~

Can you confirm that this use case is not possible for the moment? I found this discussion #1341 but no answer and no link to the related issue. Thanks for your help!

Best regards

@crtvmn crtvmn added the kind/bug Categorizes issue or PR as related to a bug. label Aug 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

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

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed. label Oct 9, 2024
@Heap0017
Copy link

Heap0017 commented Oct 9, 2024

I'm having the same issue. In my opinion it should be possible to provide the credentials for pulling trivy-db and trivy-java-db just like we can do it for trivy-checks.

@crtvmn This is the issue mentioned in the discussion: #1342

@Heap0017
Copy link

Heap0017 commented Oct 9, 2024

@crtvmn I just found out that you can in fact use a secret for setting dbRepositoryUsername and dbRepositoryPassword. It just isn't mentioned in the README. #2282

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed. label Oct 10, 2024
@simar7 simar7 added this to the v0.24.0 milestone Dec 4, 2024
@afdesk
Copy link
Contributor

afdesk commented Jan 28, 2025

@crtvmn @Heap0017 thanks for the comments and so sorry for long response

I checked this case with my private repo on Github with the latest version of Trivy-operator.
and it works as expected

$ kubectl get vulnerabilityreports --all-namespaces -o wide
NAMESPACE            NAME                                                       REPOSITORY                       TAG                  SCANNER   AGE     CRITICAL   HIGH   MEDIUM   LOW   UNKNOWN
kube-system          daemonset-kube-proxy-kube-proxy                            kube-proxy                       v1.30.0              Trivy     72s     3          8      22       16    0
kube-system          pod-7d98c5bddf                                             kube-controller-manager          v1.30.0              Trivy     59s     3          6      10       0     0
kube-system          pod-etcd-cve-kind-control-plane-etcd                       etcd                             3.5.12-0             Trivy     50s     9          14     53       4     1
kube-system          pod-kube-scheduler-cve-kind-control-plane-kube-scheduler   kube-scheduler                   v1.30.0              Trivy     89s     3          6      8        0     0
kube-system          replicaset-coredns-7db6d8ff4d-coredns                      coredns/coredns                  v1.11.1              Trivy     2m10s   2          8      20       1     1
local-path-storage   replicaset-dcbb8bf7b                                       kindest/local-path-provisioner   v20240202-8f1494ea   Trivy     80s     2          7      31       11    1

my settings:

  dbRegistry: "ghcr.io"
  dbRepository: "afdesk/trivy-db-private"

  # -- The username for dbRepository authentication
  #
  dbRepositoryUsername: afdesk	

  # -- The password for dbRepository authentication
  #
  dbRepositoryPassword: ghp_TOKEN

@afdesk
Copy link
Contributor

afdesk commented Jan 28, 2025

it should work as expected.
if the issue is arrised, please feel free to reopen this one.

@afdesk afdesk closed this as completed Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants