How certsocietegenerale/fir works
Project type and purpose
• FIR is a full-stack, monolithic Django web application (Python) for cybersecurity incident management.
• It comprises many loosely coupled “apps” (fir_abuse, fir_alerting, fir_api, fir_artifacts, fir_auth_2fa, etc.) that each implement a distinct feature set (abuse handling, alerting, REST API, artifacts management, 2FA, etc.).
• It’s deployed via Docker (docker-compose), uses Nginx as a reverse proxy, Gunicorn (WSGI) or Django’s wsgi module to serve Python code, MySQL (or any Django-compatible RDBMS) for data persistence, and Celery for asynchronous tasks.
File structure for architectural cues
• Top-level “fir” folder: Django project settings, URL routing, WSGI entry-point.
• A set of directories each named fir_<feature>: each is a Django app containing models, views, templates, static assets (js/css), migrations, URLs.
• “fir_api”: the REST API module (serializers, permissions, authentication).
• “fir_celery”: Celery configuration and task definitions (celeryconf.py).
• Docker folder: Dockerfile, docker-compose.yml, environment files, Nginx config.
• “incidents”: the core incident-tracking app with its own URL space, forms, custom authorization backends.
• “uploads”: filesystem storage for user-uploaded files (artifacts).
• requirements.txt for Python dependencies.
README for additional insights
• Confirms Django + Bootstrap + Ajax stack.
• Recommends MySQL, but any Django-supported driver works.
• Deployment modes: Docker for quick start; production installation via the wiki.
• Non-greedy resource usage: small VM footprint.
a. Main components
• Client (browser)
• Nginx reverse proxy (docker/nginx.conf)
• Django application (Gunicorn or uWSGI serving the fir WSGI module)
• Django apps modules (e.g., fir_abuse, fir_alerting, fir_api, incidents, etc.)
• Celery worker
• Message broker (Redis or RabbitMQ)
• Database (MySQL)
• Filesystem storage (uploads directory)
• External services: SMTP server for email, LDAP/ OIDC provider for authentication, optional 2FA services
b. Relationships and interactions
• Browser → Nginx (HTTP/HTTPS)
• Nginx → Gunicorn/Wsgi → Django apps
• Django ORM → MySQL
• Django → Celery (enqueue tasks via broker)
• Celery worker ↔ broker ↔ Django tasks → MySQL or file storage
• Django (or Celery) → SMTP (email notifications via fir_email, fir_notifications)
• Django → External auth providers (LDAP, OIDC)
• Static file requests → Nginx directly serves /static and /uploads
c. Architectural patterns / design principles
• Monolithic, modular Django “app” pattern (each feature as an independent app).
• MVC (Django’s MTV) architecture: Models (database schemas), Templates (UI), Views (business logic).
• Plugin/extension pattern: core “fir_plugins” app uses hooks, signals, management commands — enables third-party extensions.
• Asynchronous processing via Celery to offload long-running tasks (email sending, artifact enrichment tasks, notifications).
• Configuration separation: local (base.py, production.py), multiple environments via composeprod.
d. Key technologies/frameworks
• Python 3.x, Django
• Gunicorn or uWSGI (WSGI server)
• Nginx (reverse proxy / static files)
• MySQL (or any Django-compatible RDBMS)
• Celery + broker (Redis/RabbitMQ)
• Docker & Docker Compose
• Bootstrap, jQuery/vanilla Ajax for UI
• LDAP/OIDC backends, 2FA library for authentication