diff --git a/CHANGELOG.md b/CHANGELOG.md index d3336db..922446a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ ## 1.2.x +### 1.2.1 +#### Bugfix +* Fixed Elasticsearch environment variable +* Renamed shared tasks ### 1.2.0 #### Features * Implemented Certego shared CI 1.3.5 diff --git a/README.md b/README.md index c0c92ee..a6b58af 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Or download the application directly from the [Docker Hub](https://hub.docker.co After that, there are two ways of running BuffaLogs, depending on your system configurations: * if you already have an elastic cluster: - * set the address of the host into the `CERTEGO_BUFFALOGS_ELASTICSEARCH` variable in the `buffalogs.env` file + * set the address of the host into the `CERTEGO_ELASTICSEARCH` variable in the `buffalogs.env` file * launch ` docker-compose up -d` to run the containers * if you have no hosts with Elasticsearch installed on it, you can run it directly with Buffalogs: * run `docker-compose -f docker-compose.yaml -f docker-compose.elastic.yaml up -d` in order to execute all the containers, included Elasticsearch and Kibana diff --git a/buffalogs/buffalogs/settings/certego.py b/buffalogs/buffalogs/settings/certego.py index 6359cc9..f8e1a77 100644 --- a/buffalogs/buffalogs/settings/certego.py +++ b/buffalogs/buffalogs/settings/certego.py @@ -18,7 +18,7 @@ if CERTEGO_BUFFALOGS_ENVIRONMENT == ENVIRONMENT_DOCKER: - CERTEGO_BUFFALOGS_ELASTICSEARCH = os.environ.get("CERTEGO_BUFFALOGS_ELASTICSEARCH", "http://elasticsearch:9200/") + CERTEGO_ELASTICSEARCH = os.environ.get("CERTEGO_ELASTICSEARCH", "http://elasticsearch:9200/") CERTEGO_BUFFALOGS_DB_HOSTNAME = "postgres" CERTEGO_DEBUG = False CERTEGO_BUFFALOGS_STATIC_ROOT = "/var/www/static/" @@ -27,7 +27,7 @@ CERTEGO_BUFFALOGS_RABBITMQ_URI = f"amqp://guest:guest@{CERTEGO_BUFFALOGS_RABBITMQ_HOST}/" elif CERTEGO_BUFFALOGS_ENVIRONMENT == ENVIRONMENT_DEBUG: - CERTEGO_BUFFALOGS_ELASTICSEARCH = os.environ.get("CERTEGO_BUFFALOGS_ELASTICSEARCH", "http://localhost:9200/") + CERTEGO_ELASTICSEARCH = os.environ.get("CERTEGO_ELASTICSEARCH", "http://localhost:9200/") CERTEGO_BUFFALOGS_DB_HOSTNAME = "localhost" CERTEGO_DEBUG = True CERTEGO_BUFFALOGS_STATIC_ROOT = "impossible_travel/static/" diff --git a/buffalogs/impossible_travel/tasks.py b/buffalogs/impossible_travel/tasks.py index a686875..75d9408 100644 --- a/buffalogs/impossible_travel/tasks.py +++ b/buffalogs/impossible_travel/tasks.py @@ -29,7 +29,7 @@ def clear_models_periodically(): UsersIP.objects.filter(updated__lte=delete_ip_time).delete() -@shared_task(name="UpdateRiskLevelTask") +@shared_task(name="BuffalogsUpdateRiskLevelTask") def update_risk_level(): """Update users risk level depending on how many alerts were triggered""" clear_models_periodically() @@ -218,7 +218,7 @@ def exec_process_logs(start_date, end_date): """ logger.info(f"Starting at:{start_date} Finishing at:{end_date}") config, op_result = Config.objects.get_or_create() - connections.create_connection(hosts=settings.CERTEGO_BUFFALOGS_ELASTICSEARCH, timeout=90, verify_certs=False) + connections.create_connection(hosts=settings.CERTEGO_ELASTICSEARCH, timeout=90, verify_certs=False) s = ( Search(index=settings.CERTEGO_BUFFALOGS_ELASTIC_INDEX) .filter("range", **{"@timestamp": {"gte": start_date, "lt": end_date}}) diff --git a/buffalogs/impossible_travel/views.py b/buffalogs/impossible_travel/views.py index db16a15..d819570 100644 --- a/buffalogs/impossible_travel/views.py +++ b/buffalogs/impossible_travel/views.py @@ -131,7 +131,7 @@ def get_users(request): def get_all_logins(request, pk_user): context = [] count = 0 - connections.create_connection(hosts=[settings.CERTEGO_BUFFALOGS_ELASTICSEARCH], timeout=90) + connections.create_connection(hosts=[settings.CERTEGO_ELASTICSEARCH], timeout=90) end_date = timezone.now() start_date = end_date + timedelta(days=-365) user_obj = User.objects.filter(id=pk_user) diff --git a/django-buffalogs/buffalogs.egg-info/PKG-INFO b/django-buffalogs/buffalogs.egg-info/PKG-INFO index cd01bfa..7057566 100644 --- a/django-buffalogs/buffalogs.egg-info/PKG-INFO +++ b/django-buffalogs/buffalogs.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: buffalogs -Version: 1.1.1 +Version: 1.2.1 Summary: A Django app to detect anomaly logins. Home-page: UNKNOWN Author: Lorena Goldoni diff --git a/django-buffalogs/setup.cfg b/django-buffalogs/setup.cfg index fa626f0..999981b 100644 --- a/django-buffalogs/setup.cfg +++ b/django-buffalogs/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = buffalogs -version = 1.2.0 +version = 1.2.1 description = A Django app to detect anomaly logins. long_description = file: README.rst author = Lorena Goldoni