django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Incomplete IPv6 / dual-stack support for Helm on IPv6-only clusters

Open alirezakolahdouzan opened this issue 4 months ago • 2 comments

Summary

DefectDojo does not fully work on IPv6-only Kubernetes clusters (e.g. EKS with IPv6 pod networking).

Related: #12695, #12710, #12916, #12938. Nginx IPv6 listen directives were added in #12710, fully reverted in #12916, and never restored. #12938 only added entrypoint logic to strip listen [::]: when IPv6 is unavailable. uWSGI’s HTTP probe listener remains IPv4-only.

Problems

1. nginx listens on IPv4 only

nginx/nginx.conf and nginx/nginx_TLS.conf currently have only:

  • listen 8080;
  • listen 8443 ssl; (TLS config)

There are no listen [::]:8080; / listen [::]:8443 ssl; lines. docker/entrypoint-nginx.sh already removes listen [::]: when IPv6 loopback is missing, but the configs never include those directives, so dual-stack never activates. On IPv6-only pods, kubelet probes against the pod’s IPv6 address fail.

2. uWSGI HTTP probe bind is hardcoded to IPv4

In docker/entrypoint-uwsgi.sh:

--http 0.0.0.0:8081 --http-to "${DD_UWSGI_ENDPOINT}"

This HTTP endpoint is for Kubernetes liveness checks. On IPv6-only pods, probes fail because the listener is IPv4-only. The main nginx↔uWSGI path via DD_UWSGI_ENDPOINT (Unix socket) is fine; only this probe bind needs fixing.

Requested changes

  1. Restore dual-stack nginx listens (entrypoint already handles IPv4-only hosts):

    • listen [::]:8080;
    • listen [::]:8443 ssl;
    • Optionally add ::1/128 to the metrics geo bypass alongside 127.0.0.1/32.
  2. Make the uWSGI HTTP probe bind configurable via env, e.g.:

--http "${DD_UWSGI_HTTP:-0.0.0.0:8081}"
  1. Expose it in the Helm chart (e.g. django.uwsgi.http → DD_UWSGI_HTTP) so IPv6-only / dual-stack clusters can set [::]:8081 without rebuilding images. (django.uwsgi.extraEnv alone is not enough while the bind address stays hardcoded in the entrypoint.)

Workaround

We currently rebuild the official nginx/django images to add the nginx listen [::]:... directives and change uWSGI to --http [::]:8081.

alirezakolahdouzan avatar Jul 22 '26 10:07 alirezakolahdouzan

You're welcome to raise a PR.

valentijnscholten avatar Jul 22 '26 12:07 valentijnscholten

I reproduced this on a kind cluster with ipFamily: ipv6, and your diagnosis holds. nginx's startup probe and uWSGI's liveness probe were both refused on the pod's IPv6 address, and the pod never became ready. Postgres, Valkey and Celery all ran fine over IPv6, so these two listeners were what kept the pod from becoming ready.

#16717 carries your commit from #15328 with your authorship, rebased onto dev with the changelog entry requested in that review. With django.uwsgi.appSettings.http: "[::]:8081", the pod was ready in under two minutes with or without TLS. I kept your default of 0.0.0.0:8081, so IPv6-only clusters still need to set that value. Without it, 8081 stays refused over IPv6.

If you reproduce this on kind, set django.uwsgi.appSettings.maxFd as well. Otherwise uWSGI can get OOM-killed at boot because of the inherited nofile limit (#9562), which looks similar to a probe failure.

AI disclosure: written with Claude Code, which also ran the tests.

geographybuff avatar Nov 06 '26 22:11 geographybuff