--- name: booth-vpn-fix description: Procédure urgente pour rétablir le tunnel WireGuard sur la Surface (booth terrain) et installer un watchdog metadata: node_type: memory type: project originSessionId: 6d8a34f4-db2f-4d5b-92e9-895e3925ccb5 --- ## Problème Le booth (Surface) est sur un WiFi externe, le tunnel WireGuard ne se connecte pas même après reboot. Dernier handshake : 6+ jours. Aucun accès SSH ni VPN. **Why:** Le service wg-quick@wg0 n'est peut-être pas enabled au boot, ou l'Endpoint dans la config WG pointe vers une IP locale (192.168.111.x) au lieu de l'IP publique. ## Infos serveur WG (LXC 111) - IP LXC : 192.168.111.211 - Port WG : 51820 (UDP) — écoute OK - Clé publique serveur : `g3s7Gh1Er+LIEI/W91HAVDNIo+gsk/KiajdtoDUQRVo=` - Le port 51820 est redirigé depuis la box vers le LXC ## Étapes à faire sur la Surface (SSH ou clavier physique) ### 1. Diagnostic ```bash sudo systemctl status wg-quick@wg0 sudo wg show cat /etc/wireguard/wg0.conf ``` ### 2. Vérifier l'Endpoint Dans `/etc/wireguard/wg0.conf`, le `[Peer]` doit avoir : ``` Endpoint = :51820 ``` **PAS** une IP locale type 192.168.111.x — ça ne marche que depuis le LAN. Pour trouver l'IP publique depuis le PC fixe : ```bash curl -s ifconfig.me ``` ### 3. Activer au boot + relancer ```bash sudo systemctl enable wg-quick@wg0 sudo systemctl restart wg-quick@wg0 sudo wg show ``` Vérifier que le handshake se fait (latest handshake < 1 minute). ### 4. Installer le watchdog WG (une fois le tunnel rétabli) Créer `/usr/local/bin/wg-watchdog.sh` : ```bash #!/bin/bash IFACE=wg0 MAX_AGE=180 # 3 minutes sans handshake = relance latest=$(sudo wg show $IFACE latest-handshakes 2>/dev/null | awk '{print $2}') if [ -z "$latest" ] || [ "$latest" = "0" ]; then systemctl restart wg-quick@$IFACE exit 0 fi now=$(date +%s) age=$((now - latest)) if [ $age -gt $MAX_AGE ]; then logger "wg-watchdog: handshake age ${age}s > ${MAX_AGE}s, restarting $IFACE" systemctl restart wg-quick@$IFACE fi ``` ```bash sudo chmod +x /usr/local/bin/wg-watchdog.sh echo "* * * * * root /usr/local/bin/wg-watchdog.sh" | sudo tee /etc/cron.d/wg-watchdog ``` ### 5. Installer reverse SSH en fallback ```bash sudo apt install -y autossh ``` Créer `/etc/systemd/system/autossh-tunnel.service` : ```ini [Unit] Description=Reverse SSH tunnel fallback After=network-online.target Wants=network-online.target [Service] User=jules ExecStart=/usr/bin/autossh -M 0 -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure yes" -R 2222:localhost:22 root@192.168.111.211 Restart=always RestartSec=30 [Install] WantedBy=multi-user.target ``` ```bash sudo systemctl enable autossh-tunnel sudo systemctl start autossh-tunnel ``` Ensuite depuis le LXC 111 : `ssh -p 2222 jules@localhost` pour joindre la Surface même si WG est mort. **Prérequis :** la clé SSH de jules@surface doit être dans authorized_keys de root@192.168.111.211 (LXC). ### 6. Déployer les dernières modifs Une fois le tunnel rétabli : ```bash cd /home/jules/photobooth && git pull && sudo systemctl restart photobooth ``` Commits non déployés sur Surface : - Flash blanc capture + printer toast CSS + admin galerie + compteur copies - Cache versions bump ## Changements faits sur LXC 111 (cette session) - Landing page vitrine complète (tarifs, formulaire résa, calendrier dispo) - Endpoint `/api/contact` : crée événement + email admin (pas client) - Endpoint `/api/contact/valider/{id}` : valide résa + envoie email client - Endpoint `/api/disponibilites` : dates occupées pour calendrier - ZIP streaming (fix 500 sur gros ZIP) - Barre progression téléchargement ZIP - Admin panel : section "Demandes en attente" avec bouton Valider