Use installed dosh-auth path for SSH bootstrap
This commit is contained in:
@@ -37,7 +37,7 @@ The client always tries the cheapest valid path first:
|
|||||||
2. **UDP attach ticket:** cached server-issued attach ticket for the same
|
2. **UDP attach ticket:** cached server-issued attach ticket for the same
|
||||||
host/user/session/mode. No SSH. One encrypted UDP request, one encrypted UDP
|
host/user/session/mode. No SSH. One encrypted UDP request, one encrypted UDP
|
||||||
reply.
|
reply.
|
||||||
3. **SSH bootstrap:** `ssh -T user@host dosh-auth ...`, then one encrypted UDP
|
3. **SSH bootstrap:** `ssh -T user@host ~/.local/bin/dosh-auth ...`, then one encrypted UDP
|
||||||
attach.
|
attach.
|
||||||
4. **New session:** same as attach, but the server must create the PTY/shell unless
|
4. **New session:** same as attach, but the server must create the PTY/shell unless
|
||||||
the session was prewarmed.
|
the session was prewarmed.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
**Status:** Implemented Rust build with local and Docker SSH verification
|
**Status:** Implemented Rust build with local and Docker SSH verification
|
||||||
**Default language:** Rust, unless benchmarks prove the stack is the bottleneck
|
**Default language:** Rust, unless benchmarks prove the stack is the bottleneck
|
||||||
**Binaries:** `dosh-server`, `dosh-client`, `dosh-auth`, `dosh-bench`
|
**Binaries:** `dosh-server`, `dosh-client`, `dosh-auth`, `dosh-bench`
|
||||||
**Helper mode:** `dosh-server auth` or `dosh-auth`, invoked by SSH with `-T`
|
**Helper mode:** `dosh-server auth` or `~/.local/bin/dosh-auth`, invoked by SSH with `-T`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ host/user/session/mode:
|
|||||||
- Receives `AttachOk` with session key, `ClientId`, and snapshot.
|
- Receives `AttachOk` with session key, `ClientId`, and snapshot.
|
||||||
|
|
||||||
3. **SSH bootstrap**
|
3. **SSH bootstrap**
|
||||||
- Runs `ssh -T user@host dosh-auth ...`.
|
- Runs `ssh -T user@host ~/.local/bin/dosh-auth ...`.
|
||||||
- Receives attach token, attach ticket, session key material, and server metadata.
|
- Receives attach token, attach ticket, session key material, and server metadata.
|
||||||
- Sends `BootstrapAttachRequest`.
|
- Sends `BootstrapAttachRequest`.
|
||||||
- Receives `AttachOk` with `ClientId` and snapshot.
|
- Receives `AttachOk` with `ClientId` and snapshot.
|
||||||
@@ -185,7 +185,7 @@ No terminal bytes are sent outside AEAD after the attach handshake begins.
|
|||||||
Client command:
|
Client command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ssh -T user@host dosh-auth \
|
ssh -T user@host ~/.local/bin/dosh-auth \
|
||||||
--protocol 1 \
|
--protocol 1 \
|
||||||
--nonce <client_nonce> \
|
--nonce <client_nonce> \
|
||||||
--session <name> \
|
--session <name> \
|
||||||
@@ -454,6 +454,7 @@ Client config: `~/.config/dosh/client.toml`
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
server = "user@example.com"
|
server = "user@example.com"
|
||||||
|
ssh_auth_command = "~/.local/bin/dosh-auth"
|
||||||
# ssh_port = 22
|
# ssh_port = 22
|
||||||
dosh_port = 50000
|
dosh_port = 50000
|
||||||
default_session = "default"
|
default_session = "default"
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ try {
|
|||||||
@"
|
@"
|
||||||
server = "$defaultServer"
|
server = "$defaultServer"
|
||||||
$doshHostLine
|
$doshHostLine
|
||||||
|
ssh_auth_command = "~/.local/bin/dosh-auth"
|
||||||
# ssh_port = 22
|
# ssh_port = 22
|
||||||
dosh_port = $Port
|
dosh_port = $Port
|
||||||
default_session = "default"
|
default_session = "default"
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ if [ "$role" = "client" ] || [ "$role" = "both" ]; then
|
|||||||
cat >"$client_config" <<EOF
|
cat >"$client_config" <<EOF
|
||||||
server = "$default_server"
|
server = "$default_server"
|
||||||
$dosh_host_line
|
$dosh_host_line
|
||||||
|
ssh_auth_command = "~/.local/bin/dosh-auth"
|
||||||
# ssh_port = 22
|
# ssh_port = 22
|
||||||
dosh_port = $port
|
dosh_port = $port
|
||||||
default_session = "default"
|
default_session = "default"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ struct Args {
|
|||||||
local_auth: bool,
|
local_auth: bool,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
client: Option<PathBuf>,
|
client: Option<PathBuf>,
|
||||||
#[arg(long, default_value = "dosh-auth")]
|
#[arg(long, default_value = "~/.local/bin/dosh-auth")]
|
||||||
ssh_auth_command: String,
|
ssh_auth_command: String,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
ssh_key: Option<PathBuf>,
|
ssh_key: Option<PathBuf>,
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ struct Args {
|
|||||||
attach_only: bool,
|
attach_only: bool,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
ssh_port: Option<u16>,
|
ssh_port: Option<u16>,
|
||||||
#[arg(long, default_value = "dosh-auth")]
|
#[arg(long)]
|
||||||
ssh_auth_command: String,
|
ssh_auth_command: Option<String>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
ssh_key: Option<std::path::PathBuf>,
|
ssh_key: Option<std::path::PathBuf>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
@@ -81,6 +81,11 @@ async fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
.to_string();
|
.to_string();
|
||||||
let ssh_port = args.ssh_port.or(config.ssh_port);
|
let ssh_port = args.ssh_port.or(config.ssh_port);
|
||||||
|
let ssh_auth_command = args
|
||||||
|
.ssh_auth_command
|
||||||
|
.clone()
|
||||||
|
.or_else(|| config.ssh_auth_command.clone())
|
||||||
|
.unwrap_or_else(|| "~/.local/bin/dosh-auth".to_string());
|
||||||
let dosh_port = args.dosh_port.unwrap_or(config.dosh_port);
|
let dosh_port = args.dosh_port.unwrap_or(config.dosh_port);
|
||||||
let cache_path = cache_path(&config.credential_cache, &server, &session, &mode);
|
let cache_path = cache_path(&config.credential_cache, &server, &session, &mode);
|
||||||
let (cols, rows) = size().unwrap_or((80, 24));
|
let (cols, rows) = size().unwrap_or((80, 24));
|
||||||
@@ -164,7 +169,7 @@ async fn main() -> Result<()> {
|
|||||||
let mut bootstrap = ssh_bootstrap(
|
let mut bootstrap = ssh_bootstrap(
|
||||||
&server,
|
&server,
|
||||||
ssh_port,
|
ssh_port,
|
||||||
&args.ssh_auth_command,
|
&ssh_auth_command,
|
||||||
args.ssh_key.as_deref(),
|
args.ssh_key.as_deref(),
|
||||||
args.ssh_known_hosts.as_deref(),
|
args.ssh_known_hosts.as_deref(),
|
||||||
args.ssh_control_path.as_deref(),
|
args.ssh_control_path.as_deref(),
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ impl Default for ServerConfig {
|
|||||||
pub struct ClientConfig {
|
pub struct ClientConfig {
|
||||||
pub server: String,
|
pub server: String,
|
||||||
pub dosh_host: Option<String>,
|
pub dosh_host: Option<String>,
|
||||||
|
pub ssh_auth_command: Option<String>,
|
||||||
pub ssh_port: Option<u16>,
|
pub ssh_port: Option<u16>,
|
||||||
pub dosh_port: u16,
|
pub dosh_port: u16,
|
||||||
pub default_session: String,
|
pub default_session: String,
|
||||||
@@ -60,6 +61,7 @@ impl Default for ClientConfig {
|
|||||||
Self {
|
Self {
|
||||||
server: "user@example.com".to_string(),
|
server: "user@example.com".to_string(),
|
||||||
dosh_host: None,
|
dosh_host: None,
|
||||||
|
ssh_auth_command: Some("~/.local/bin/dosh-auth".to_string()),
|
||||||
ssh_port: None,
|
ssh_port: None,
|
||||||
dosh_port: 50000,
|
dosh_port: 50000,
|
||||||
default_session: "default".to_string(),
|
default_session: "default".to_string(),
|
||||||
|
|||||||
Reference in New Issue
Block a user