nvd-mirror
by tina.junold
Mirrors the CVE data of the NIST National Vulnerability Database and serves it as JSON data feed for OWASP dependency-check, with the ideaplexus/go-nvd-mirror image. A single pod keeps the feed current with incremental syncs.
About this chart
nvd-mirror
Mirrors the CVE data of the NIST National Vulnerability Database and serves it as JSON data feed for OWASP dependency-check, with the ideaplexus/go-nvd-mirror image. A single pod keeps the feed current with incremental syncs.
Homepage: https://gitlab.com/ideaplexus/charts
Maintainers
| Name | Url | |
|---|---|---|
| Tina Junold | [email protected] | https://ideaplexus.com |
Source Code
- https://gitlab.com/ideaplexus/charts/-/tree/main/charts/nvd-mirror
- https://gitlab.com/ideaplexus/go-nvd-mirror
Requirements
Kubernetes: >=1.29.0-0
| Repository | Name | Version |
|---|---|---|
| https://charts.ideaplexus.com | common | 1.1.0 |
Quick start
kubectl create secret generic nvd-mirror --from-literal=apiKey=<your NVD API key>
nvd:
existingSecret: nvd-mirror
ingress:
enabled: true
ingressClassName: traefik
hostname: nvd-mirror.example.org
On its first start the mirror downloads every CVE from the
NVD API and writes the feed
files dependency-check reads: one nvdcve-<year>.json.gz per year, the
nvdcve-modified bucket of the last seven days, a .meta file for each and
cache.properties. Afterwards it fetches only the changes, every
sync.interval. The mirror's README
describes the files and how they differ from the Java mirror.
Point dependency-check at the base URL of the mirror:
dependency-check.sh --nvdDatafeed https://nvd-mirror.example.org/ ...
<!-- Maven plugin -->
<nvdDatafeedUrl>https://nvd-mirror.example.org/</nvdDatafeedUrl>
Inside the cluster the Service serves the same feed on port 80, eg.
http://nvd-mirror.<namespace>.svc/.
NVD API key
With an API key NVD allows 50 requests per 30 seconds, without one 5. The mirror adapts its request delay to that, so the first sync takes about three minutes with a key and about 25 without.
Keep the key out of your values and reference a secret you manage, for example one filled by External Secrets:
nvd:
existingSecret: nvd-mirror
existingSecretApiKeyKey: apiKey
nvd.apiKey also works; the chart then keeps it in a secret of its own and
restarts the pod when it changes. Either way it reaches the pod as a
secretKeyRef, never as a plain value.
Readiness
The HTTP server starts at once and the sync runs in the background. /healthz
answers as long as the server runs and backs the startup and liveness probes;
/readyz only succeeds once a sync has written cache.properties, so a new
installation stays unready until its first full sync has finished. With an
existing volume the pod is ready right away and serves the previous feed while
it catches up.
Without an API key the first sync can outlast the default
progressDeadlineSeconds of ten minutes, and Argo CD or helm --wait then
report the rollout as failed although the pod is fine. Set a key, or wait.
One pod
The mirror takes a lock before every sync. It lives in the pod's own /tmp,
so a second pod would sync into the same files at the same time: the chart
always runs one replica and replaces it with updateStrategy.type: Recreate,
which also lets the new pod attach the ReadWriteOnce volume. For more capacity
put a cache in front of the Service instead.
Storage
| Path | Volume | Holds |
|---|---|---|
/data | the claim of persistence (5Gi), or an emptyDir | the feed, about 220 MB and growing |
/tmp | an emptyDir limited to workDir.sizeLimit (4Gi) | the sync lock and, during a full sync, the CVEs buffered per year, about 2 GB |
Without persistence every restart downloads the whole feed again. /tmp counts
against the ephemeral storage of the node; the resourcesPresets limit
ephemeral storage to 2Gi, too little for a full sync, which is why the chart
sets explicit resources by default. With workDir.medium: Memory the buffer
counts against the memory limit instead.
Resources
A full sync peaks at about 800 MiB, an incremental sync needs a fraction of
that. The mirror sets GOMEMLIMIT to 90 % of the container's memory limit, so
the garbage collector works harder before the limit is reached instead of the
pod being killed. The default requests 100m CPU and 512Mi and limits the
memory to 2Gi; the sync waits for NVD most of the time, so there is no CPU
limit.
Values
| Key | Type | Default | Description |
|---|---|---|---|
| affinity | object | {} | Affinity rules for the pod |
| commonAnnotations | object | {} | Annotations added to every resource |
| commonLabels | object | {} | Labels added to every resource |
| containerPorts.http | int | 8080 | Port of the feed, /healthz and /readyz, LISTEN_ADDR. Above 1023, the mirror runs without capabilities. |
| containerSecurityContext.allowPrivilegeEscalation | bool | false | Disallow privilege escalation |
| containerSecurityContext.capabilities | object | {"drop":["ALL"]} | Linux capabilities |
| containerSecurityContext.enabled | bool | true | Enable the container security context |
| containerSecurityContext.readOnlyRootFilesystem | bool | true | Mount the root filesystem read-only. The mirror only writes /data and /tmp, both volumes. |
| containerSecurityContext.runAsGroup | int | 65532 | Group id to run as |
| containerSecurityContext.runAsNonRoot | bool | true | Run as a non-root user |
| containerSecurityContext.runAsUser | int | 65532 | User id to run as |
| customLivenessProbe | object | {} | A complete probe replacing the built-in liveness probe. Only used when livenessProbe.enabled is false. |
| customReadinessProbe | object | {} | A complete probe replacing the built-in readiness probe. Only used when readinessProbe.enabled is false. |
| customStartupProbe | object | {} | A complete probe replacing the built-in startup probe. Only used when startupProbe.enabled is false. |
| extraDeploy | list | [] | Extra objects to deploy with the release. Evaluated as templates. |
| extraEnvVars | list | [] | Extra environment variables |
| extraEnvVarsCM | list | [] | ConfigMaps to take environment variables from |
| extraEnvVarsSecret | list | [] | Secrets to take environment variables from |
| extraVolumeMounts | list | [] | Extra volume mounts for the container |
| extraVolumes | list | [] | Extra volumes for the pod, eg. a CA bundle for an outgoing proxy |
| filePrefix | string | "" | Filename prefix of the feed files, FILE_PREFIX (nvdcve-). dependency-check expects the default. |
| fullnameOverride | string | "" | Override the fully generated object names |
| global.defaultStorageClass | string | "" | Global default StorageClass for the data volume |
| global.imagePullSecrets | list | [] | Global Docker registry secret names |
| global.imageRegistry | string | "" | Global Docker image registry |
| image.digest | string | "" | Image digest in the form sha256:aa.... Overrides the tag when set. |
| image.pullPolicy | string | "IfNotPresent" | Image pull policy |
| image.pullSecrets | list | [] | Image pull secrets, as names or - name: my-secret |
| image.registry | string | "docker.io" | Image registry |
| image.repository | string | "ideaplexus/go-nvd-mirror" | Image repository |
| image.tag | string | "" | Image tag. Defaults to the chart appVersion. |
| ingress.annotations | object | {} | Annotations for the Ingress, eg. the cert-manager issuer |
| ingress.enabled | bool | false | Create an Ingress |
| ingress.extraHosts | list | [] | Further hostnames, as name, path and pathType |
| ingress.extraRules | list | [] | Further rules, as in the Ingress spec. Evaluated as templates. |
| ingress.extraTls | list | [] | Further TLS entries, as hosts and secretName |
| ingress.hostname | string | "nvd-mirror.local" | Hostname of the mirror. Evaluated as a template. |
| ingress.ingressClassName | string | "" | IngressClass that implements the Ingress |
| ingress.path | string | "/" | Path of the mirror |
| ingress.pathType | string | "Prefix" | Path type |
| ingress.tls | bool | false | Serve the hostname with TLS from the secret <hostname>-tls, eg. created by cert-manager |
| livenessProbe.enabled | bool | true | Enable the liveness probe |
| livenessProbe.failureThreshold | int | 3 | Consecutive failures tolerated |
| livenessProbe.initialDelaySeconds | int | 0 | Seconds before the first check |
| livenessProbe.periodSeconds | int | 30 | Seconds between checks |
| livenessProbe.successThreshold | int | 1 | Consecutive successes needed after a failure. Must be 1 for a liveness probe. |
| livenessProbe.timeoutSeconds | int | 5 | Seconds after which a check times out |
| log.format | string | "json" | Log format, LOG_FORMAT |
| log.http | bool | false | Log every HTTP request to the mirror, LOG_HTTP |
| log.level | string | "info" | Log level, LOG_LEVEL |
| nameOverride | string | "" | Override the chart name used to construct object names |
| namespaceOverride | string | "" | Override the namespace the objects are created in |
| nodeSelector | object | {} | Node labels the pod is scheduled on |
| nvd.apiKey | string | "" | NVD API key, NVD_API_KEY, stored in a secret this chart creates. Prefer existingSecret, eg. filled by External Secrets. Request one at https://nvd.nist.gov/developers/request-an-api-key. Mutually exclusive with nvd.existingSecret. |
| nvd.existingSecret | string | "" | Name of an existing secret holding the API key, instead of letting the chart manage one. Evaluated as a template. |
| nvd.existingSecretApiKeyKey | string | "apiKey" | Key inside that secret |
| persistence.accessModes | list | ["ReadWriteOnce"] | Access modes of the claim. One pod uses it, so ReadWriteOnce is enough. |
| persistence.annotations | object | {} | Annotations of the claim, eg. helm.sh/resource-policy: keep |
| persistence.enabled | bool | true | Keep the feed on a PersistentVolumeClaim. When disabled the pod uses an emptyDir and syncs everything again after every restart. |
| persistence.existingClaim | string | "" | An existing claim to use instead of creating one. Evaluated as a template. |
| persistence.selector | object | {} | Selector to bind the claim to an existing volume |
| persistence.size | string | "5Gi" | Size of the claim |
| persistence.storageClass | string | "" | StorageClass of the claim. Empty uses global.defaultStorageClass or the cluster default, - disables dynamic provisioning. |
| podAnnotations | object | {} | Annotations for the pod |
| podLabels | object | {} | Labels for the pod |
| podSecurityContext.enabled | bool | true | Enable the pod security context |
| podSecurityContext.fsGroup | int | 65532 | Group of the pod's volumes, so the mirror can write the data volume |
| podSecurityContext.fsGroupChangePolicy | string | "OnRootMismatch" | When to change the ownership of the volumes. OnRootMismatch skips the walk over the feed files on every start. |
| podSecurityContext.seccompProfile | object | {"type":"RuntimeDefault"} | Seccomp profile |
| priorityClassName | string | "" | Priority class for the pod |
| readinessProbe.enabled | bool | true | Enable the readiness probe |
| readinessProbe.failureThreshold | int | 3 | Consecutive failures tolerated |
| readinessProbe.initialDelaySeconds | int | 0 | Seconds before the first check |
| readinessProbe.periodSeconds | int | 10 | Seconds between checks |
| readinessProbe.successThreshold | int | 1 | Consecutive successes needed after a failure |
| readinessProbe.timeoutSeconds | int | 5 | Seconds after which a check times out |
| resources | object | {"limits":{"memory":"2Gi"},"requests":{"cpu":"100m","memory":"512Mi"}} | Container resources, which win over the preset. A full sync peaks at about 800 MiB; the mirror sets GOMEMLIMIT to 90 % of the memory limit. No CPU limit: the sync is bound by NVD, not by the CPU. Set resources: null to use a preset. |
| resources.limits | object | {"memory":"2Gi"} | Resource limits |
| resources.limits.memory | string | "2Gi" | Memory limit |
| resources.requests | object | {"cpu":"100m","memory":"512Mi"} | Requested resources |
| resources.requests.cpu | string | "100m" | Requested CPU |
| resources.requests.memory | string | "512Mi" | Requested memory |
| resourcesPreset | string | "none" | Container resources preset, used when resources is empty (none, nano, micro, small, medium, large, xlarge, 2xlarge). The presets limit ephemeral storage to 2Gi, less than a full sync writes to /tmp. |
| revisionHistoryLimit | int | 10 | Number of old ReplicaSets to retain |
| service.annotations | object | {} | Annotations for the Service |
| service.nodePort | string | nil | Node port, for NodePort and LoadBalancer. Empty lets Kubernetes pick one. |
| service.ports.http | int | 80 | HTTP port |
| service.type | string | "ClusterIP" | Service type |
| serviceAccount.annotations | object | {} | Annotations for the ServiceAccount |
| serviceAccount.automountServiceAccountToken | bool | false | Automount the API token. The mirror does not talk to the Kubernetes API. |
| serviceAccount.create | bool | true | Create a ServiceAccount |
| serviceAccount.name | string | "" | Name of the ServiceAccount. Generated when empty and create is true. |
| startupProbe.enabled | bool | true | Enable the startup probe |
| startupProbe.failureThreshold | int | 12 | Consecutive failures tolerated |
|
Deploy nvd-mirror with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nvd-mirror on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartnvd-mirror is pinned at v0.2.6 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply