DefectDojo / godojo

Golang installer for DefectDojo
GNU General Public License v3.0
23 stars 22 forks source link

Can't start godojo #45

Closed oluapG closed 2 years ago

oluapG commented 2 years ago

Hello,

I tried installer the godojo, first I setup my DB in dojoConfig.yml and executed the script godojo.

After this I used the script to started the service. (https://github.com/DefectDojo/godojo/tree/master/docs-and-scripts) But doesn't work.

So, executed the command manually one-by-one, but doestn't work.

When I tried ( python manage.py runserver 0.0.0.0:8000 ), I Received the error below:

Traceback (most recent call last): File "manage.py", line 11, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 308, in execute settings.INSTALLED_APPS File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 56, in __getattr__ self._setup(name) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 41, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 110, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/dojo/django-DefectDojo/dojo/__init__.py", line 5, in <module> from .celery import app as celery_app # noqa File "/opt/dojo/django-DefectDojo/dojo/celery.py", line 2, in <module> from celery import Celery ImportError: cannot import name Celery

The Celery already installed:

test@ip-192-168-10-21:/opt/dojo/django-DefectDojo# pip2 install celery DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Requirement already satisfied: celery in /usr/local/lib/python2.7/dist-packages (4.4.7) Requirement already satisfied: billiard<4.0,>=3.6.3.0 in /usr/local/lib/python2.7/dist-packages (from celery) (3.6.4.0) Requirement already satisfied: kombu<4.7,>=4.6.10 in /usr/local/lib/python2.7/dist-packages (from celery) (4.6.11) Requirement already satisfied: pytz>dev in /usr/local/lib/python2.7/dist-packages (from celery) (2022.2.1) Requirement already satisfied: vine==1.3.0 in /usr/local/lib/python2.7/dist-packages (from celery) (1.3.0) Requirement already satisfied: amqp<2.7,>=2.6.0 in /usr/local/lib/python2.7/dist-packages (from kombu<4.7,>=4.6.10->celery) (2.6.1) Requirement already satisfied: importlib-metadata>=0.18; python_version < "3.8" in /usr/local/lib/python2.7/dist-packages (from kombu<4.7,>=4.6.10->celery) (2.1.3) Requirement already satisfied: contextlib2; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (0.6.0.post1) Requirement already satisfied: pathlib2; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (2.3.7.post1) Requirement already satisfied: configparser>=3.5; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (4.0.2) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python2.7/dist-packages (from importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (1.2.0) Requirement already satisfied: scandir; python_version < "3.5" in /usr/local/lib/python2.7/dist-packages (from pathlib2; python_version < "3"->importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (1.10.0) Requirement already satisfied: typing; python_version < "3.5" in /usr/local/lib/python2.7/dist-packages (from pathlib2; python_version < "3"->importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (3.10.0.0) Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from pathlib2; python_version < "3"->importlib-metadata>=0.18; python_version < "3.8"->kombu<4.7,>=4.6.10->celery) (1.16.0)

I tried installed godojo in Ubuntu 20.04.

where am i wrong?

giveen commented 2 years ago

It uses Python 3.x and you your installation has 2.7 as default.

oluapG commented 2 years ago

I set Python3.x as default, re-run godojo.

Now I received this error below after ( python manage.py runserver 0.0.0.0:8000 ) :

Traceback (most recent call last):
  File "/opt/dojo/django-DefectDojo/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/runserver.py", line 68, in handle
    if not settings.DEBUG and not settings.ALLOWED_HOSTS:
  File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 189, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

I tried set password in file ( dojoConfig.yml )

# cat dojoConfig.yml | grep -i secret
# SecretKey
  SecretKey: "mYpassw0rD" # DD_SECRET_KEY - Used by Django for encryption like creating CSRF tokens Note: If empty, generated 128 character random value is used

But received the same error.

mtesauro commented 2 years ago

Looks like the/opt/dojo/django-DefectDojo/dojo/settings/.env.prod is missing that value. Also, if "mYpassw0rD" was your actual value, you should use something much longer and more random - see here

You can either add it to that file or set it as an environmental variable prior to running the startup script. This line in settings.dist.py shows where its read from the environment: SECRET_KEY = env('DD_SECRET_KEY')

Alternatively, for about the last year, DefectDojo supported putting local configuration changes into a file called 'local_settings.py" located at /opt/dojo/django-DefectDojo/dojo/settings/

You could create this file and drop whatever customization for your local setup are desired. The template file is at https://github.com/DefectDojo/django-DefectDojo/blob/master/dojo/settings/template-local_settings if you want to see an example.

I'd suggest you comment out or remove the templates default items unless you understand what they are doing.

HTH