Git Product home page Git Product logo

mongodbdetect's Introduction

Detection-as-Code with MongoDB Change Streams

This repository is an example implementation of a monitoring system that implements detection-as-code principles with Python and MongoDB with Change Streams. The examples contain an agent to collect and forward logs, an engine to process the logs and alert if desired, and rule files to be loaded by the detection engine.

Slides

Slides are available here.

Environment Variables

These environment variables are all needed for the detection engine to function.

The monitoring agent reuiqres the variables prefixed with CHANGE_.

export ALERT_COLLECTION_NAME=alert 
export CONFIG_COLLECTION_NAME=configuration
export CHANGE_COLLECTION_NAME=process
export CHANGE_DB_NAME=monitoring                      
export CHANGE_STREAM_DB="mongodb://localhost:27017"

Running the Engine

python engine/detection.py

Running the Agent

The agent requires sudo privileges due to the eBPF portion of the code.

sudo -E python collection/agent.py

Running the Tests

There is a small config portion for pytest in pyproject.toml.

pytest

Directory

.
├── collection
│   └── agent.py
├── engine
│   ├── detection.py
│   ├── __init__.py
│   ├── rule.py
│   └── tests
│       ├── __init__.py
│       └── test_engine.py
├── infra
│   ├── docker-compose.yml
│   ├── init.js
│   └── initRS.sh
├── LICENSE
├── MongoDB-and-DaC.pdf
├── pyproject.toml
├── readme.md
└── rules
    ├── shadow.py
    ├── shadow.yaml
    └── tmp_output_redir.yaml

mongodbdetect's People

Contributors

latonis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.