feat: add reverse ssh sandbox targets

A sandbox behind NAT could not reach the room. A reverse target dials a tunnel-only sshd on the server, forwards localhost:22 to a loopback port, and the worker connects there.

The server assigns the port and writes one authorized_keys line per tunnel target. The key carries permitlisten for that port; the sshd allows remote forwarding only, with no shell or local forwarding. The tunnel private key is shown once and never stored; rotating it rewrites the file. The target list and setup dialog carry the command, and the docs include the sshd config and sidecar requirements.
This commit is contained in:
vhaudiquet committed 2026-11-29 19:25:14 +01:00
1 parent fc684115b5
commit d85f68a176
20 files changed
+893 -38

No files matched your search

+5 -2
View File
@@ -51,6 +51,7 @@ pub struct TargetRow {
pub user_name: String,
pub private_key_ciphertext: String,
pub host_fingerprint: Option<String>,
pub kind: String,
}
/// Reads everything a turn needs.
@@ -105,7 +106,7 @@ pub fn load_turn_config(state: &Shared, room_id: &str) -> AppResult<TurnConfig>
},
)?;
let target = conn.query_row(
"SELECT id, host, port, user_name, private_key_ciphertext, host_fingerprint
"SELECT id, host, port, user_name, private_key_ciphertext, host_fingerprint, kind
FROM sandbox_targets WHERE id = ?1",
rusqlite::params![target_id],
|row| {
@@ -116,6 +117,7 @@ pub fn load_turn_config(state: &Shared, room_id: &str) -> AppResult<TurnConfig>
user_name: row.get(3)?,
private_key_ciphertext: row.get(4)?,
host_fingerprint: row.get(5)?,
kind: row.get(6)?,
})
},
)?;
@@ -192,7 +194,7 @@ pub fn load_room_target(state: &Shared, room: &str) -> AppResult<(String, Target
let target_id =
target_id.ok_or_else(|| AppError::bad_request("room has no sandbox configured"))?;
let target = conn.query_row(
"SELECT id, host, port, user_name, private_key_ciphertext, host_fingerprint
"SELECT id, host, port, user_name, private_key_ciphertext, host_fingerprint, kind
FROM sandbox_targets WHERE id = ?1",
rusqlite::params![target_id],
|row| {
@@ -203,6 +205,7 @@ pub fn load_room_target(state: &Shared, room: &str) -> AppResult<(String, Target
user_name: row.get(3)?,
private_key_ciphertext: row.get(4)?,
host_fingerprint: row.get(5)?,
kind: row.get(6)?,
})
},
)?;