trivy icon indicating copy to clipboard operation
trivy copied to clipboard

feat(helm): add sslCertDir parameter

Open keliansb opened this issue 6 months ago • 5 comments

Description

Add trivy.sslCertDir parameter to Helm chart to mount a host path containing CA certificates into the container (for example /etc/ssl/certs).

The same behavior is already available in the trivy-operator Helm chart.

This PR fixes the following error when using a vulnerability DB hosted on a private registry with a certificate signed by a custom CA :

2025-10-22T09:25:42Z    INFO    Adding schema version to the DB repository for backward compatibility    repository="registry.example.com/proxy.ghcr.io/aquasecurity/trivy-db:2"
2025-10-22T09:25:42Z    INFO    Redis scan cache    url="redis://trivy-redis:6379"
2025-10-22T09:25:42Z    INFO    [vulndb] Need to update DB
2025-10-22T09:25:42Z    INFO    [vulndb] Downloading vulnerability DB...
2025-10-22T09:25:42Z    INFO    [vulndb] Downloading artifact...    repo="registry.example.com/proxy.ghcr.io/aquasecurity/trivy-db:2"
2025-10-22T09:25:42Z    FATAL    Fatal error    failed to download vulnerability DB: OCI artifact error: failed to download vulnerability DB: failed to download artifact from registry.example.com/proxy.ghcr.io/aquasecurity/trivy-db:2: OCI repository error: 2 errors occurred:
    * Get "https://registry.example.com/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority
    * Get "https://registry.example.com/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority

Checklist

  • [x] I've read the guidelines for contributing to this repository.
  • [x] I've followed the conventions in the PR title.
  • [ ] I've added tests that prove my fix is effective or that my feature works.
  • [ ] I've updated the documentation with the relevant information (if needed).
  • [ ] I've added usage information (if the PR introduces new options)
  • [ ] I've included a "before" and "after" example to the description (if the PR is a user interface change).

keliansb avatar Oct 22 '25 09:10 keliansb

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 22 '25 09:10 CLAassistant

@keliansb thanks for your contribution! I left some notes, WDYT?

afdesk avatar Dec 02 '25 06:12 afdesk

@keliansb thanks for your contribution! I left some notes, WDYT?

@afdesk I did the same configuration as the one already available in the trivy-operator Helm chart.
Should both charts be aligned? If not, I can update my PR based on your comments.

keliansb avatar Dec 04 '25 13:12 keliansb

@keliansb thanks for your contribution! I left some notes, WDYT?

@afdesk I did the same configuration as the one already available in the trivy-operator Helm chart. Should both charts be aligned? If not, I can update my PR based on your comments.

thanks for your answer!

actually, a part of my comments is resolved in trivy-operator: the docs and configmap https://github.com/aquasecurity/trivy-operator/blob/main/deploy/helm/templates/configmaps/trivy.yaml#L31

about other part (sslCertHostPath/sslCertMountPath and hostPath.type) - it would be great to here an opinion, and may be we should change it in the both repos.

/cc @simar7

afdesk avatar Dec 08 '25 10:12 afdesk

@keliansb thanks for your contribution! I left some notes, WDYT?

@afdesk I did the same configuration as the one already available in the trivy-operator Helm chart. Should both charts be aligned? If not, I can update my PR based on your comments.

thanks for your answer!

actually, a part of my comments is resolved in trivy-operator: the docs and configmap https://github.com/aquasecurity/trivy-operator/blob/main/deploy/helm/templates/configmaps/trivy.yaml#L31

about other part (sslCertHostPath/sslCertMountPath and hostPath.type) - it would be great to here an opinion, and may be we should change it in the both repos.

/cc @simar7

I agree with @afdesk - the other option would be to refactor them so the common parts can be shared but that can be done in a separate PR.

simar7 avatar Dec 08 '25 23:12 simar7