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 requirements.txt and dockerfiles #170

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/Dockerfile.bots
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.collectors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.11-alpine3.18 AS production

WORKDIR /app/

Expand Down
54 changes: 5 additions & 49 deletions docker/Dockerfile.presenters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine3.14 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.7-alpine3.14 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand All @@ -20,59 +20,15 @@ RUN \
apk add --no-cache \
libpng \
libjpeg \
wkhtmltopdf
py3-gobject3 \
pango

# install fonts
RUN \
apk add --no-cache \
msttcorefonts-installer \
fontconfig \
font-noto \
font-noto-adlam \
font-noto-adlamunjoined \
font-noto-arabic \
font-noto-armenian \
font-noto-avestan \
font-noto-bamum \
font-noto-bengali \
font-noto-buhid \
font-noto-carian \
font-noto-chakma \
font-noto-cherokee \
font-noto-cypriot \
font-noto-deseret \
font-noto-devanagari \
font-noto-ethiopic \
font-noto-extra \
font-noto-georgian \
font-noto-glagolitic \
font-noto-gothic \
font-noto-gujarati \
font-noto-gurmukhi \
font-noto-hebrew \
font-noto-kannada \
font-noto-kayahli \
font-noto-khmer \
font-noto-lao \
font-noto-lisu \
font-noto-malayalam \
font-noto-mandaic \
font-noto-myanmar \
font-noto-nko \
font-noto-olchiki \
font-noto-oldturkic \
font-noto-oriya \
font-noto-osage \
font-noto-osmanya \
font-noto-shavian \
font-noto-sinhala \
font-noto-tamil \
font-noto-telugu \
font-noto-thaana \
font-noto-thai \
font-noto-tibetan \
font-noto-tifinagh \
font-noto-vai \
font-noto-all \
terminus-font \
ttf-opensans \
font-bakoma \
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.publishers
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-alpine3.17 AS build_shared
FROM python:3.12-alpine3.18 AS build_shared

WORKDIR /build_shared/

Expand All @@ -8,7 +8,7 @@ RUN python -m build



FROM python:3.9-alpine3.17 AS production
FROM python:3.12-alpine3.18 AS production

WORKDIR /app/

Expand All @@ -25,9 +25,9 @@ RUN pip install --no-cache-dir ./custom_packages/taranis_ng_shared-*.whl && rm -

COPY ./src/publishers/requirements.txt /app/requirements.txt
RUN apk add --no-cache \
swig\
swig \
libmagic \
gnupg
gnupg

RUN \
apk add --no-cache --virtual .build-deps build-base \
Expand Down
15 changes: 13 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ entrypoint, and the [gunicorn](https://gunicorn.org/) configuration file.
## Prerequisites

- [Docker](https://docs.docker.com/engine/install/)
- [docker-compose](https://docs.docker.com/compose/install/) >= 1.27.0
- [docker-compose](https://docs.docker.com/compose/install/) >= 1.27.0 (In July 2023, Compose V1 has been deprecated)
or
- [Compose V2](https://docs.docker.com/compose/migrate/), which is part of standard installation of Docker Engine
- (Optional) [Vim](https://www.vim.org/) or other text editor - for configuration and development

Please note it is important to use the abovementioned version of
`docker-compose` or newer, otherwise the build and deploy will fail.

## Quickly build and run Taranis NG using `docker-compose`
## Quickly build and run Taranis NG using `docker-compose` or `docker compose`

_First_, you need to clone the source code repository:

Expand All @@ -66,12 +68,21 @@ _Finally_, either deploy the ready-made images from Docker hub with:
docker-compose -f docker/docker-compose.yml pull
docker-compose -f docker/docker-compose.yml up --no-build
```
or
```bash
docker compose -f docker/docker-compose.yml pull
docker compose -f docker/docker-compose.yml up --no-build
```

or, alternatively, build and run the containers with:

```bash
TARANIS_NG_TAG=build docker-compose -f docker/docker-compose.yml up --build --pull
```
or
```bash
TARANIS_NG_TAG=build docker compose -f docker/docker-compose.yml up --build --pull
```
(`--pull` updates the base images)

**Voila, Taranis NG is up and running. Visit your instance by navigating to
Expand Down
35 changes: 11 additions & 24 deletions src/bots/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
certifi==2019.11.28
Flask==1.1.4
Flask-Cors==3.0.10
Flask-RESTful==0.3.7
gevent==21.8.0
greenlet==1.1.1
gunicorn==20.0.4
idna==2.8
marshmallow==3.18.0
Flask==3.0.0
Flask-Cors==4.0.0
Flask-RESTful==0.3.10
gevent==23.9.1
gunicorn==21.2.0
marshmallow==3.20.1
marshmallow-enum==1.5.1
Jinja2==2.11.3
MarkupSafe==1.1.0
oauthlib==3.1.0
oauthlib==3.2.2
PySocks==1.7.1
python-dateutil==2.8.1
python-dotenv==0.10.5
pytz==2019.3
requests==2.26.0
requests-oauthlib==1.3.0
schedule==0.6.0
six==1.14.0
sseclient-py==1.7
tweepy==3.8.0
urllib3==1.26.7
Werkzeug==0.16.0
zipp==3.1.0
python-dotenv==1.0.0
requests==2.31.0
schedule==1.2.1
sseclient-py==1.8.0
46 changes: 18 additions & 28 deletions src/collectors/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
beautifulsoup4==4.8.1
bleach==4.1.0
certifi==2021.10.8
feedparser==5.2.1
Flask==1.1.4
Flask-Cors==3.0.10
Flask-RESTful==0.3.7
gevent==21.8.0
greenlet==1.1.1
gunicorn==20.0.4
lxml==4.6.5
marshmallow==3.18.0
aiohttp==3.8.5
beautifulsoup4==4.12.2
bleach==6.0.0
dateparser==1.1.8
feedparser==6.0.10
Flask==3.0.0
Flask-Cors==4.0.0
Flask-RESTful==0.3.10
gevent==23.9.1
gunicorn==21.2.0
marshmallow==3.20.1
marshmallow-enum==1.5.1
Jinja2==2.11.3
MarkupSafe==1.1.0
pyslack==0.5.0
PySocks==1.7.1
python-dateutil==2.8.1
python-dotenv==0.10.5
pytz==2019.3
requests==2.26.0
schedule==0.6.0
selenium==4.0.0
six==1.14.0
slackclient==1.0.7
soupsieve==1.9.5
tweepy==3.8.0
Werkzeug==0.16.0
zipp==3.1.0
dateparser==1.1.1
python-dateutil==2.8.2
python-dotenv==1.0.0
requests==2.31.0
schedule==1.2.1
selenium==4.13.0
slackclient==1.3.2
tweepy==4.14.0
22 changes: 17 additions & 5 deletions src/presenters/managers/auth_manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""Authentication manager for the API.

Returns:
_type_: _description_
"""
from functools import wraps
from flask import request
import os
import ssl

api_key = os.getenv('API_KEY')
api_key = os.getenv("API_KEY")

if os.getenv('SSL_VERIFICATION') == "False":
if os.getenv("SSL_VERIFICATION") == "False":
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
Expand All @@ -15,11 +20,18 @@


def api_key_required(fn):
"""Check if the API key is valid.

Args:
fn (function): _description_
Returns:
_type_: _description_
"""

@wraps(fn)
def wrapper(*args, **kwargs):

if not request.headers.has_key('Authorization') or request.headers['Authorization'] != ('Bearer ' + api_key):
return {'error': 'not authorized'}, 401
if "Authorization" not in request.headers or request.headers["Authorization"] != ("Bearer " + api_key):
return {"error": "not authorized"}, 401
else:
return fn(*args, **kwargs)

Expand Down
Loading
Loading