Date creation: 26/01/2026 Derniere MAJ: 26/01/2026 Status: ACTIF Version: 2.0.0
Le connecteur SSH permet d'executer des commandes sur des serveurs distants via l'API Connectors Hub. Supporte les connexions directes et via Jump Host (bastion), les transferts SFTP, et un terminal WebSocket temps reel.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │────►│ Connectors API │────►│ Serveur SSH │
│ SshShell.tsx │ │ /api/ssh/* │ │ distant │
│ SshWebTerminal │ │ WebSocket │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ ▲
│ │ (optionnel)
│ ┌─────┴─────┐
┌─────────────────┐ │ Jump Host │
│ ssh2 (node) │───────► (Bastion) │
│ Credentials │ └───────────┘
│ chiffres AES │
└─────────────────┘
Cree une nouvelle instance SSH (endpoint dedie).
// Request
{
"name": "Serveur Prod",
"host": "192.168.1.10",
"port": 22,
"username": "admin",
"password": "secret",
"auth_method": "password",
"jump_host": {
"host": "bastion.example.com",
"port": 22,
"username": "jump-user",
"password": "jump-pass",
"auth_method": "password"
}
}
Execute une commande sur un serveur distant.
// Request
{
"instance_id": "uuid",
"command": "ls -la /var/log",
"cwd": "/home/user",
"timeout": 30000,
"force": false
}
// Response
{
"success": true,
"stdout": "...",
"stderr": "...",
"exit_code": 0,
"duration_ms": 234
}
Commandes dangereuses: Si une commande est detectee comme dangereuse (rm -rf, mkfs, etc.), retourne un warning. Ajouter "force": true pour executer quand meme.
Teste une connexion SSH sans la sauvegarder.
// Request
{
"host": "192.168.1.10",
"port": 22,
"username": "root",
"password": "secret",
"auth_method": "password"
}
// Response
{
"success": true,
"message": "Connection successful",
"fingerprint": "SHA256:abc..."
}
Upload un fichier (texte) vers le serveur.
{
"instance_id": "uuid",
"content": "#!/bin/bash\necho hello",
"remote_path": "/tmp/script.sh",
"mode": "755"
}
Download un fichier depuis le serveur.
// Request
{
"instance_id": "uuid",
"remote_path": "/var/log/app.log",
"tail": 100
}
// Response
{
"success": true,
"content": "..."
}
Configure une cle SSH auto-generee (recommande).
{
"instance_id": "uuid",
"password": "current-password"
}
Flow:
Liste le contenu d'un repertoire distant.
// Request
{
"instance_id": "uuid",
"remote_path": "/var/log"
}
// Response
{
"success": true,
"entries": [
{
"name": "syslog",
"type": "file",
"size": 12345,
"mtime": 1706310000,
"mode": 33188
}
]
}
Upload un fichier binaire (base64).
{
"instance_id": "uuid",
"content_base64": "SGVsbG8gV29ybGQ=",
"remote_path": "/tmp/file.bin",
"mode": "644"
}
Download un fichier binaire (retour base64).
// Request
{
"instance_id": "uuid",
"remote_path": "/tmp/file.bin"
}
// Response
{
"success": true,
"content_base64": "SGVsbG8gV29ybGQ=",
"size": 11
}
Supprime un fichier.
Cree un repertoire.
Limite de taille: 50MB par defaut (configurable via SFTP_MAX_SIZE)
Terminal interactif en temps reel via WebSocket.
Connexion:
wss://connectors.33800.nowhere84.com/api/ssh/shell?instance_id=uuid&token=jwt
Messages:
// Client -> Server (input)
{ "type": "input", "data": "ls -la\n" }
// Client -> Server (resize)
{ "type": "resize", "cols": 120, "rows": 40 }
// Server -> Client (output)
{ "type": "output", "data": "..." }
// Server -> Client (status)
{ "type": "ready", "message": "Shell connected" }
{ "type": "close", "message": "Session ended" }
{ "type": "error", "message": "..." }
Permet d'acceder a un serveur via un bastion intermediaire.
Local -> Jump Host (bastion) -> Serveur cible
{
"host": "192.168.1.10",
"username": "admin",
"auth_method": "key",
"private_key_encrypted": "...",
"jump_host": {
"host": "bastion.example.com",
"port": 22,
"username": "jump-user",
"auth_method": "password",
"password_encrypted": "..."
}
}
Le tunneling utilise ssh2.forwardOut() pour creer une connexion TCP vers le serveur cible a travers le bastion.
SSH_ENCRYPTION_KEYiv_hex:encrypted_hexrm -rf .../
mkfs
dd if=
> /dev/
chmod -R 777
shutdown, reboot
systemctl stop sshd
Toutes les operations SSH sont loggees dans audit_logs:
ssh.executessh.uploadssh.downloadssh.setup_keyssh.sftp_listssh.sftp_uploadssh.sftp_downloadssh.sftp_deletessh.sftp_mkdirssh.shell_startssh.shell_endssh.create_instanceFormulaire de creation d'une instance SSH:
Interface "one-shot" pour commandes:
Terminal interactif xterm.js:
user_connectorsLa config SSH est stockee dans token_metadata (JSONB):
{
"host": "192.168.1.10",
"port": 22,
"username": "root",
"auth_method": "password",
"password_encrypted": "iv:encrypted",
"fingerprint": "SHA256:...",
"jump_host": {
"host": "bastion.example.com",
"port": 22,
"username": "jump-user",
"auth_method": "key",
"private_key_encrypted": "..."
}
}
| Variable | Description | Default |
|---|---|---|
| SSH_ENCRYPTION_KEY | Cle de chiffrement AES | default-key-... |
| SFTP_MAX_SIZE | Taille max fichier SFTP (bytes) | 52428800 (50MB) |
src/services/ssh.ts - Service SSH principal (execute, SFTP, shell)src/index.ts - Routes /api/ssh/*, WebSocket handlersrc/data/connector-types.ts - Type SSHsrc/services/audit.ts - Actions SSHsrc/components/SshShell.tsx - Interface commandes one-shotsrc/components/SshWebTerminal.tsx - Terminal WebSocket xterm.jssrc/routes/connect/ssh/index.tsx - Formulaire creationsrc/routes/connect/index.tsx - Carte SSHsrc/routes/connectors/instance/[id]/index.tsx - Integration terminalsssh2 (npm)@xterm/xterm, @xterm/addon-fit, @xterm/addon-web-linksChaque instance SSH peut configurer un tunnel VPN WireGuard pour acceder a des machines distantes de maniere securisee (derriere NAT, reseaux prives).
┌────────────────────────┐ ┌─────────────────────┐ ┌────────────────┐
│ connectors-api │────►│ wireguard-sidecar │────►│ Peer distant │
│ /api/instances/vpn │ │ (port 5410) │ │ WireGuard │
└────────────────────────┘ │ wireguard-go │ └────────────────┘
└─────────────────────┘
| Endpoint | Description |
|---|---|
POST /api/instances/:id/vpn/generate-keys |
Genere paire de cles WireGuard |
PUT /api/instances/:id/vpn |
Configure VPN (endpoint, peer, allowed_ips) |
POST /api/instances/:id/vpn/connect |
Demarre tunnel |
POST /api/instances/:id/vpn/disconnect |
Arrete tunnel |
GET /api/instances/:id/vpn/status |
Status (connected, transfer, handshake) |
GET /api/instances/:id/vpn/config |
Config sans cle privee |
DELETE /api/instances/:id/vpn |
Supprime config VPN |
GET /api/vpn/active |
Liste tunnels actifs |
{
"endpoint": "82.67.42.47:51820",
"peer_public_key": "ABC123...",
"allowed_ips": "10.0.0.0/24, 192.168.1.0/24",
"address": "10.0.0.2/24",
"dns": "1.1.1.1",
"persistent_keepalive": 25,
"auto_connect": true
}
wireguard-sidecar (port 5410)supabase-prod_supabase-prod (partage avec connectors-api)NET_ADMIN, SYS_MODULE/etc/wireguard pour configsBackend (connectors-api):
src/services/wireguard.ts - Service VPNsrc/index.ts - Endpoints /api/instances/:id/vpn/*Sidecar:
/stock_8to/33800-stack/docker/stacks/wireguard-sidecar/app.py - API FastAPIDockerfile - Image Alpine + wireguard-toolsFrontend:
src/components/VpnConfig.tsx - UI configuration VPN