Skip to content

Commit e4d2815

Browse files
committed
Architecture refactoring, .env configuration file and finalizing user registration and login
1 parent 6ca2c7d commit e4d2815

33 files changed

+1178
-145
lines changed

.env

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SENTINELKIT_FRONTEND_HOSTNAME=sentinel-kit.local
2+
SENTINELKIT_BACKEND_HOSTNAME=backend.sentinel-kit.local
3+
SENTINELKIT_PMA_HOSTNAME=phpmyadmin.sentinel-kit.local
4+
SENTINELKIT_KIBANA_HOSTNAME=kibana.sentinel-kit.local
5+
SENTINELKIT_GRAFANA_HOSTNAME=grafana.sentinel-kit.local
6+
SENTINELKIT_DATAMONITOR_SERVER_TOKEN=9561ffd1b6de615286b9e52a9d5bc3226970449700c9461bdbe4225730b47b20
7+
BACKEND_JWT_PASSPHRASE=f164cfc913d2faf65a1b7bc8ccd4aa8b11b5958bce7c20c8cf159a576f8a75f7
8+
MYSQL_ROOT_PASSWORD=sentinel-kit_r00tp4ssw0rd
9+
MYSQL_USER=sentinel-kit_user
10+
MYSQL_PASSWORD=sentinel-kit_passwd
11+
MYSQL_DATABASE=sentinel-kit_db
12+
GF_SECURITY_ADMIN_USER=sentinel-kit_grafana_admin
13+
GF_SECURITY_ADMIN_PASSWORD=sentinel-kit_grafana_password
14+
SFTP_USER=sentinel-kit_sftp_user
15+
SFTP_PASSWORD=sentinel-kit_sftp_passwd
16+
ELASTICSTACK_VERSION=9.2.0
17+
ELASTICSEARCH_CLUSTER_NAME=sentinel-kit-elasticsearch-cluster
18+
ELASTICSEARCH_LICENSE=basic
19+
ELASTICSEARCH_MEMORY_LIMIT=4294967296
20+
ELASTICSEARCH_PASSWORD=sentinelkit_elastic_passwd

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
/.env.local
22
/.env.local.php
33
/.env.*.local
4+
/config/certificates/caddy_server/*
5+
/config/certificates/elasticsearch/*
6+
/config/certificates/jwt/*
47
/config/yara_ruleset/*
58
/config/sigma_ruleset/*
9+
/data/caddy_logs/*
610
/data/ftp_data/*
711
/data/grafana/*
12+
/data/kibana/*
813
/data/log_ingest_data/*
914
/data/mysql_data/*
1015
/data/yara_triage_data/*
16+
/docs/graphs/*.bkp
1117
/sentinel-kit_server_frontend/node_modules/*
1218
/sentinel-kit_server_frontend/package-lock.json
1319
/sentinel-kit_server_backend/migrations/*

README.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
![Sentinel Kit](./.github/img/sentinel-kit_logo.png)
2-
# 🛡️ Sentinel Kit: The Simplified Platform for Incident Response (DFIR/SOC)
1+
![Sentinel Kit](docs/img/sentinel-kit_logo.png)
2+
# 🛡️ Sentinel Kit: The Simplified Platform for Incident Response (SOC & DFIR)
33

44
## WARNING: This project is currently in an early stage of development. Not all components have been ported to this repository, and the features are not yet stable enough for production use.
55
---
@@ -16,7 +16,7 @@ Sentinel Kit is an all-in-one toolkit that covers the entire security incident l
1616

1717
* **Log Collection & Parsing (SIEM Lite)**: Uses **Fluent Bit** for data ingestion and **Elasticsearch** for storage and indexing.
1818
* **Advanced Analysis & Triage**: Planned integration of **Sigma** rules for log-based detection and **YARA** for suspicious file triage (via upload mechanisms).
19-
* **Detection and Response (EDR)**: A dedicated agent (integrating into the ecosystem) is planned to provide real-time detection and response functionalities.
19+
* **Detection and Response (EDR)**: A dedicated agent (integrating into the ecosystem) provide real-time detection and response functionalities. In addition, this optional agent can act as a collection element to forward logs from your workstations to the sentinel-kit server.
2020
* **Secure Uploads**: Provides a dedicated **SFTP** server for uploading evidence, logs, or suspicious files.
2121
* **Comprehensive Visualization**: Monitoring dashboards via **Kibana** and **Grafana/Prometheus**.
2222

@@ -40,7 +40,17 @@ This project is designed to be deployed in minutes using Docker Compose.
4040
cd sentinel-kit
4141
```
4242

43-
2. **Launch the Stack:**
43+
2. **Set the following DNS entry (in hosts file if you are running it locally):**
44+
```bash
45+
# OS host file
46+
127.0.0.1 sentinel-kit.local
47+
127.0.0.1 backend.sentinel-kit.local
48+
127.0.0.1 phpmyadmin.sentinel-kit.local
49+
127.0.0.1 kibana.sentinel-kit.local
50+
127.0.0.1 grafana.sentinel-kit.local
51+
```
52+
53+
3. **Launch the Stack:**
4454
```bash
4555
docker-compose up -d
4656
```
@@ -60,10 +70,11 @@ Once the stack is running, you can access the interfaces via the default ports e
6070

6171
| Service | Role | Default Access |
6272
| :--- | :--- | :--- |
63-
| **Web Interface** (Frontend) | Access to the main application | `http://localhost:80` or `https://localhost:443` (via Caddy) |
64-
| **Kibana** | Exploration and visualization of Elastic logs | `http://localhost:5601` |
65-
| **Grafana** | Monitoring dashboards | `http://localhost:3000` |
66-
| **phpMyAdmin** | MySQL database management | `http://localhost:8080` |
73+
| **Web Interface** (Admin frontend) | Access to the admin application | `https://sentinel-kit.local` |
74+
| **Web API** | Used for clients<->server communications and admin actions over the web interface | `https://backend.sentinel-kit.local` |
75+
| **Kibana** | Exploration and visualization of Elastic logs | `http://kibana.sentinel-kit.local` |
76+
| **Grafana** | Monitoring dashboards | `http://grafana.sentinel-kit.local` |
77+
| **phpMyAdmin** | MySQL database management | `http://phpmyadmin.sentinel-kit.local` |
6778
| **SFTP Server** | Secure file/evidence upload | Port `2222` |
6879

6980
### Default Credentials (Utilities)
@@ -74,39 +85,23 @@ Once the stack is running, you can access the interfaces via the default ports e
7485
| **MySQL (DB)** | `sentinel-kit_user` | `sentinel-kit_passwd` |
7586
| **SFTP** | `sentinel-kit_ftp_user` | `sentinel-kit_ftp_passwd` |
7687

88+
All of this can be edited in `.env` file
89+
7790
---
7891

7992
## 🛠️ Technical Architecture (via `docker-compose.yml`)
8093

8194
The architecture is modular and relies on the interconnection of several services via the **sentinel-kit-network** network.
82-
83-
### Application Components
84-
85-
* `sentinel-kit-frontend-app`: User Interface.
86-
* `sentinel-kit-backend-app`: Business logic, API, and data management (depends on MySQL).
87-
* `sentinel-kit-ftp-server`: Entry point for manual file collection (evidence, YARA/Sigma files).
88-
* `sentinel-kit-caddy-server`: Reverse proxy managing HTTP/HTTPS access (ports 80/443) and routing to the frontend and backend.
89-
90-
### Collection & Storage Components
91-
92-
* `sentinel-kit-fluentbit-server`: Log collector (Ingestion on port `24224`) that sends data to Elasticsearch.
93-
* `sentinel-kit-elasticsearch-db`: Search and log storage engine.
94-
* `sentinel-kit-mysql-db`: Relational database (for the backend).
95-
96-
### Utility Components (Monitoring & DB)
97-
98-
* `sentinel-kit-kibana-utils`: Visualization of Elasticsearch data (log analysis).
99-
* `sentinel-kit-prometheus-utils`: Ingestion , parsing, and forwarding metrics collection.
100-
* `sentinel-kit-grafana-utils`: Metrics visualization (Prometheus) and potentially other data.
101-
* `sentinel-kit-phpmyadmin-utils`: Web interface for MySQL management (dev / admin).
95+
![Sentinel-Kit architecture](docs/img/sentinel-kit_network_flow.png)
10296

10397
## ⚙️ Configuration
10498

10599
Main configurations are located in the `config/` folder: (edit these elements only if you know what you are doing 😊)
106100

107-
* `config/fluentbit_server`: Fluent Bit configuration files (inputs, filters, outputs to Elasticsearch).
108101
* `config/caddy_server`: Reverse proxy that serve front and back-end web applications
102+
* `config/certificates`: Contains TLS certification chains for elasticstack, caddy and backend JWT
109103
* `config/docker-config`: Server stack configuration (dockerfile, entrypoints...).
104+
* `config/fluentbit_server`: Fluent Bit configuration files (inputs, filters, outputs to Elasticsearch).
110105
* `config/grafana`: Grafana initial setup (datasources and dashboards).
111106
* `config/prometheus/prometheus.yml`: Prometheus monitoring targets configuration.
112107
* `config/sigma_ruleset`: sigma rules used on elasticsearch ingested logs
@@ -116,8 +111,10 @@ Main configurations are located in the `config/` folder: (edit these elements on
116111

117112
Persistent data are located in the `data/` folder:
118113

114+
* `data/caddy_logs`: Store the caddy server access & error logs
119115
* `data/ftp_data`: Store file uploaded on the SFTP server
120116
* `data/grafana`: Contains a persistence of your grafana profile if you want to make your own dashboard and customizations
117+
* `data/kibana`: Kibana user customizations
121118
* `data/log_ingest_data`: Is designed to forward logs if you don't want to use fluentbit HTTP forwarder
122119
* `data/mysql_data`: Constains a persistence of the web backend database
123120
* `data/yara_triage_data`: is used to automatically scan any file placed in this folder
@@ -129,4 +126,15 @@ Persistent data are located in the `data/` folder:
129126
To stop and remove the containers, networks, and volumes created by Docker Compose:
130127
131128
```bash
132-
docker-compose down -v
129+
docker-compose down -v
130+
```
131+
132+
If you want to erase all user data:
133+
* remove the __content__ of every folder inside `data/`
134+
* remove the __content__ of `config/certificates/` in caddy_server, elasticsearch and jwt
135+
* remove the __content__ of `config/grafana`
136+
* finally, rebuild the stack with the following command:
137+
138+
```bash
139+
docker-compose up --build --force-recreate
140+
```

config/caddy_server/Caddyfile

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,81 @@
1-
:443, localhost {
2-
@not_api not path /api/*
1+
# TLS reverse proxy configuration
2+
{$SENTINELKIT_BACKEND_HOSTNAME}:443 {
3+
tls internal
34

4-
log /api/* {
5+
log {
56
output file /var/log/caddy/backend.log
7+
format json
68
}
79

8-
log @not_api {
10+
reverse_proxy sentinel-kit-app-backend:8000
11+
encode zstd gzip
12+
}
13+
14+
{$SENTINELKIT_FRONTEND_HOSTNAME}:443 {
15+
tls internal
16+
17+
log {
918
output file /var/log/caddy/frontend.log
19+
format json
1020
}
1121

12-
handle /api/* {
13-
reverse_proxy sentinel-kit-backend-app:8000
14-
}
22+
reverse_proxy sentinel-kit-app-frontend:3000
23+
encode zstd gzip
24+
}
25+
26+
{$SENTINELKIT_PMA_HOSTNAME}:443 {
27+
tls internal
1528

16-
handle /bundles/* {
17-
reverse_proxy sentinel-kit-backend-app:8000
29+
log {
30+
output file /var/log/caddy/phpmyadmin.log
31+
format json
1832
}
1933

20-
handle /_wdt/* {
21-
reverse_proxy sentinel-kit-backend-app:8000
34+
reverse_proxy sentinel-kit-utils-phpmyadmin:80
35+
encode zstd gzip
36+
}
37+
38+
{$SENTINELKIT_KIBANA_HOSTNAME}:443 {
39+
tls internal
40+
41+
log {
42+
output file /var/log/caddy/kibana.log
43+
format json
2244
}
2345

24-
handle /_profiler/* {
25-
reverse_proxy sentinel-kit-backend-app:8000
26-
}
27-
handle @not_api {
28-
reverse_proxy sentinel-kit-frontend-app:3000
46+
reverse_proxy sentinel-kit-utils-kibana:5601
47+
encode zstd gzip
48+
}
49+
50+
{$SENTINELKIT_GRAFANA_HOSTNAME}:443 {
51+
tls internal
52+
53+
log {
54+
output file /var/log/caddy/grafana.log
55+
format json
2956
}
30-
}
57+
58+
reverse_proxy sentinel-kit-utils-grafana:3000
59+
encode zstd gzip
60+
}
61+
62+
# HTTP to HTTPS redirection
63+
{$SENTINELKIT_BACKEND_HOSTNAME}:80 {
64+
redir https://{$SENTINELKIT_BACKEND_HOSTNAME}{uri}
65+
}
66+
67+
{$SENTINELKIT_FRONTEND_HOSTNAME}:80 {
68+
redir https://{$SENTINELKIT_FRONTEND_HOSTNAME}{uri}
69+
}
70+
71+
{$SENTINELKIT_PMA_HOSTNAME}:80 {
72+
redir https://{$SENTINELKIT_PMA_HOSTNAME}{uri}
73+
}
74+
75+
{$SENTINELKIT_KIBANA_HOSTNAME}:80 {
76+
redir https://{$SENTINELKIT_KIBANA_HOSTNAME}{uri}
77+
}
78+
79+
{$SENTINELKIT_GRAFANA_HOSTNAME}:80 {
80+
redir https://{$SENTINELKIT_GRAFANA_HOSTNAME}{uri}
81+
}

config/fluentbit_server/fluent-bit.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
[OUTPUT]
2626
Name es
2727
Match http.logs
28-
Host sentinel-kit-elasticsearch-db
28+
Host sentinel-kit-db-elasticsearch
2929
Port 9200
3030
Index essai
3131
Logstash_Format Off

config/grafana/datasources/elasticsearch.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
apiVersion: 1
22

33
datasources:
4-
- name: Elasticsearch-logs
4+
- name: Elasticsearch-logs-es01
55
type: elasticsearch
6-
url: http://sentinel-kit-elasticsearch-db:9200
6+
url: http://sentinel-kit-db-elasticsearch-es01:9200
7+
access: proxy
8+
isDefault: false
9+
version: 9
10+
database: '*'
11+
jsonData:
12+
esVersion: 90
13+
timeField: '@timestamp'
14+
maxConcurrentShardRequests: 5
15+
readOnly: false
16+
orgId: 1
17+
- name: Elasticsearch-logs-es02
18+
type: elasticsearch
19+
url: http://sentinel-kit-db-elasticsearch-es02:9200
720
access: proxy
821
isDefault: false
922
version: 9

config/grafana/datasources/prometheus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: 1
33
datasources:
44
- name: Prometheus-Fluentbit
55
type: prometheus
6-
url: http://sentinel-kit-prometheus-utils:9090
6+
url: http://sentinel-kit-utils-prometheus:9090
77
access: proxy
88
isDefault: true
99
version: 1

0 commit comments

Comments
 (0)