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

Add Python module to accomplish OCSF compliant events #159

Merged
merged 35 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
159adcb
Adding Python script that receives a continuous json stream over stdi…
f-galland Feb 5, 2024
6e17aae
Adding logstash pipeline for python script
f-galland Feb 5, 2024
a05c23c
encode_parquet() function fixed to handle lists of dictionaries
f-galland Feb 6, 2024
e04f0d5
Correct error in encode_parquet()
f-galland Feb 6, 2024
93935fc
Avoid storing the block ending in the output buffer
f-galland Feb 6, 2024
1db384c
Add comments on handling files and streams with pyarrow for future re…
f-galland Feb 6, 2024
c60045f
Add s3 handling reference links
f-galland Feb 6, 2024
8949097
Write parquet directly to bucket
f-galland Feb 6, 2024
eb7ace3
Added basics of map_to_ocsf() function
f-galland Feb 7, 2024
3d7b8ff
Minor fixes
f-galland Feb 7, 2024
545f855
Map alerts to OCSF as they are read
f-galland Feb 7, 2024
f753b12
Add script to convert Wazuh events to OCSF
AlexRuiz7 Feb 8, 2024
dcc119e
Add OCSF converter + Parquet encoder + test scripts
AlexRuiz7 Feb 9, 2024
5c5ff24
Update .gitignore
AlexRuiz7 Feb 9, 2024
a39ef90
Include the contents of the alert under unmapped
f-galland Feb 8, 2024
97725bc
Add support for different OCSF schema versions
f-galland Feb 8, 2024
e313572
Use custom ocsf module to map alerts
f-galland Feb 15, 2024
4896d15
Modify script to use converter class
f-galland Feb 15, 2024
7fd25d1
Code polish and fix errors
f-galland Feb 16, 2024
e06203c
Remove unnecessary type declaration from debug flag
f-galland Feb 16, 2024
6826e12
Improved parquet encoding
f-galland Feb 16, 2024
9cfc247
Initial commit for test env's docker-compose.yml
f-galland Feb 19, 2024
324d1f5
Remove sudo references from docker-compose.yml
f-galland Feb 19, 2024
cb5ac73
Add operational Python module to transform events to OCSF
AlexRuiz7 Feb 21, 2024
05ae2d1
Create minimal Docker environment to test and develop the integration.
AlexRuiz7 Feb 22, 2024
17f47ca
Fix events-generator's Inventory starvation
AlexRuiz7 Feb 22, 2024
204948f
Remove files present in #147
AlexRuiz7 Feb 22, 2024
5fcc9a3
Cleanup
AlexRuiz7 Feb 22, 2024
a246410
Add FQDN hostnames to services for certificates creation
AlexRuiz7 Feb 22, 2024
b72d2b5
Add S3 Ninja (Mock) (#165)
AlexRuiz7 Feb 29, 2024
349f634
Merge branch '4.9.0' into 156-ocsf-compliant-events
AlexRuiz7 Feb 29, 2024
90cb9ab
Setup certificates in Wazuh Indexer and Logstash containers (#166)
f-galland Feb 29, 2024
c111dee
Fix Logstash pipelines
AlexRuiz7 Feb 29, 2024
b84ff0b
Remove unused file
AlexRuiz7 Feb 29, 2024
1210c07
Implement OCSF severity normalize function
AlexRuiz7 Mar 1, 2024
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
6 changes: 6 additions & 0 deletions integrations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
elastic
opensearch
splunk
common
config
docker/certs
37 changes: 37 additions & 0 deletions integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Wazuh indexer integrations

This folder contains integrations with third-party XDR, SIEM and cybersecurity software.
The goal is to transport Wazuh's analysis to the platform that suits your needs.

### Amazon Security Lake

Amazon Security Lake automatically centralizes security data from AWS environments, SaaS providers,
on premises, and cloud sources into a purpose-built data lake stored in your account. With Security Lake,
you can get a more complete understanding of your security data across your entire organization. You can
also improve the protection of your workloads, applications, and data. Security Lake has adopted the
Open Cybersecurity Schema Framework (OCSF), an open standard. With OCSF support, the service normalizes
and combines security data from AWS and a broad range of enterprise security data sources.

##### Usage

A demo of the integration can be started using the content of this folder and Docker.

```console
docker compose -f ./docker/amazon-security-lake.yml up -d
```

This docker compose project will bring a *wazuh-indexer* node, a *wazuh-dashboard* node,
a *logstash* node and our event generator. On the one hand, the event generator will push events
constantly to the indexer. On the other hand, logstash will constantly query for new data and
deliver it to the integration Python program, also present in that node. Finally, the integration
module will prepare and send the data to the Amazon Security Lake's S3 bucket.
<!-- TODO continue with S3 credentials setup -->

For production usage, follow the instructions in our documentation page about this matter.
(_when-its-done_)

As a last note, we would like to point out that we also use this Docker environment for development.

### Other integrations

TBD
180 changes: 180 additions & 0 deletions integrations/amazon-security-lake/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
wazuh-event.ocsf.json
*.parquet
Dockerfile

# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
Loading