Skip to content

Defectdojo cant handle secure connections to DB #1716

@parafoxx

Description

@parafoxx

Bug description
Defectdojo is unable to use ssl/tls encypted connections when using Mysql as DB. Therefore it is unable to use in certain environments where secure connections are enforced.

Steps to reproduce
Steps to reproduce the behavior:

  1. clone the project

  2. change line 70 in the docker-compose.yml to require SSL:
    command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] --> command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', '--require-secure-transport=ON']

  3. build and run the project docker-compose up --build

  4. See error in logs from initializer, celerybeat and celeryworker

Expected behavior
Defectdojo tries to use a secure connection by default and exits if no secure connection is possible (unless a specific environment variable is set like "allow unsecure DB connections")

Deployment method (select with an X)

  • Kubernetes
  • Docker
  • setup.bash / legacy-setup.bash (not tested)

Environment information

  • Operating System: Docker
  • DefectDojo Commit Message: 6d56806: Update README.md [2019-11-26 16:42:15 -0600]

Console logs (optional)
e.g. for initializer:
initializer_1 | .ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON. initializer_1 | Traceback (most recent call last): initializer_1 | File "manage.py", line 10, in <module> initializer_1 | execute_from_command_line(sys.argv) initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line initializer_1 | utility.execute() initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute initializer_1 | self.fetch_command(subcommand).run_from_argv(self.argv) initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 323, in run_from_argv initializer_1 | self.execute(*args, **cmd_options) initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute initializer_1 | output = self.handle(*args, **options) initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/core/management/commands/dbshell.py", line 22, in handle initializer_1 | connection.client.runshell() initializer_1 | File "/usr/local/lib/python3.5/site-packages/django/db/backends/mysql/client.py", line 48, in runshell initializer_1 | subprocess.check_call(args) initializer_1 | File "/usr/local/lib/python3.5/subprocess.py", line 271, in check_call initializer_1 | raise CalledProcessError(retcode, cmd) initializer_1 | subprocess.CalledProcessError: Command '['mysql', '--user=defectdojo', '--password=defectdojo', '--host=mysql', '--port=3306', 'defectdojo']' returned non-zero exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions