-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from secureworks/pilot
Merge release 3.4.2 from pilot branch to master branch. See CHANGELOG for details.
- Loading branch information
Showing
27 changed files
with
3,572 additions
and
1,655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "master", "pilot" ] | ||
pull_request: | ||
branches: [ "master", "pilot" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
make venv | ||
- name: Run the lint checker | ||
run: | | ||
make lint | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
make venv | ||
- name: Run the tests | ||
run: | | ||
make test | ||
docker-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run the hadolint tool on the Dockerfile files | ||
run: | | ||
make hadolint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,3 +149,35 @@ Zeek Enhancements (#177) | |
|
||
Author: Nikhileswar Reddy <[email protected]> | ||
|
||
3.4.0 (2024-11-12) | ||
################## | ||
|
||
Version 3.4.x is available initially on the pilot branch, | ||
in a sort of pre-release mode. | ||
|
||
* Use pyproject.toml (#184) (#189) | ||
* Use ruff format to format the code (#183) (#190) | ||
* Use ruff check --fix to make style changes (#183) (#192) | ||
* Add github actions CI (#191) (#193) | ||
* Be able to run unit tests on dalton and flowsynth (#182) (#194) | ||
* Update nginx from 1.19 to 1.27 (#200) (#202) | ||
* Update redis from 3.2 to 7.4 (#201) | ||
* Add unit tests for flowsynth (#204) | ||
* Use ruff to sort and format imports (#207) | ||
* Use ruff to detect flake8 bugbears (B) (#209) | ||
* Use pre-built zeek images (#181) | ||
* Use bump-my-version to update the version and tag (#197) | ||
* Also, use bump-my-version to update the dalton-agent version | ||
* Also, show the dalton controller version on the About page | ||
|
||
3.4.1 (2024-11-14) | ||
################## | ||
|
||
* Fixed bug with zeek processing. (#213) (#214) (#216) | ||
* Added some unit tests. (#203) (#215) | ||
|
||
3.4.2 (2024-11-15) | ||
################## | ||
|
||
* Updated flask dependencies (#180) (#222) | ||
* Configure flask maximum content length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
FROM python:3.9.0 | ||
MAINTAINER David Wharton | ||
FROM python:3.10.15 | ||
|
||
# wireshark needed for mergecap; statically compiled | ||
# mergecap would be smaller but doing this for now | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install wireshark-common \ | ||
p7zip-full | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update -y && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
wireshark-common \ | ||
p7zip-full \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# for development; not needed by the app | ||
#RUN apt-get install -y less nano net-tools | ||
|
||
WORKDIR /opt/dalton | ||
|
||
COPY requirements.txt /opt/dalton/requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
COPY pyproject.toml /opt/dalton | ||
COPY app /opt/dalton/app | ||
RUN pip install --no-cache-dir -e . | ||
COPY run.py /opt/dalton/run.py | ||
COPY dalton.conf /opt/dalton/dalton.conf | ||
COPY rulesets /opt/dalton/rulesets | ||
COPY engine-configs /opt/dalton/engine-configs | ||
|
||
CMD python /opt/dalton/run.py -c /opt/dalton/dalton.conf | ||
STOPSIGNAL SIGINT | ||
EXPOSE 8080 | ||
|
||
# Note: if changing the next line, also look to change the command in docker-compose.yml | ||
CMD ["flask", "--app", "app", "run", "--port=8080", "--host=0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
VENV := $(or ${VENV},${VENV},$(CURDIR)/.venv) | ||
PIP=$(VENV)/bin/pip | ||
PYTHON=$(VENV)/bin/python | ||
PYTEST=$(VENV)/bin/pytest | ||
COVERAGE=$(VENV)/bin/coverage | ||
RUFF=$(VENV)/bin/ruff | ||
ACTIVATE=$(VENV)/bin/activate | ||
BUMPVERSION=$(VENV)/bin/bump-my-version | ||
BUMPPART ?= patch | ||
|
||
venv $(VENV): | ||
python3 -m venv $(VENV) | ||
$(PIP) install --upgrade pip wheel | ||
$(PIP) install -e . -e ".[testing]" -e ".[devtools]" | ||
|
||
test: $(VENV) | ||
. $(ACTIVATE) && $(PYTEST) tests | ||
|
||
coverage: $(VENV) | ||
. $(ACTIVATE) && $(COVERAGE) run -m pytest tests | ||
$(COVERAGE) report | ||
|
||
lint: $(VENV) | ||
$(RUFF) format --check | ||
$(RUFF) check | ||
|
||
fix: $(VENV) | ||
$(RUFF) format | ||
$(RUFF) check --fix | ||
|
||
hadolint: Dockerfile-dalton Dockerfile-nginx dalton-agent/Dockerfiles/Dockerfile_* | ||
docker run -t --rm -v `pwd`:/app -w /app hadolint/hadolint /bin/hadolint $^ | ||
|
||
bumpversion: $(VENV) pyproject.toml | ||
$(BUMPVERSION) bump $(BUMPPART) | ||
|
||
bumpagent: $(VENV) pyproject.toml | ||
$(BUMPVERSION) bump --config-file dalton-agent/.bumpversion.toml $(BUMPPART) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import logging | ||
import os | ||
|
||
from flask import Flask | ||
|
||
from app.dalton import dalton_blueprint, ensure_rulesets_exist, setup_dalton_logging | ||
from app.flowsynth import flowsynth_blueprint, setup_flowsynth_logging | ||
|
||
__version__ = "3.4.2" | ||
|
||
|
||
def create_app(test_config=None): | ||
"""Create the flask app.""" | ||
curdir = os.path.dirname(os.path.abspath(__file__)) | ||
static_folder = os.path.join(curdir, "static") | ||
daltonfs = Flask("app", static_folder=static_folder) | ||
if test_config: | ||
# load the test config if passed in | ||
daltonfs.config.from_mapping(test_config) | ||
|
||
if not daltonfs.testing: | ||
setup_dalton_logging() | ||
setup_flowsynth_logging() | ||
ensure_rulesets_exist() | ||
|
||
# register modules | ||
# | ||
# dalton | ||
daltonfs.register_blueprint(dalton_blueprint) | ||
|
||
# flowsynth | ||
daltonfs.register_blueprint(flowsynth_blueprint, url_prefix="/flowsynth") | ||
|
||
daltonfs.debug = True | ||
|
||
# Apparently the werkzeug default logger logs every HTTP request | ||
# which bubbles up to the root logger and gets output to the | ||
# console which ends up in the docker logs. Since each agent | ||
# checks in every second (by default), this can be voluminous | ||
# and is superfluous for my current needs. | ||
try: | ||
logging.getLogger("werkzeug").setLevel(logging.ERROR) | ||
except Exception: | ||
pass | ||
|
||
# Allow the user or the agent to upload large files | ||
daltonfs.config["MAX_CONTENT_LENGTH"] = 1024 * 1024 * 1024 | ||
daltonfs.config["MAX_FORM_MEMORY_SIZE"] = None | ||
|
||
return daltonfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.