StamusNetworks / scirius

Scirius is a web application for Suricata ruleset management and threat hunting.
GNU General Public License v3.0
633 stars 149 forks source link

GET /accounts/login/ HTTP/1.1" 500 after upgrading to the recent scirius from git source #126

Open mobidevadmin opened 6 years ago

mobidevadmin commented 6 years ago

Hello, After upgrade to the recent available scirius version in git repository, I've been experiencing this error message while accessing web interface:

GET /accounts/login/ HTTP/1.1" 500

the run log from CLI is:

/usr/local/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.16) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

/usr/local/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.16) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

Performing system checks...

System check identified no issues (0 silenced).
January 31, 2018 - 13:14:04
Django version 1.8.18, using settings 'scirius.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Webbrowser (Firefox) shows this:

Environment:

Request Method: GET
Request URL: http://scirius.local.mobidev.biz/accounts/login/

Django Version: 1.8.18
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_tables2',
 'bootstrap3',
 'dbbackup',
 'rules',
 'suricata',
 'accounts')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'scirius.loginrequired.LoginRequiredMiddleware',
 'scirius.utils.TimezoneMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  119.                 resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
  365.             for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns
  401.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module
  395.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/opt/scirius/scirius/urls.py" in <module>
  7.     url(r'^rules/', include('rules.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include
  33.         urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/opt/scirius/rules/urls.py" in <module>
  23. from rules import views
File "/opt/scirius/rules/views.py" in <module>
  26. from elasticsearch.exceptions import ConnectionError

Exception Type: ImportError at /accounts/login/
Exception Value: No module named exceptions
biolds commented 6 years ago

It looks like you have an outdated version of python-elasticsearch module, you can try to upgrade with: pip install --upgrade requirements.txt

mobidevadmin commented 6 years ago

Hi,

It's all was done beforehand. Didn't help.

biolds commented 6 years ago

Then it is probably an issue with the installation: the "No module named exceptions" indicates that the elasticsearch module was found, but not the exceptions.py file it should contain. A few things can be checked:

mobidevadmin commented 6 years ago

Thank you for the hints.

Could you please elaborate on how I can check this steps?

mobidevadmin commented 6 years ago

I'd like to add that version 1.1.7 works

biolds commented 6 years ago

In /opt/scirius/rules/views.py, insert line 26 (just before the line that triggered the initial exception):

import elasticsearch
raise Exception('elasticsearch path: %s' % elasticsearch.__file__)

This will show what elasticsearch library is used. Revert it when done. :) Hope it helps.

mobidevadmin commented 6 years ago

This is what I received as a result:

Environment:

Request Method: GET
Request URL: http://192.168.0.5:9090/accounts/login/

Django Version: 1.8
Python Version: 2.7.12
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_tables2',
 'bootstrap3',
 'dbbackup',
 'rules',
 'suricata',
 'accounts')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'scirius.loginrequired.LoginRequiredMiddleware',
 'scirius.utils.TimezoneMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  119.                 resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
  366.             for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns
  402.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module
  396.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/opt/scirius_backup/scirius/urls.py" in <module>
  7.     url(r'^rules/', include('rules.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include
  33.         urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/opt/scirius_backup/rules/urls.py" in <module>
  23. from rules import views
File "/opt/scirius_backup/rules/views.py" in <module>
  27. raise Exception('elasticsearch ptah: %s' % elasticsearch__file__)

Exception Type: NameError at /accounts/login/
Exception Value: name 'elasticsearch__file__' is not defined
pevma commented 6 years ago

Can you try the latest source now? There were quite some new updates.