Date: 27/01/2026 17:22 Priorite: HAUTE Effort estime: M (quelques heures) Status: EN ATTENTE VALIDATION
Creer un systeme de profils VPN WireGuard reutilisables, separés des instances SSH, et permettre d'associer un profil a une instance SSH lors de sa creation/modification.
┌─────────────────────────────────────────────────────────────────────┐
│ PROFILS VPN │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Rhinov │ │ 86000 │ │ Home │ │
│ │ (Entreprise)│ │ (Raph) │ │ (Perso) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
└─────────┼────────────────┼────────────────┼──────────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────────┐
│ INSTANCES SSH │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ rhinov-srv1 │ │ raph-nas │ │ home-rpi │ │
│ │ VPN: Rhinov │ │ VPN: 86000 │ │ VPN: Home │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
Nouvelle table Supabase : connectors.vpn_profiles
CREATE TABLE connectors.vpn_profiles (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES auth.users(id),
name VARCHAR(100) NOT NULL,
description TEXT,
-- WireGuard config
private_key_encrypted TEXT NOT NULL,
public_key TEXT NOT NULL,
address TEXT NOT NULL, -- ex: "10.9.0.9/32"
-- Peer config
endpoint TEXT NOT NULL, -- ex: "92.154.124.233:11220"
peer_public_key TEXT NOT NULL,
preshared_key_encrypted TEXT, -- optionnel
allowed_ips TEXT NOT NULL, -- ex: "0.0.0.0/0, ::/0"
dns TEXT, -- ex: "192.168.10.250, 192.168.10.100"
persistent_keepalive INT DEFAULT 25,
-- Metadata
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(user_id, name)
);
Nouveau fichier : src/services/vpn-profiles.ts
| Fonction | Description |
|---|---|
create(userId, config) |
Creer un profil VPN |
update(profileId, userId, config) |
Modifier un profil |
delete(profileId, userId) |
Supprimer un profil |
list(userId) |
Lister les profils de l'utilisateur |
get(profileId, userId) |
Obtenir un profil |
importFromConfig(userId, name, wgConfig) |
Importer depuis fichier .conf |
| Endpoint | Methode | Description |
|---|---|---|
/api/vpn/profiles |
GET | Lister mes profils VPN |
/api/vpn/profiles |
POST | Creer un profil |
/api/vpn/profiles/:id |
GET | Obtenir un profil |
/api/vpn/profiles/:id |
PUT | Modifier un profil |
/api/vpn/profiles/:id |
DELETE | Supprimer un profil |
/api/vpn/profiles/import |
POST | Importer depuis .conf |
Modifier user_connectors.token_metadata pour SSH :
interface SSHTokenMetadata {
host: string;
port: number;
username: string;
// ... autres champs existants
vpn_profile_id?: string; // NOUVEAU: reference au profil VPN
}
Modifier le service wireguard.ts :
connect(instanceId) → recupere le profil via vpn_profile_id et connecteNouvelle page : /vpn/profiles
Formulaire creation/modification :
Page : Creation/Modification instance SSH
Ajouter un champ select :
VPN WireGuard: [Aucun ▼]
- Aucun
- Rhinov
- 86000 (Raph)
+ Creer un nouveau profil
Page info instance SSH :
Si un profil VPN est associe :
| Fichier | Action |
|---|---|
src/services/vpn-profiles.ts |
CREER |
src/services/wireguard.ts |
MODIFIER (utiliser profil) |
src/index.ts |
MODIFIER (ajouter endpoints) |
| Fichier | Action |
|---|---|
src/routes/vpn/profiles/index.tsx |
CREER (liste) |
src/routes/vpn/profiles/new.tsx |
CREER (creation) |
src/routes/vpn/profiles/[id]/index.tsx |
CREER (detail/edit) |
src/components/VpnProfileForm.tsx |
CREER |
src/components/VpnProfileSelect.tsx |
CREER (dropdown) |
src/routes/connectors/ssh/new.tsx |
MODIFIER (ajouter select VPN) |
src/routes/connectors/instance/[id]/index.tsx |
MODIFIER (afficher VPN) |
src/components/VpnConfig.tsx |
SUPPRIMER ou ADAPTER |
| Action | Description |
|---|---|
| Migration SQL | Creer table connectors.vpn_profiles |
Si des instances SSH ont deja une config VPN dans token_metadata.vpn_config :
| Etape | Description | Temps estime |
|---|---|---|
| 1 | Migration SQL + table vpn_profiles | 10 min |
| 2 | Service vpn-profiles.ts | 30 min |
| 3 | Endpoints API | 20 min |
| 4 | Modifier wireguard.ts | 15 min |
| 5 | Pages frontend profils VPN | 45 min |
| 6 | Composant VpnProfileSelect | 15 min |
| 7 | Modifier formulaire SSH | 15 min |
| 8 | Modifier page instance | 15 min |
| 9 | Tests | 15 min |
| Total | ~3h |
Import .conf : Tu veux pouvoir coller le contenu d'un fichier .conf et qu'il soit parse automatiquement ?
Navigation : Ou mettre le lien vers les profils VPN ?
Migration : Migrer automatiquement les configs VPN existantes vers des profils ?