nvd-mirror

by tina.junold

Helm chartv0.2.6App 1.0.12Verified publisher

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

NameEmailUrl
Tina Junold[email protected]https://ideaplexus.com

Source Code

Requirements

Kubernetes: >=1.29.0-0

RepositoryNameVersion
https://charts.ideaplexus.comcommon1.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

PathVolumeHolds
/datathe claim of persistence (5Gi), or an emptyDirthe feed, about 220 MB and growing
/tmpan 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

KeyTypeDefaultDescription
affinityobject{}Affinity rules for the pod
commonAnnotationsobject{}Annotations added to every resource
commonLabelsobject{}Labels added to every resource
containerPorts.httpint8080Port of the feed, /healthz and /readyz, LISTEN_ADDR. Above 1023, the mirror runs without capabilities.
containerSecurityContext.allowPrivilegeEscalationboolfalseDisallow privilege escalation
containerSecurityContext.capabilitiesobject{"drop":["ALL"]}Linux capabilities
containerSecurityContext.enabledbooltrueEnable the container security context
containerSecurityContext.readOnlyRootFilesystembooltrueMount the root filesystem read-only. The mirror only writes /data and /tmp, both volumes.
containerSecurityContext.runAsGroupint65532Group id to run as
containerSecurityContext.runAsNonRootbooltrueRun as a non-root user
containerSecurityContext.runAsUserint65532User id to run as
customLivenessProbeobject{}A complete probe replacing the built-in liveness probe. Only used when livenessProbe.enabled is false.
customReadinessProbeobject{}A complete probe replacing the built-in readiness probe. Only used when readinessProbe.enabled is false.
customStartupProbeobject{}A complete probe replacing the built-in startup probe. Only used when startupProbe.enabled is false.
extraDeploylist[]Extra objects to deploy with the release. Evaluated as templates.
extraEnvVarslist[]Extra environment variables
extraEnvVarsCMlist[]ConfigMaps to take environment variables from
extraEnvVarsSecretlist[]Secrets to take environment variables from
extraVolumeMountslist[]Extra volume mounts for the container
extraVolumeslist[]Extra volumes for the pod, eg. a CA bundle for an outgoing proxy
filePrefixstring""Filename prefix of the feed files, FILE_PREFIX (nvdcve-). dependency-check expects the default.
fullnameOverridestring""Override the fully generated object names
global.defaultStorageClassstring""Global default StorageClass for the data volume
global.imagePullSecretslist[]Global Docker registry secret names
global.imageRegistrystring""Global Docker image registry
image.digeststring""Image digest in the form sha256:aa.... Overrides the tag when set.
image.pullPolicystring"IfNotPresent"Image pull policy
image.pullSecretslist[]Image pull secrets, as names or - name: my-secret
image.registrystring"docker.io"Image registry
image.repositorystring"ideaplexus/go-nvd-mirror"Image repository
image.tagstring""Image tag. Defaults to the chart appVersion.
ingress.annotationsobject{}Annotations for the Ingress, eg. the cert-manager issuer
ingress.enabledboolfalseCreate an Ingress
ingress.extraHostslist[]Further hostnames, as name, path and pathType
ingress.extraRuleslist[]Further rules, as in the Ingress spec. Evaluated as templates.
ingress.extraTlslist[]Further TLS entries, as hosts and secretName
ingress.hostnamestring"nvd-mirror.local"Hostname of the mirror. Evaluated as a template.
ingress.ingressClassNamestring""IngressClass that implements the Ingress
ingress.pathstring"/"Path of the mirror
ingress.pathTypestring"Prefix"Path type
ingress.tlsboolfalseServe the hostname with TLS from the secret <hostname>-tls, eg. created by cert-manager
livenessProbe.enabledbooltrueEnable the liveness probe
livenessProbe.failureThresholdint3Consecutive failures tolerated
livenessProbe.initialDelaySecondsint0Seconds before the first check
livenessProbe.periodSecondsint30Seconds between checks
livenessProbe.successThresholdint1Consecutive successes needed after a failure. Must be 1 for a liveness probe.
livenessProbe.timeoutSecondsint5Seconds after which a check times out
log.formatstring"json"Log format, LOG_FORMAT
log.httpboolfalseLog every HTTP request to the mirror, LOG_HTTP
log.levelstring"info"Log level, LOG_LEVEL
nameOverridestring""Override the chart name used to construct object names
namespaceOverridestring""Override the namespace the objects are created in
nodeSelectorobject{}Node labels the pod is scheduled on
nvd.apiKeystring""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.existingSecretstring""Name of an existing secret holding the API key, instead of letting the chart manage one. Evaluated as a template.
nvd.existingSecretApiKeyKeystring"apiKey"Key inside that secret
persistence.accessModeslist["ReadWriteOnce"]Access modes of the claim. One pod uses it, so ReadWriteOnce is enough.
persistence.annotationsobject{}Annotations of the claim, eg. helm.sh/resource-policy: keep
persistence.enabledbooltrueKeep the feed on a PersistentVolumeClaim. When disabled the pod uses an emptyDir and syncs everything again after every restart.
persistence.existingClaimstring""An existing claim to use instead of creating one. Evaluated as a template.
persistence.selectorobject{}Selector to bind the claim to an existing volume
persistence.sizestring"5Gi"Size of the claim
persistence.storageClassstring""StorageClass of the claim. Empty uses global.defaultStorageClass or the cluster default, - disables dynamic provisioning.
podAnnotationsobject{}Annotations for the pod
podLabelsobject{}Labels for the pod
podSecurityContext.enabledbooltrueEnable the pod security context
podSecurityContext.fsGroupint65532Group of the pod's volumes, so the mirror can write the data volume
podSecurityContext.fsGroupChangePolicystring"OnRootMismatch"When to change the ownership of the volumes. OnRootMismatch skips the walk over the feed files on every start.
podSecurityContext.seccompProfileobject{"type":"RuntimeDefault"}Seccomp profile
priorityClassNamestring""Priority class for the pod
readinessProbe.enabledbooltrueEnable the readiness probe
readinessProbe.failureThresholdint3Consecutive failures tolerated
readinessProbe.initialDelaySecondsint0Seconds before the first check
readinessProbe.periodSecondsint10Seconds between checks
readinessProbe.successThresholdint1Consecutive successes needed after a failure
readinessProbe.timeoutSecondsint5Seconds after which a check times out
resourcesobject{"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.limitsobject{"memory":"2Gi"}Resource limits
resources.limits.memorystring"2Gi"Memory limit
resources.requestsobject{"cpu":"100m","memory":"512Mi"}Requested resources
resources.requests.cpustring"100m"Requested CPU
resources.requests.memorystring"512Mi"Requested memory
resourcesPresetstring"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.
revisionHistoryLimitint10Number of old ReplicaSets to retain
service.annotationsobject{}Annotations for the Service
service.nodePortstringnilNode port, for NodePort and LoadBalancer. Empty lets Kubernetes pick one.
service.ports.httpint80HTTP port
service.typestring"ClusterIP"Service type
serviceAccount.annotationsobject{}Annotations for the ServiceAccount
serviceAccount.automountServiceAccountTokenboolfalseAutomount the API token. The mirror does not talk to the Kubernetes API.
serviceAccount.createbooltrueCreate a ServiceAccount
serviceAccount.namestring""Name of the ServiceAccount. Generated when empty and create is true.
startupProbe.enabledbooltrueEnable the startup probe
startupProbe.failureThresholdint12Consecutive 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnvd-mirror is pinned at v0.2.6 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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