chore: build

This commit is contained in:
Xor290
2026-10-26 21:01:06 +01:00
parent 8e36acd812
commit 1eeca2b368
52 changed files with 1206 additions and 253 deletions
+15 -1
View File
@@ -23,8 +23,9 @@ Firewall rules for monitoring stack with Wazuh, Dozzle, Beszel, and VPN infrastr
| 51820 | UDP | Any | WireGuard VPN | ALLOW |
| 443 | TCP | 10.0.0.0/24 | Wazuh Dashboard (VPN) | ALLOW |
| 8080 | TCP | 10.0.0.0/24 | Dozzle logs (VPN) | ALLOW |
| 8090 | TCP | 10.0.0.0/24 | Beszel monitoring (VPN) | ALLOW |
| 8090 | TCP | 10.0.0.0/24 | Beszel dashboard (VPN only, never public) | ALLOW |
| 9000-9001 | TCP | 10.0.0.0/24 | S3/RustFS (VPN) | ALLOW |
| 10002 | TCP | 176.116.0.189, 93.185.167.134, 185.139.215.125, 5.252.20.74 (k3s-prod, hors VPN) | Beszel agents k3s — `/api/` uniquement, voir nginx.conf | ALLOW |
### Outbound Rules (OUTPUT)
- **Default:** ACCEPT (all traffic allowed)
@@ -138,6 +139,19 @@ Beszel agents installed on all infrastructure servers:
**Note:** vpn-uber agent is accessible **only from VPN** due to firewall rules.
### k3s cluster (reverse direction)
Unlike the servers above (Hub connects OUT to the agent), the k3s DaemonSet
agents connect OUT to the Hub instead — cluster nodes aren't on the VPN mesh
and there's no single stable "agent" endpoint per pod to dial into. Hub's
reverse-connection port (10002, see nginx.conf) is exposed publicly but
restricted to the 4 k3s-prod node IPs + `/api/` path only — the dashboard
itself (8090) is never touched by this and stays VPN-only.
| Server | Type | Direction | Port | Access |
|--------|------|-----------|------|--------|
| k3s-prod (4 nodes) | Kubernetes DaemonSet | Agent → Hub | 10002 (Hub side) | Hub's public IP, restricted to the 4 node IPs (see `omnex/ansible/inventory/host.ini`) |
---
## Troubleshooting
@@ -23,6 +23,7 @@ services:
- "10.0.0.2:8080:8080"
- "10.0.0.2:8090:8090"
- "10.0.0.2:3001:3001"
- "10002:10002"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/certs:/etc/nginx/certs:ro
@@ -64,6 +65,11 @@ services:
hostname: wazuh.manager
container_name: wazuh_manager
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "20m"
max-file: "5"
ulimits:
memlock:
soft: -1
@@ -123,7 +129,7 @@ services:
soft: 65536
hard: 65536
environment:
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g"
- INDEXER_PASSWORD=${WAZUH_INDEXER_PASSWORD}
volumes:
- wazuh_indexer_data:/var/lib/wazuh-indexer
@@ -70,6 +70,19 @@ iptables -A INPUT -p tcp --dport 8090 -s 10.0.0.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 9000 -s 10.0.0.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 9001 -s 10.0.0.0/24 -j ACCEPT
# ─── Agents Beszel k3s (10002, hors VPN) ───────────────────────
# Nœuds k3s-prod : pas sur le VPN (voir omnex/ansible/inventory/host.ini),
# seule voie possible = leur IP publique. Restreint à ces 4 IP précises
# (pas 0.0.0.0/0) ; nginx filtre en plus par chemin (/api/ uniquement,
# voir nginx.conf) — le dashboard Beszel (8090) reste VPN-only, inchangé.
iptables -A INPUT -p tcp --dport 10002 -s 176.116.0.189 -j ACCEPT # master-k3s
iptables -A INPUT -p tcp --dport 10002 -s 93.185.167.134 -j ACCEPT # slave-1-k3s
iptables -A INPUT -p tcp --dport 10002 -s 185.139.215.125 -j ACCEPT # slave-2-k3s
iptables -A INPUT -p tcp --dport 10002 -s 5.252.20.74 -j ACCEPT # slave-3-k3s
iptables -A INPUT -p tcp --dport 1514 -s 176.116.0.189 -j ACCEPT # master-k3s
iptables -A INPUT -p tcp --dport 1514 -s 93.185.167.134 -j ACCEPT # slave-1-k3s
iptables -A INPUT -p tcp --dport 1514 -s 185.139.215.125 -j ACCEPT # slave-2-k3s
iptables -A INPUT -p tcp --dport 1514 -s 5.252.20.74 -j ACCEPT # slave-3-k3s
# ─── ICMP ─────────────────────────────────────────────────────
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
@@ -95,8 +108,9 @@ echo " • Wazuh 1514/tcp FROM pre-prod (185.103.166.112) — agents Wazuh"
echo " • VPN 51820/udp — WireGuard"
echo " • Wazuh Dashboard 443/tcp FROM 10.0.0.0/24 (VPN)"
echo " • Dozzle 8080/tcp FROM 10.0.0.0/24 (VPN)"
echo " • Beszel 8090/tcp FROM 10.0.0.0/24 (VPN)"
echo " • Beszel 8090/tcp FROM 10.0.0.0/24 (VPN) — dashboard, jamais public"
echo " • S3/RustFS 9000-9001/tcp FROM 10.0.0.0/24 (VPN)"
echo " • Beszel agents k3s 10002/tcp FROM les 4 IP publiques des nœuds k3s-prod"
echo " • OUTPUT (Internet/DNS)"
echo ""
echo "Règles appliquées (DENY) :"
+46
View File
@@ -59,6 +59,52 @@ http {
}
}
# ── Beszel agents k3s (10002, public) ────────────────────
# Port DÉDIÉ aux agents Beszel du cluster k3s (hors VPN, pas d'autre
# moyen de les joindre) — distinct du 8090 (dashboard, VPN uniquement).
# Même backend (beszel:8090), mais restreint :
# - IP source : uniquement les 4 nœuds k3s (pas 0.0.0.0/0)
# - Chemin : uniquement /api/ (enregistrement + heartbeat des agents),
# tout le reste (dashboard, admin PocketBase sous /_/) renvoie 403 —
# à VÉRIFIER après coup (voir access_log) que les agents n'appellent
# pas un chemin hors /api/ non couvert ici.
server {
listen 10002 ssl;
server_name _;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/log/nginx/beszel_agents_access.log;
error_log /var/log/nginx/beszel_agents_error.log;
# Nœuds k3s-prod (voir omnex/ansible/inventory/host.ini) — aucun
# autre client de ce port.
allow 176.116.0.189; # master-k3s
allow 93.185.167.134; # slave-1-k3s
allow 185.139.215.125; # slave-2-k3s
allow 5.252.20.74; # slave-3-k3s
deny all;
location /api/ {
proxy_pass http://beszel:8090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600s;
}
location / {
return 403;
}
}
# ── Wazuh (443) ──────────────────────────────────────────
server {
listen 443 ssl default_server;