diff --git a/monitoring/security/VPN_SETUP.md b/monitoring/security/VPN_SETUP.md index 46e11073..ab484e97 100644 --- a/monitoring/security/VPN_SETUP.md +++ b/monitoring/security/VPN_SETUP.md @@ -137,27 +137,78 @@ docker compose -f docker-compose-security.yml up -d docker ps ``` -### Phase 6: Create Admin VPN Clients +### Phase 6: Ajouter un admin VPN + +La clé privée ne doit **jamais quitter la machine de l'admin**. La procédure se fait en deux temps. + +#### Étape A — Sur la machine de l'admin (à faire par l'admin) + +Installer WireGuard si besoin : +- Windows/Mac : https://www.wireguard.com/install/ +- Linux : `sudo apt install wireguard` + +Générer les clés **localement** : ```bash -# Generate config for each admin -chmod +x /path/to/wireguard-admin-client.sh +# Linux / Mac +wg genkey | tee privatekey | wg pubkey > publickey +cat privatekey # à garder secret +cat publickey # à envoyer à l'administrateur VPN +``` -# Syntax: wireguard-admin-client.sh -./wireguard-admin-client.sh admin1 123.45.67.89 "aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890AbCdE=" -./wireguard-admin-client.sh admin2 123.45.67.89 "aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890AbCdE=" +```powershell +# Windows (PowerShell, WireGuard installé) +cd "C:\Program Files\WireGuard" +.\wireguard.exe /genkey | Out-File -Encoding ascii privatekey.txt +Get-Content privatekey.txt | .\wireguard.exe /pubkey | Out-File -Encoding ascii publickey.txt +type publickey.txt # à envoyer à l'administrateur VPN +``` -# Output: admin1.conf, admin2.conf +Créer le fichier de config `admin_nom.conf` **sur sa machine** : -# For each admin, add to VPN server: -ssh root@ -wg set wg0 peer allowed-ips 10.0.0.3/32 -wg set wg0 peer allowed-ips 10.0.0.4/32 +```ini +[Interface] +Address = 10.0.0.X/32 # IP assignée par l'administrateur VPN +PrivateKey = +DNS = 8.8.8.8 -# Verify +[Peer] +PublicKey = VQa6g1foaXhJgYWbwyJ9R/EAmmXg0nOnhPhbIIPLlmg= +AllowedIPs = 10.0.0.0/24 +Endpoint = 45.150.111.158:51820 +PersistentKeepalive = 25 +``` + +Importer ce fichier dans l'app WireGuard → **Tunnel prêt, pas encore actif**. + +#### Étape B — Sur le serveur VPN (à faire par l'administrateur) + +L'admin envoie sa **clé publique** et l'administrateur l'ajoute : + +```bash +ssh root@45.150.111.158 + +# Assigner une IP libre (voir tableau ci-dessous) et ajouter le peer +wg set wg0 peer allowed-ips 10.0.0.X/32 + +# Persister la config (survie au reboot) +wg-quick save wg0 + +# Vérifier wg show ``` +L'admin peut maintenant activer le tunnel dans l'app WireGuard. + +#### IPs assignées + +| Admin | IP VPN | Clé publique | +|--------|------------|--------------| +| admin1 | 10.0.0.3 | (voir admin1.conf) | +| admin2 | 10.0.0.10 | `SL6qEf2K0/3a26wBkvQpOmgILHxxLS1N8M5hJAqfRCc=` | + +Prochaine IP libre : **10.0.0.11** + ### Phase 7: Admin Connection Each admin: