intelowlproject / IntelOwl

IntelOwl: manage your Threat Intelligence at scale
https://intelowlproject.github.io
GNU Affero General Public License v3.0
3.73k stars 425 forks source link

Unable to start intel_owl_celery_beat and intel_owl_celery_worker after git pull #161

Closed dutchgioproject closed 4 years ago

dutchgioproject commented 4 years ago

After a git pull to update to the latest version, both intel_owl_celery_beat and intel_owl_celery_worker are unable to start. Therefore, logging in to the web interface is not possible.

There seems to be a configuration that expects a Django ldap auth file, 'django_auth_ldap':

).run_from_argv(self.prog_name, argv[1:], command=argv[0])

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 309, in run_from_argv

sys.argv if argv is None else argv, command)

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 393, in handle_argv

return self(*args, **options)

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 253, in call

ret = self.run(*args, **kwargs)

File "/usr/local/lib/python3.7/site-packages/celery/bin/beat.py", line 109, in run

return beat().run()

File "/usr/local/lib/python3.7/site-packages/celery/apps/beat.py", line 79, in run

self.init_loader()

File "/usr/local/lib/python3.7/site-packages/celery/apps/beat.py", line 128, in init_loader

self.app.loader.init_worker()

File "/usr/local/lib/python3.7/site-packages/celery/loaders/base.py", line 114, in init_worker

self.import_default_modules()

File "/usr/local/lib/python3.7/site-packages/celery/loaders/base.py", line 108, in import_default_modules

raise response

File "/usr/local/lib/python3.7/site-packages/celery/utils/dispatch/signal.py", line 288, in send

response = receiver(signal=self, sender=sender, **named)

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 84, in on_import_modules

self.worker_fixup.validate_models()

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 122, in validate_models

self.django_setup()

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 118, in django_setup

django.setup()

File "/usr/local/lib/python3.7/site-packages/django/init.py", line 19, in setup

configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)

File "/usr/local/lib/python3.7/site-packages/django/utils/log.py", line 76, in configure_logging

logging_config_func(logging_settings)

File "/usr/local/lib/python3.7/logging/config.py", line 800, in dictConfig

dictConfigClass(config).configure()

File "/usr/local/lib/python3.7/logging/config.py", line 571, in configure

'%r' % name) from e

ValueError: Unable to configure handler 'django_auth_ldap'

celery beat v4.4.7 (cliffs) is starting.

Traceback (most recent call last):

File "/usr/local/lib/python3.7/logging/config.py", line 563, in configure

handler = self.configure_handler(handlers[name])

File "/usr/local/lib/python3.7/logging/config.py", line 736, in configure_handler

result = factory(**kwargs)

File "/usr/local/lib/python3.7/logging/handlers.py", line 148, in init

BaseRotatingHandler.init(self, filename, mode, encoding, delay)

File "/usr/local/lib/python3.7/logging/handlers.py", line 55, in init

logging.FileHandler.init(self, filename, mode, encoding, delay)

File "/usr/local/lib/python3.7/logging/init.py", line 1087, in init

StreamHandler.init(self, self._open())

File "/usr/local/lib/python3.7/logging/init.py", line 1116, in _open

return open(self.baseFilename, self.mode, encoding=self.encoding)

PermissionError: [Errno 13] Permission denied: '/var/log/intel_owl/django/django_auth_ldap.log'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/usr/local/bin/celery", line 8, in

sys.exit(main())

File "/usr/local/lib/python3.7/site-packages/celery/main.py", line 16, in main

_main()

File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 322, in main

cmd.execute_from_commandline(argv)

File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 499, in execute_from_commandline

super(CeleryCommand, self).execute_from_commandline(argv)))

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 305, in execute_from_commandline

return self.handle_argv(self.prog_name, argv[1:])

File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 491, in handle_argv

return self.execute(command, argv)

File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 419, in execute

).run_from_argv(self.prog_name, argv[1:], command=argv[0])

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 309, in run_from_argv

sys.argv if argv is None else argv, command)

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 393, in handle_argv

return self(*args, **options)

File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 253, in call

ret = self.run(*args, **kwargs)

File "/usr/local/lib/python3.7/site-packages/celery/bin/beat.py", line 109, in run

return beat().run()

File "/usr/local/lib/python3.7/site-packages/celery/apps/beat.py", line 79, in run

self.init_loader()

File "/usr/local/lib/python3.7/site-packages/celery/apps/beat.py", line 128, in init_loader

self.app.loader.init_worker()

File "/usr/local/lib/python3.7/site-packages/celery/loaders/base.py", line 114, in init_worker

self.import_default_modules()

File "/usr/local/lib/python3.7/site-packages/celery/loaders/base.py", line 108, in import_default_modules

raise response

File "/usr/local/lib/python3.7/site-packages/celery/utils/dispatch/signal.py", line 288, in send

response = receiver(signal=self, sender=sender, **named)

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 84, in on_import_modules

self.worker_fixup.validate_models()

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 122, in validate_models

self.django_setup()

File "/usr/local/lib/python3.7/site-packages/celery/fixups/django.py", line 118, in django_setup

django.setup()

File "/usr/local/lib/python3.7/site-packages/django/init.py", line 19, in setup

configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)

File "/usr/local/lib/python3.7/site-packages/django/utils/log.py", line 76, in configure_logging

logging_config_func(logging_settings)

File "/usr/local/lib/python3.7/logging/config.py", line 800, in dictConfig

dictConfigClass(config).configure()

File "/usr/local/lib/python3.7/logging/config.py", line 571, in configure

'%r' % name) from e

ValueError: Unable to configure handler 'django_auth_ldap'

I've already done a clean install but this seems to cause the same issue.

mlodic commented 4 years ago

Hi, thank you for reporting the issue! I am about to check this. Meanwhile you can

touch /var/lib/docker/volumes/intelowl_generic_logs/_data/django/django_auth_ldap.log -> this creates the missing file if it does not exist
chown www-data:www-data /var/lib/docker/volumes/intelowl_generic_logs/_data/django/django_auth_ldap.log -> this should fix the Permission Error

This should fix the problem while I investigate on the root cause. Care that the folder intelowl_generic_logs could be called differently based on the folder where you git pulled the project.

dutchgioproject commented 4 years ago

Thanks. I'm unable to locate the intelowl_generic_logs folder though, I git pulled the project in my user directory in Windows, using Docker desktop.

mlodic commented 4 years ago

Apologies, I assumed that you were using a Unix-like OS.

Honestly we did not test IntelOwl on Windows. We recommend to use a Unix-like OS. We will specify clearer in the next documentation that, at the moment, we can provide support only for Unix-like installations.

However the point is to identify where the "offended" file is located. The folder where the volumes are located should be here C:\Users\Public\Documents\Hyper-V\Virtual hard disks (https://stackoverflow.com/questions/43181654/locating-data-volumes-in-docker-desktop-windows). Then, you should follow this path intelowl_generic_logs/_data/django/django_auth_ldap.log and change the permissions of the log file to reflect the same permissions that the other log files have in that folder. It would be really nice if you could paste what did you find.

Also, I think that the installation is not completely "clean". You should also remove the volumes related to IntelOwl.

Later I can try Docker Desktop in Windows manually so maybe I can give you more hints.

dutchgioproject commented 4 years ago

Thanks. It turns out to be even more complex, the files aren't there. I'll reinstall it on a Unix system as it will be supported.