Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update of source is not working🐞🐋 <title> #469

Open
1 task done
nvmike opened this issue Jun 20, 2024 · 4 comments
Open
1 task done

Update of source is not working🐞🐋 <title> #469

nvmike opened this issue Jun 20, 2024 · 4 comments
Labels
Docker SELKS on Docker

Comments

@nvmike
Copy link

nvmike commented Jun 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When trying to update sources - error coming:
bulk_create() prohibited to prevent data loss due to unsaved related object 'flowbit'.

Environment:

Request Method: POST
Request URL: https://192.168.251.128/suricata/update

Django Version: 3.2.25
Python Version: 3.9.19
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_tables2',
'bootstrap3',
'dbbackup',
'viz',
'rules',
'scirius',
'suricata',
'accounts',
'rest_framework',
'rest_framework.authtoken',
'django_filters',
'webpack_loader',
'revproxy')
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'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',
'csp.middleware.CSPMiddleware',
'scirius.utils.CustomCSPMiddleware',
'django_cprofile_middleware.middleware.ProfilerMiddleware']

Traceback (most recent call last):
File "/root/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/root/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/root/.local/lib/python3.9/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/opt/scirius/suricata/views.py", line 164, in update
suri.ruleset.update()
File "/opt/scirius/rules/models.py", line 3389, in update
source.update()
File "/usr/local/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/opt/scirius/rules/models.py", line 1316, in update
self._handle_file(f)
File "/opt/scirius/rules/models.py", line 1414, in _handle_file
self.handle_rules_in_tar(_file)
File "/opt/scirius/rules/models.py", line 1171, in handle_rules_in_tar
self.get_categories()
File "/opt/scirius/rules/models.py", line 1080, in get_categories
category.get_rules(
File "/opt/scirius/rules/models.py", line 2357, in get_rules
Flowbit.set.through.objects.bulk_create(flowbits["added"]["through_set"])
File "/root/.local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/root/.local/lib/python3.9/site-packages/django/db/models/query.py", line 498, in bulk_create
self._prepare_for_bulk_create(objs)
File "/root/.local/lib/python3.9/site-packages/django/db/models/query.py", line 461, in _prepare_for_bulk_create
obj._prepare_related_fields_for_save(operation_name='bulk_create')
File "/root/.local/lib/python3.9/site-packages/django/db/models/base.py", line 945, in _prepare_related_fields_for_save
raise ValueError(

Exception Type: ValueError at /suricata/update
Exception Value: bulk_create() prohibited to prevent data loss due to unsaved related object 'flowbit'.

Expected Behavior

No response

Steps To Reproduce

No response

Docker version

Docker version 26.1.4, build 5650f9b

Docker version

Docker Compose version v2.16.0

OS Version

Ubuntu 24.04 LTS

Content of the environnement File

COMPOSE_PROJECT_NAME=selks
INTERFACES= -i ens192
SCIRIUS_DEBUG=True
NGINX_EXEC=nginx-debug
SCIRIUS_SECRET_KEY=Dq9UjepRagjejLWePNUNpi6b6MjDNKY9vKcNr6iVGeo
PWD=${PWD}

Version of SELKS

commit 2fc5391 (HEAD -> master, origin/master, origin/HEAD)
Merge: a030b9a 16fc908
Author: Eric Leblond [email protected]
Date: Mon Sep 11 08:35:37 2023 +0000

Merge branch 'Arkime-fix-v1' into 'master'

Add oui file for Arkime

See merge request devel/SELKS!5

Anything else?

ValueError at /suricata/update

bulk_create() prohibited to prevent data loss due to unsaved related object 'flowbit'.
Request Method: | POST -- | -- https://192.168.251.128/suricata/update 3.2.25 ValueError bulk_create() prohibited to prevent data loss due to unsaved related object 'flowbit'. /root/.local/lib/python3.9/site-packages/django/db/models/base.py, line 945, in _prepare_related_fields_for_save /usr/local/bin/python 3.9.19 ['/opt/scirius', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/root/.local/lib/python3.9/site-packages', '/usr/local/lib/python3.9/site-packages']
@nvmike nvmike added the Docker SELKS on Docker label Jun 20, 2024
@inguy24
Copy link

inguy24 commented Jun 27, 2024

Same error on fresh install of 22.04 LTS and SELKS via docker.

@nvmike
Copy link
Author

nvmike commented Jun 27, 2024

Hi
Yesterday I decide to start from scratch:
I did remove all my containers and images - Git pull - and reinstall.
Then it did work.

@inguy24
Copy link

inguy24 commented Jun 27, 2024

Hmmm i just did this on a fresh install too. I will try it again... Did you change any configuration when you tried reinstalling?

@pevma
Copy link
Member

pevma commented Jun 29, 2024

It seems you are running the previous version of SELKS?
You should be on https://github.com/StamusNetworks/SELKS/commits/master/ (aka SELKS 10 currently), form the original issue opening it seems the commits you are on now are (older SELKS) :

Merge branch 'Arkime-fix-v1' into 'master'
Add oui file for Arkime
See merge request devel/SELKS!5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docker SELKS on Docker
Projects
None yet
Development

No branches or pull requests

3 participants