Revert "feat: add reverse ssh sandbox targets"

This reverts commit d85f68a176.
This commit is contained in:
vhaudiquet committed 2026-11-29 21:34:09 +01:00
1 parent d85f68a176
commit 4d9530cc34
20 files changed
+38 -893

No files matched your search

-14
View File
@@ -2141,20 +2141,6 @@ body.files-resizing-y * {
color: var(--muted);
}
.command-block {
margin: 0;
padding: var(--sp-3);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--r-control);
color: var(--text);
font-family: var(--font-mono);
font-size: var(--fs-small);
line-height: var(--lh-body);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.form-grid {
display: grid;
grid-template-columns: 1fr 1fr;
+12 -161
View File
@@ -9,7 +9,6 @@ import type {
LoginFlowStatus,
ProviderConfig,
ProviderListResponse,
SandboxKind,
SandboxListResponse,
SandboxTarget,
StartLoginResponse,
@@ -94,7 +93,6 @@ const flowInstruction = computed(() => {
}
})
const sandboxKind = ref<SandboxKind>('direct')
const sandboxName = ref('')
const sandboxHost = ref('')
const sandboxPort = ref<number | string>(22)
@@ -103,10 +101,6 @@ const sandboxRoot = ref('/root')
const sandboxKey = ref('')
const sandboxBusy = ref(false)
const sandboxError = ref('')
const tunnelSetup = ref<{ id: string; name: string; privateKey: string; command: string } | null>(null)
const tunnelBusy = ref(false)
const tunnelError = ref('')
const copiedTunnel = ref<string | null>(null)
const deletingProvider = ref<string | null>(null)
const deletingTarget = ref<string | null>(null)
@@ -312,7 +306,6 @@ function openSandboxDialog() {
function closeSandboxDialog() {
sandboxDialog.value = false
sandboxKind.value = 'direct'
sandboxKey.value = ''
sandboxError.value = ''
}
@@ -346,33 +339,21 @@ async function addSandbox() {
sandboxBusy.value = true
sandboxError.value = ''
const body: CreateSandboxBody = {
kind: sandboxKind.value,
name: sandboxName.value.trim(),
host: sandboxHost.value.trim(),
port: Number(sandboxPort.value) || 22,
user_name: sandboxUser.value.trim() || 'root',
workspace_root: sandboxRoot.value.trim() || '/root',
}
if (sandboxKind.value === 'direct') {
body.host = sandboxHost.value.trim()
body.port = Number(sandboxPort.value) || 22
}
if (sandboxKey.value.trim()) body.private_key = sandboxKey.value.trim()
try {
const result = await api.post<CreateSandboxResponse>('/sandbox-targets', body)
if (result.kind === 'tunnel') {
tunnelSetup.value = {
id: result.id,
name: sandboxName.value.trim(),
privateKey: result.tunnel_private_key ?? '',
command: result.tunnel_command ?? '',
}
}
await api.post<CreateSandboxResponse>('/sandbox-targets', body)
sandboxName.value = ''
sandboxHost.value = ''
sandboxPort.value = 22
sandboxUser.value = 'root'
sandboxRoot.value = '/root'
sandboxKey.value = ''
sandboxKind.value = 'direct'
await loadLists()
sandboxDialog.value = false
} catch (err) {
@@ -382,47 +363,6 @@ async function addSandbox() {
}
}
function openTunnelSetup(target: SandboxTarget) {
tunnelError.value = ''
copiedTunnel.value = null
tunnelSetup.value = {
id: target.id,
name: target.name,
privateKey: '',
command: target.tunnel_command ?? '',
}
}
async function regenerateTunnelKey() {
const setup = tunnelSetup.value
if (!setup || tunnelBusy.value) return
tunnelBusy.value = true
tunnelError.value = ''
try {
const result = await api.post<CreateSandboxResponse>(`/sandbox-targets/${setup.id}/tunnel-key`)
setup.privateKey = result.tunnel_private_key ?? ''
setup.command = result.tunnel_command ?? setup.command
copiedTunnel.value = null
await loadLists()
} catch (err) {
tunnelError.value = apiErrorMessage(err)
} finally {
tunnelBusy.value = false
}
}
async function copyTunnelValue(value: string, key: string) {
try {
await navigator.clipboard.writeText(value)
copiedTunnel.value = key
window.setTimeout(() => {
if (copiedTunnel.value === key) copiedTunnel.value = null
}, 1800)
} catch {
tunnelError.value = 'The clipboard is not available. Select the text and copy it by hand.'
}
}
async function removeProvider(provider: ProviderConfig) {
if (deleteBusy.value) return
deleteBusy.value = true
@@ -651,7 +591,7 @@ async function copyKey(target: SandboxTarget) {
Add sandbox
</button>
</div>
<p class="hint">A sandbox is an ssh machine the room works on. Direct targets are reached at their address. Reverse SSH targets dial this server, so they can sit behind NAT.</p>
<p class="hint">A sandbox is an ssh machine the room works on. The public key belongs in its authorized_keys file.</p>
<div v-if="!loading && targets.length === 0" class="empty">No sandboxes yet. Use Add sandbox to connect one.</div>
@@ -659,10 +599,7 @@ async function copyKey(target: SandboxTarget) {
<div v-for="target in targets" :key="target.id" class="settings-row">
<div class="settings-row-main">
<div class="settings-row-title">{{ target.name }}</div>
<div v-if="target.kind === 'tunnel'" class="settings-row-detail">
Tunnel port {{ target.port }} on this server, sandbox {{ target.user_name }}@localhost:22
</div>
<div v-else class="settings-row-detail">{{ target.user_name }}@{{ target.host }}:{{ target.port }}</div>
<div class="settings-row-detail">{{ target.user_name }}@{{ target.host }}:{{ target.port }}</div>
<div class="settings-row-detail">Workspace root: {{ target.workspace_root }}</div>
<div class="key-line">
<span class="key-text">{{ target.public_key }}</span>
@@ -686,14 +623,6 @@ async function copyKey(target: SandboxTarget) {
</div>
</div>
<div class="settings-row-actions">
<button
v-if="target.kind === 'tunnel'"
type="button"
class="btn btn-sm"
@click="openTunnelSetup(target)"
>
Setup
</button>
<button
type="button"
class="btn btn-sm"
@@ -739,35 +668,21 @@ async function copyKey(target: SandboxTarget) {
<label class="field-label" for="sandbox-name">Name</label>
<input id="sandbox-name" v-model="sandboxName" class="input" type="text" maxlength="60" autofocus required>
</div>
<div class="field">
<label class="field-label" for="sandbox-kind">Connection</label>
<select id="sandbox-kind" v-model="sandboxKind" class="select">
<option value="direct">Direct SSH</option>
<option value="tunnel">Reverse SSH</option>
</select>
</div>
</div>
<div v-if="sandboxKind === 'direct'" class="form-grid">
<div class="field">
<label class="field-label" for="sandbox-host">Host</label>
<input id="sandbox-host" v-model="sandboxHost" class="input" type="text" spellcheck="false" required>
</div>
</div>
<div class="form-grid">
<div class="field">
<label class="field-label" for="sandbox-port">Port</label>
<input id="sandbox-port" v-model.number="sandboxPort" class="input" type="number" min="1" max="65535" required>
</div>
</div>
<div v-else class="field">
<span class="hint">
The server assigns a loopback port. After adding, run the tunnel command on the sandbox and add this target's public key to its authorized_keys.
</span>
</div>
<div class="field">
<label class="field-label" for="sandbox-user">SSH user</label>
<input id="sandbox-user" v-model="sandboxUser" class="input" type="text" spellcheck="false">
<div class="field">
<label class="field-label" for="sandbox-user">SSH user</label>
<input id="sandbox-user" v-model="sandboxUser" class="input" type="text" spellcheck="false">
</div>
</div>
<div class="field">
@@ -798,70 +713,6 @@ async function copyKey(target: SandboxTarget) {
</div>
</form>
</BaseDialog>
<BaseDialog
v-if="tunnelSetup"
title="Reverse SSH setup"
:description="`Run the tunnel on ${tunnelSetup.name}, then test the target.`"
@close="tunnelSetup = null"
>
<div class="form">
<p class="hint">
Add the target's public key to the sandbox's authorized_keys. The tunnel sshd reads the authorized_keys file this server writes.
</p>
<div class="field">
<label class="field-label">Tunnel command</label>
<pre class="command-block">{{ tunnelSetup.command }}</pre>
<button
type="button"
class="btn btn-sm btn-quiet"
@click="copyTunnelValue(tunnelSetup.command, 'setup-command')"
>
<component :is="copiedTunnel === 'setup-command' ? Check : Copy" :size="14" aria-hidden="true" />
{{ copiedTunnel === 'setup-command' ? 'Copied' : 'Copy' }}
</button>
</div>
<div class="field">
<label class="field-label">
Tunnel private key
<span v-if="tunnelSetup.privateKey" class="field-optional">shown once</span>
</label>
<textarea
v-if="tunnelSetup.privateKey"
:value="tunnelSetup.privateKey"
class="textarea"
rows="5"
readonly
></textarea>
<p v-else class="hint">
The key was shown when the target was added. Regenerate it if it was lost; the old key stops working.
</p>
<button
v-if="tunnelSetup.privateKey"
type="button"
class="btn btn-sm btn-quiet"
@click="copyTunnelValue(tunnelSetup.privateKey, 'setup-key')"
>
<component :is="copiedTunnel === 'setup-key' ? Check : Copy" :size="14" aria-hidden="true" />
{{ copiedTunnel === 'setup-key' ? 'Copied' : 'Copy key' }}
</button>
</div>
<p class="hint">
Save the key as <code>rhema-tunnel-{{ tunnelSetup.id }}</code> in the directory where you run the command, then run <code>chmod 600</code> on it.
</p>
<p v-if="tunnelError" class="form-error" role="alert">{{ tunnelError }}</p>
<div class="dialog-actions">
<button type="button" class="btn" @click="tunnelSetup = null">Close</button>
<button type="button" class="btn" :disabled="tunnelBusy" @click="regenerateTunnelKey">
{{ tunnelBusy ? 'Regenerating' : 'Regenerate key' }}
</button>
</div>
</div>
</BaseDialog>
</section>
</div>
</template>
+1 -9
View File
@@ -202,8 +202,6 @@ export interface IdResponse {
id: string
}
export type SandboxKind = 'direct' | 'tunnel'
export interface SandboxTarget {
id: string
name: string
@@ -213,8 +211,6 @@ export interface SandboxTarget {
workspace_root: string
public_key: string
host_fingerprint: string | null
kind: SandboxKind
tunnel_command: string | null
}
export interface SandboxListResponse {
@@ -223,8 +219,7 @@ export interface SandboxListResponse {
export interface CreateSandboxBody {
name: string
kind?: SandboxKind
host?: string
host: string
port?: number
user_name?: string
workspace_root?: string
@@ -234,9 +229,6 @@ export interface CreateSandboxBody {
export interface CreateSandboxResponse {
id: string
public_key: string
kind?: SandboxKind
tunnel_private_key?: string
tunnel_command?: string
}
export interface TestSandboxResponse {