Skip to main content
Version: 3.14

Integrate DefectDojo

Install DefectDojo on Kubernetes with Helm and integrate it into KubeRocketCI pipelines for vulnerability management. Once installed, you can enable single sign-on by following the DefectDojo Microsoft Entra OIDC SSO Setup guide.

info

It is also possible to install DefectDojo using the add-ons approach. For details, please refer to the KubeRocketCI addons approach.

note

For details on how KubeRocketCI pipelines report findings to DefectDojo, including the data model, engagement naming, and scan types, refer to Security Scanning Pipelines. For the runtime findings of the cluster workloads, refer to Runtime Security Findings in DefectDojo.

Prerequisites​

  • Kubectl version 1.34.0+ is installed. Please refer to the Kubernetes official website for details.
  • Helm version 3.19.0+ is installed. Please refer to the Helm page on GitHub for details.
  • DefectDojo 3.5.200 is the tested and recommended version; earlier versions may work but are not tested.

Installation​

info

Please refer to the DefectDojo Helm Chart, which ships the application with its PostgreSQL database and Valkey message broker, and the DefectDojo Helm chart 1.9.70 README for details.

Installation DefectDojo Cluster Add-On Approach​

To install DefectDojo in environment, it's recommended to use the resources provided in the Cluster Add-Ons repository. Leveraging the Cluster Add-Ons simplifies the deployment and management process, providing a streamlined method to integrate DefectDojo into infrastructure.

  1. Navigate to the forked cluster Add-Ons repository and align the defectdojo values.yaml file. Follow the instructions to deploy DefectDojo.

  2. Update the configuration to enable DefectDojo in Add-Ons repository:

    clusters/core/apps/values.yaml
    defectdojo:
    createNamespace: true
    enable: true
  3. Sync resources and wait till the all DefectDojo resources is created:

    DefectDojo ArgoCD applications

Installation DefectDojo Helm Chart Approach​

  1. Check that a security namespace is created. If not, run the following command to create it:

    kubectl create namespace defectdojo
    For the OpenShift users

    When using the OpenShift platform, install the SecurityContextConstraints resource. In case of using a custom namespace for defectdojo, change the namespace in the users section.

    View: defectdojo-scc.yaml
    allowHostDirVolumePlugin: false
    allowHostIPC: false
    allowHostNetwork: false
    allowHostPID: false
    allowHostPorts: false
    allowPrivilegeEscalation: true
    allowPrivilegedContainer: false
    allowedCapabilities: null
    apiVersion: security.openshift.io/v1
    allowedFlexVolumes: []
    defaultAddCapabilities: []
    fsGroup:
    type: MustRunAs
    ranges:
    - min: 999
    max: 65543
    groups: []
    kind: SecurityContextConstraints
    metadata:
    annotations:
    "helm.sh/hook": "pre-install"
    name: defectdojo
    priority: 1
    readOnlyRootFilesystem: false
    requiredDropCapabilities:
    - KILL
    - MKNOD
    - SETUID
    - SETGID
    runAsUser:
    type: MustRunAsRange
    uidRangeMin: 1
    uidRangeMax: 65543
    seLinuxContext:
    type: MustRunAs
    supplementalGroups:
    type: RunAsAny
    users:
    - system:serviceaccount:defectdojo:defectdojo
    - system:serviceaccount:defectdojo:defectdojo-valkey
    - system:serviceaccount:defectdojo:default
    volumes:
    - configMap
    - downwardAPI
    - emptyDir
    - persistentVolumeClaim
    - projected
    - secret
  2. Add a chart repository:

    helm repo add defectdojo 'https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/helm-charts'
    helm repo update
  3. Create PostgreSQL admin secret:

    kubectl -n defectdojo create secret generic defectdojo-postgresql-specific \
    --from-literal=postgresql-password=<postgresql_password> \
    --from-literal=postgresql-postgres-password=<postgresql_postgres_password>
    note

    The postgresql_password and postgresql_postgres_password passwords must be 16 characters long.

  4. Create Valkey secret:

    kubectl -n defectdojo create secret generic defectdojo-valkey-specific \
    --from-literal=valkey-password=<valkey_password>
    note

    The valkey_password password must be 10 characters long.

  5. Create DefectDojo admin secret:

    kubectl -n defectdojo create secret generic defectdojo \
    --from-literal=DD_ADMIN_PASSWORD=<dd_admin_password> \
    --from-literal=DD_SECRET_KEY=<dd_secret_key> \
    --from-literal=DD_CREDENTIAL_AES_256_KEY=<dd_credential_aes_256_key> \
    --from-literal=METRICS_HTTP_AUTH_PASSWORD=<metric_http_auth_password>
    note

    The dd_admin_password password must be 22 characters long.

    The dd_secret_key password must be 128 characters long.

    The dd_credential_aes_256_key password must be 128 characters long.

    The metric_http_auth_password password must be 32 characters long.

  6. Install DefectDojo 3.5.200 using the defectdojo/defectdojo Helm chart 1.9.70:

    helm upgrade --install \
    defectdojo \
    --version 1.9.70 \
    defectdojo/defectdojo \
    --namespace defectdojo \
    --values values.yaml

    The chart uses the DefectDojo images of its app version, 3.5.200, so the values.yaml file sets no image tag. Check out the values.yaml file sample of the DefectDojo customization:

    View: values.yaml
    fullnameOverride: defectdojo
    host: defectdojo.<ROOT_DOMAIN>
    siteUrl: https://defectdojo.<ROOT_DOMAIN>
    alternativeHosts:
    - defectdojo-django.defectdojo

    initializer:
    # runs the database migrations on install and upgrade; keep it enabled
    run: true
    django:
    ingress:
    enabled: true # change to 'false' for OpenShift
    activateTLS: false
  7. For the OpenShift platform, install a Route:

    View: defectdojo-route.yaml
    kind: Route
    apiVersion: route.openshift.io/v1
    metadata:
    name: defectdojo
    namespace: defectdojo
    spec:
    host: defectdojo.<ROOT_DOMAIN>
    path: /
    tls:
    insecureEdgeTerminationPolicy: Redirect
    termination: edge
    to:
    kind: Service
    name: defectdojo-django
    port:
    targetPort: http
    wildcardPolicy: None

Configuration DefectDojo ci-user​

DefectDojo 3.5.200 has no global roles. A user gets access either as a staff user or as an authorized user of a Product Type, shown as an Organization in the UI. The KubeRocketCI pipelines write to the KubeRocketCI Organization by default. To prepare DefectDojo for integration with KubeRocketCI, follow the steps below:

  1. Create the ci user in the DefectDojo UI:

    • Log in to the DefectDojo UI with the admin credentials:

      echo "DefectDojo admin password: $(kubectl \
      get secret defectdojo \
      --namespace=defectdojo \
      --output jsonpath='{.data.DD_ADMIN_PASSWORD}' \
      | base64 --decode)"
    • Go to Users, click New User, and create the user, for example ci-user.

    • Grant the user access with one of these options:

      • Staff user: select Staff status when you create the user. Only a superuser, such as admin, can set it.

      • Authorized user of the KubeRocketCI Organization: leave Staff status cleared. Go to Organizations -> Add Organization and create the KubeRocketCI Organization. Open it, and in the Authorized Users panel, click Add Users and add the user.

    warning

    With the second option, create the KubeRocketCI Organization before the first pipeline run. A user without the staff status has access only to the Organizations that list it in Authorized Users. DefectDojo does not add the user there when its import creates the Organization.

  2. Get a token of the DefectDojo user:

    • Log in to the DefectDojo UI with the credentials of the user from the previous step.

    • Open the user menu and select API v2 Key.

    • Copy the API key.

      DefectDojo api key

Integration DefectDojo with KubeRocketCI​

Provision the secret using KubeRocketCI portal, Manifest or with the externalSecrets operator:

Go to the Portal open Configuration -> SECURITY -> DEFECTDOJO. Update or click + ADD INTEGRATION fill fields Quick Link URL, URL and Token click the save button.

DefectDojo update manual secret

After following the instructions provided, you should be able to integrate your DefectDojo with the KubeRocketCI using one of the available scenarios.