biggiesmallsAG / nightHawkResponse

Incident Response Forensic Framework
599 stars 139 forks source link

Improper configuration "SECRET_KEY setting must not be empty" #22

Closed espressobeanies closed 6 years ago

espressobeanies commented 7 years ago

Hi,

I ran an update from the nighthawk response repo and when I rebooted, I get this:

nighthawk.service - nightHawk Response Service
   Loaded: loaded (/usr/lib/systemd/system/nighthawk.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2016-11-29 07:14:36 UTC; 4s ago
  Process: 1253 ExecStop=/opt/nighthawk/bin/nighthawkctl service stop (code=exited, status=1/FAILURE)
  Process: 1290 ExecStart=/opt/nighthawk/bin/nighthawkctl service start (code=exited, status=0/SUCCESS)
 Main PID: 1290 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nighthawk.service
           ├─1317 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini
           ├─1324 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1358 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1359 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1360 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1361 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1362 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawkwebsocket.ini
           ├─1363 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini
           ├─1364 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini
           ├─1365 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini
           ├─1366 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini
           └─1367 /sbin/uwsgi --ini /opt/nighthawk/etc/nighthawk-uwsgi.ini

Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: from ws4redis import settings
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: File "/usr/lib/python2.7/site-packages/ws4redis/settings.py", line 4, in <module>
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: WEBSOCKET_URL = getattr(settings, 'WEBSOCKET_URL', '/ws/')
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: self._setup(name)
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: self._wrapped = Settings(settings_module)
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 113, in __init__
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
Nov 29 07:14:36 nighthawk.local nighthawkctl[1290]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Ideas? My Kibana also say "No default index pattern".

roshanmaskey commented 7 years ago

Hi,

The update package was for older version which should not have applied to this version, I will check what went wrong on that.

In regards to your current problem, probably because of update from nighthwak repo, DJANGO secret key was removed. step_1: Open file /opt/nighthawk/web/nighthawk/settings.py in your favorite editor step_2: Append value to SECRET_KEY e.g. SECRET_KEY = 'very large random character'

In regards to Kibana, Kibana isn't initialized with default index, you will have to set index as investigation*. (We will automatically initialize in next version, that we are working on)

If all fails as workaround, install and disable nighthhawk repo and update the base OS

espressobeanies commented 7 years ago

Yea, it looks like the update wiped out my settings.py config file. Even if I paste the settings.py GitHub source code and reboot, Nighthawk service still shows status 'active=exited' and I'm unable to use the Nighthawk WebUI itself. I'll do a reinstall. Thanks.

biggiesmallsAG commented 7 years ago

Hi espressobeanie,

Did you end up doing a reinstall?

Regards,

Dan