This repository contains the implementation developed for the Master's Thesis on the design and development of a cybersecurity model orchestration system.
The project is framed within the ECYSAP-EYE context and provides a software architecture to define, execute and monitor analytical pipelines composed of heterogeneous cybersecurity models.
The system is divided into four main components:
- Frontend: a web interface developed with Vue 3 and Vite that allows users to design pipelines, launch executions, monitor their status and visualise results.
- Backend: a service developed in Python with FastAPI that manages pipeline definitions, execution control, communication with Airflow and retrieval of execution data.
- Apache Airflow: the orchestration engine responsible for dynamically generating and executing DAGs from the pipeline definitions.
- Apache Kafka: the communication layer used to exchange execution requests, intermediate information and model results.
The general execution flow is:
Frontend
|
v
FastAPI Backend
|
v
Apache Airflow
|
v
Apache Kafka
|
v
Analytical Models
.
├── airflow-kafka/
│ ├── airflow/
│ │ └── dags/
│ │ ├── dag_factory.py
│ │ └── model_lib/
│ │ ├── MITRE/
│ │ │ ├── activity_details.json
│ │ │ ├── activity_exposure_scores.json
│ │ │ ├── approach_activity_mappings.json
│ │ │ ├── approach_details.json
│ │ │ ├── attack_mapping.json
│ │ │ ├── engage_mapper.py
│ │ │ ├── goal_approach_mappings.json
│ │ │ └── goal_details.json
│ │ ├── models/
│ │ │ ├── m23.py
│ │ │ └── m24.py
│ │ └── Translator/
│ │ ├── alert_processed.json
│ │ └── translator.py
│ ├── kafka/
│ └── Vagrantfile
├── backend/
├── public/
├── src/
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── index.html
├── jsconfig.json
├── package-lock.json
├── package.json
├── README.md
└── vite.config.js
The .vagrant/ directory is generated locally by Vagrant and should not be committed to the repository.
- Visual design of analytical pipelines.
- Validation of nodes and model connections.
- Execution control through a REST API.
- Monitoring of execution states, tasks and logs.
- Results visualisation through a dedicated view.
- Dynamic DAG generation with Apache Airflow.
- Communication with analytical models through Apache Kafka.
- Integration with the simulation microservice.
- Internal UUID management and user-friendly pipeline aliases.
The frontend is implemented with Vue 3 and built with Vite.
From the repository root:
npm installnpm run devnpm run buildIf Docker Compose is available, the frontend can also be launched as a container:
docker compose up -dBy default, the interface is exposed on port 10081.
The frontend communicates with the backend through the BACKEND_URL configured in the main views.
In the current development setup, the backend URL is:
http://localhost:5667
The frontend also uses the model and pipeline catalogues exposed by the backend.
The backend is implemented with FastAPI and is exposed on port 5667.
From the backend/ directory:
python3 -m venv venv
source venv/bin/activateOn Windows PowerShell:
python -m venv venv
.\venv\Scripts\Activate.ps1pip install -r requirements.txtuvicorn main:app --host 0.0.0.0 --port 5667The backend is responsible for:
- Loading available models and pipelines.
- Validating pipeline definitions.
- Registering and controlling executions.
- Managing pipeline UUIDs and visible aliases.
- Communicating with Apache Airflow.
- Synchronising execution states with the simulation microservice.
- Exposing execution status, tasks and logs.
- Storing execution data in memory during the current development stage.
The backend uses the model and pipeline catalogues stored in the backend/assets/ directory.
It also communicates with the Airflow environment through its REST API.
In the current setup, the Airflow base URL is:
http://138.4.21.13:19080
The default simulation service URL is:
http://simulation-core-service:8080/api/simulation-core-service
Apache Airflow is used as the orchestration engine.
The Airflow source files included in the repository are stored under:
airflow-kafka/airflow/dags/
The dag_factory.py file reads the pipeline definitions exposed by the backend and dynamically generates an Airflow DAG for each pipeline.
Each pipeline is represented as a directed acyclic graph in which:
- Each node represents an analytical model.
- Each edge represents a dependency between models.
- Independent branches can be executed in parallel.
- The state of every task can be monitored through Airflow.
The models used by the DAG factory are grouped under:
airflow-kafka/airflow/dags/model_lib/
The MITRE/ directory contains the engage_mapper.py model and the JSON datasets required for the MITRE Engage mapping process.
The Translator/ directory contains the alert translation model implemented in translator.py and its associated JSON data.
The models/ directory contains the scripts corresponding to the analytical models currently identified as m23 and m24.
Apache Kafka is used as the communication layer between Airflow and the analytical models.
Its responsibilities include:
- Publishing model execution requests.
- Transporting model input parameters.
- Receiving intermediate and final model results.
- Decoupling the orchestration engine from the analytical model implementations.
The Kafka configuration files are stored under:
airflow-kafka/kafka/
The current orchestration environment uses the following application topics:
| Topic | Purpose |
|---|---|
control_m23 |
Receives execution requests and input parameters for model M23. |
control_m24 |
Receives execution requests and input parameters for model M24. |
respuestas |
Collects the responses and execution results produced by the analytical models. |
Each topic has one partition and a replication factor of one, which is suitable for the single-broker development environment used in this project.
Kafka also creates internal system topics, such as __consumer_offsets, which are managed automatically and are not part of the application-level communication flow.
From inside the Kafka virtual machine, enter the Kafka directory:
cd ~/kafkaStart the containers:
docker compose up -dCheck that Kafka, ZooKeeper and Kafka UI are running:
docker psCreate the topic used by model M23:
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--create \
--if-not-exists \
--topic control_m23 \
--partitions 1 \
--replication-factor 1Create the topic used by model M24:
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--create \
--if-not-exists \
--topic control_m24 \
--partitions 1 \
--replication-factor 1Create the shared responses topic:
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--create \
--if-not-exists \
--topic respuestas \
--partitions 1 \
--replication-factor 1The three topics can also be created using a single loop:
for topic in control_m23 control_m24 respuestas; do
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--create \
--if-not-exists \
--topic "$topic" \
--partitions 1 \
--replication-factor 1
doneThe --if-not-exists option allows these commands to be executed multiple times without failing when a topic already exists.
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--listThe expected application topics are:
control_m23
control_m24
respuestas
Kafka may also display internal or legacy topics that are not part of the current application flow.
for topic in control_m23 control_m24 respuestas; do
echo "===== $topic ====="
docker exec kafka kafka-topics \
--bootstrap-server kafka:29092 \
--describe \
--topic "$topic"
doneRead messages published in the M23 control topic:
docker exec -it kafka kafka-console-consumer \
--bootstrap-server kafka:29092 \
--topic control_m23 \
--from-beginningRead messages published in the M24 control topic:
docker exec -it kafka kafka-console-consumer \
--bootstrap-server kafka:29092 \
--topic control_m24 \
--from-beginningRead the model responses:
docker exec -it kafka kafka-console-consumer \
--bootstrap-server kafka:29092 \
--topic respuestas \
--from-beginningPress Ctrl+C to stop the consumer.
Publish a message in the M23 control topic:
docker exec -it kafka kafka-console-producer \
--bootstrap-server kafka:29092 \
--topic control_m23Publish a message in the M24 control topic:
docker exec -it kafka kafka-console-producer \
--bootstrap-server kafka:29092 \
--topic control_m24Write the message and press Enter. Press Ctrl+C to close the producer.
The development environment uses Vagrant and VirtualBox to deploy two separate virtual machines.
| Virtual machine | Private IP | Forwarded host port |
|---|---|---|
airflow-mario |
192.168.60.30 |
19080 |
kafka-mario |
192.168.60.40 |
19081 |
From the airflow-kafka/ directory, start both machines:
vagrant up airflow-mario
vagrant up kafka-marioCheck their status:
vagrant statusAccess the Airflow virtual machine:
vagrant ssh airflow-marioAccess the Kafka virtual machine:
vagrant ssh kafka-marioStop the environment:
vagrant haltThe detailed Docker Compose configuration for Airflow and Kafka will be added to their corresponding directories.
The backend integrates the pipeline execution flow with simulation-core-service.
The integration supports:
- Assigning a pipeline UUID and alias to a simulation.
- Updating the visible pipeline alias.
- Starting a simulation.
- Pausing an execution.
- Resuming a paused execution.
- Stopping an execution.
- Resetting an execution to
Ready. - Archiving a simulation.
The UUID is used internally between services, while the alias is the identifier displayed to the user.
The execution states used by the system are:
Ready
Running
Paused
Aborted
Finished
Error
Archived
This project was developed as part of a Master's Thesis in Cybersecurity at ETSIT-UPM.
Its purpose is to provide a functional basis for orchestrating cybersecurity models in structured analytical pipelines, enabling reproducible execution, monitoring and decision support in mission-oriented cybersecurity scenarios.
This repository is intended for academic and research purposes.
A specific licence file should be added if the project is to be redistributed or reused outside this context.