Skip to content

Commit 2455bec

Browse files
committed
iroh 0.90 no longer running
1 parent dbdc871 commit 2455bec

File tree

9 files changed

+365
-570
lines changed

9 files changed

+365
-570
lines changed

Cargo.lock

Lines changed: 331 additions & 513 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ repository = "https://github.com/rustonbsd/iroh-ssh"
77
readme = "README.md"
88
keywords = ["networking"]
99
categories = ["network-programming"]
10-
version = "0.2.6"
10+
version = "0.2.7"
1111
edition = "2024"
1212

1313
[dependencies]
1414
anyhow = "1.0.100"
15-
iroh = "0.93.2"
15+
iroh = "0.94"
1616
ed25519-dalek = { version = "2.2.0", features = ["rand_core"] }
1717
rand = "0.9"
1818
tokio-stream = { version = "0.1.15", features = ["sync"] }
1919
tracing = "0.1"
2020
tracing-subscriber = { version = "0.3.20", features = ["fmt", "ansi"] }
2121
tracing-appender = "0.2"
22-
tokio = { version = "1.47.1", features = [
22+
tokio = { version = "1.48", features = [
2323
"macros",
2424
"io-util",
2525
"sync",

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ Download and setup the binary automatically for your operating system from [GitH
3737
Linux
3838
```bash
3939
# Linux
40-
wget https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.6/iroh-ssh.linux
40+
wget https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.7/iroh-ssh.linux
4141
chmod +x iroh-ssh.linux
4242
sudo mv iroh-ssh.linux /usr/local/bin/iroh-ssh
4343
```
4444

4545
macOS
4646
```bash
4747
# macOS arm
48-
curl -LJO https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.6/iroh-ssh.macos
48+
curl -LJO https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.7/iroh-ssh.macos
4949
chmod +x iroh-ssh.macos
5050
sudo mv iroh-ssh.macos /usr/local/bin/iroh-ssh
5151
```
5252

5353
Windows
5454
```bash
5555
# Windows x86 64bit
56-
curl -L -o iroh-ssh.exe https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.6/iroh-ssh.exe
56+
curl -L -o iroh-ssh.exe https://github.com/rustonbsd/iroh-ssh/releases/download/0.2.7/iroh-ssh.exe
5757
mkdir %LOCALAPPDATA%\iroh-ssh
5858
move iroh-ssh.exe %LOCALAPPDATA%\iroh-ssh\
5959
setx PATH "%PATH%;%LOCALAPPDATA%\iroh-ssh"
@@ -135,7 +135,7 @@ Display its Node ID and share it to allow connection
135135
> iroh-ssh info
136136

137137
Your iroh-ssh nodeid: 38b7dc10df96005255c3beaeaeef6cfebd88344aa8c85e1dbfc1ad5e50f372ac
138-
iroh-ssh version 0.2.4
138+
iroh-ssh version 0.2.7
139139
https://github.com/rustonbsd/iroh-ssh
140140

141141
Your server iroh-ssh nodeid:
@@ -194,12 +194,8 @@ Display its Node ID and share it to allow connection
194194
> iroh-ssh service uninstall # Uninstall service
195195

196196
# Client connection
197-
> iroh-ssh user@<NODE_ID> # Connect to remote server
198-
> iroh-ssh connect user@<NODE_ID> # Explicit connect command
199-
> iroh-ssh -i ~/.ssh/id_rsa_my_cert user@<NODE_ID> # Connect with certificate
200-
> iroh-ssh -L [bind_address:]port:host:hostport user@<NODE_ID> # Forward connections made to client (bind_addr:port) to server (host:hostport)
201-
> iroh-ssh -R [bind_address:]port:host:hostport user@<NODE_ID> # Forward connections made to server (bind_addr:port) to client (host:hostport)
202-
197+
> iroh-ssh user@<NODE_ID> # Connect to remote server
198+
> iroh-ssh connect user@<NODE_ID> # Explicit connect command, works with all standard ssh params and flags
203199
```
204200

205201
## Security Model
@@ -217,9 +213,8 @@ Display its Node ID and share it to allow connection
217213
- [x] Add howto gifs
218214
- [x] Add -p flag for persistence
219215
- [x] Windows service mode
220-
- [x] Certificate support (`-i` flag)
216+
- [x] (almost) all ssh commands supported
221217
- [ ] MacOS service mode
222-
- [ ] Additional SSH features
223218

224219
## License
225220

README_es.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ Mostrar su ID de nodo y compártalo para permitir la conexión
195195

196196
# Conexión de cliente
197197
> iroh-ssh user@<NODE_ID> # Conectarse a un servidor remoto
198-
> iroh-ssh connect user@<NODE_ID> # Comando de conexión explicito
199-
> iroh-ssh -i ~/.ssh/id_rsa_my_cert user@<NODE_ID> # Conectarse con certificado
200-
> iroh-ssh -L [bind_address:]port:host:hostport user@<NODE_ID> # Redireccionamiento de conexión del cliente (bind_addr:port) al servidor (host:hostport)
201-
> iroh-ssh -R [bind_address:]port:host:hostport user@<NODE_ID> # Redireccionamiento de conexión del servidor (bind_addr:port) al cliente (host:hostport)
202-
198+
> iroh-ssh connect user@<NODE_ID> # Comando de conexión explicito, funciona con todos los parametros y banderas ssh estándar
203199
```
204200

205201
## Modelo de seguridad
@@ -217,9 +213,8 @@ Mostrar su ID de nodo y compártalo para permitir la conexión
217213
- [x] Gifs con ejemplos
218214
- [x] Adicionar la opción -p para persistencia
219215
- [x] Modo servicio en Windows
220-
- [x] Soporte de certificados (opción `-i`)
216+
- [x] (además de casi) todos los comandos ssh soportados
221217
- [ ] Modo servicio en MacOS
222-
- [ ] Funcionalidades adicionales SSH
223218

224219
## Licencia
225220

README_pt.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ Exiba seu ID de nó e compartilhe-o para permitir a conexão
195195

196196
# Conexão do cliente
197197
> iroh-ssh user@<NODE_ID> # Conectar-se a um servidor remoto
198-
> iroh-ssh connect user@<NODE_ID> # Comando de conexão explícito
199-
> iroh-ssh -i ~/.ssh/id_rsa_my_cert user@<NODE_ID> # Conectar-se com certificado
200-
> iroh-ssh -L [bind_address:]port:host:hostport user@<NODE_ID> # Redirecionamento de conexão do cliente (bind_addr:port) para o servidor (host:hostport)
201-
> iroh-ssh -R [bind_address:]port:host:hostport user@<NODE_ID> # Redirecionamento de conexão do servidor (bind_addr:port) para o cliente (host:hostport)
202-
198+
> iroh-ssh connect user@<NODE_ID> # Comando de conexão explícito, funciona com todos os parâmetros e flags ssh padrão
203199
```
204200

205201
## Modelo de segurança
@@ -217,9 +213,8 @@ Exiba seu ID de nó e compartilhe-o para permitir a conexão
217213
- [x] Adicionar gifs com exemplos
218214
- [x] Adicionar flag -p para persistência
219215
- [x] Modo serviço no Windows
220-
- [x] Suporte a certificados (flag -i)
216+
- [x] (quase) todos os comandos ssh suportados
221217
- [ ] Modo serviço no macOS
222-
- [ ] Recursos SSH adicionais
223218

224219
## Licença
225220

src/api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::str::FromStr as _;
22

33
use anyhow::bail;
44
use homedir::my_home;
5-
use iroh::{NodeId, SecretKey};
5+
use iroh::{EndpointId, SecretKey};
66

77
use crate::{
88
IrohSsh,
@@ -109,14 +109,14 @@ pub async fn server_mode(server_args: ServerArgs, service: bool) -> anyhow::Resu
109109

110110
pub async fn proxy_mode(proxy_args: ProxyArgs) -> anyhow::Result<()> {
111111
let iroh_ssh = IrohSsh::builder().accept_incoming(false).build().await?;
112-
let node_id = NodeId::from_str(if proxy_args.node_id.len() == 64 {
112+
let endpoint_id = EndpointId::from_str(if proxy_args.node_id.len() == 64 {
113113
&proxy_args.node_id
114114
} else if proxy_args.node_id.len() > 64 {
115115
&proxy_args.node_id[proxy_args.node_id.len() - 64..]
116116
} else {
117117
return Err(anyhow::anyhow!("invalid node id length"));
118118
})?;
119-
iroh_ssh.connect(node_id).await
119+
iroh_ssh.connect(endpoint_id).await
120120
}
121121

122122
pub async fn client_mode(connect_args: ConnectArgs) -> anyhow::Result<()> {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async fn main() -> anyhow::Result<()> {
2020
}
2121
Some(Cmd::Server(args)) => api::server_mode(args, false).await,
2222
Some(Cmd::Service { op }) => {
23-
if self_runas::is_elevated() == false {
23+
if !self_runas::is_elevated() {
2424
self_runas::admin()?;
2525
return Ok(())
2626
} else {

src/service/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#[cfg(not(target_os = "windows"))]
2-
use anyhow::bail;
3-
41
#[cfg(target_os = "linux")]
52
mod linux;
63
#[cfg(target_os = "linux")]
@@ -34,12 +31,12 @@ pub trait Service {
3431
fn uninstall() -> impl std::future::Future<Output = anyhow::Result<()>> + Send;
3532
}
3633

37-
pub async fn install_service(service_params: ServiceParams) -> anyhow::Result<()> {
34+
pub async fn install_service(_service_params: ServiceParams) -> anyhow::Result<()> {
3835
match std::env::consts::OS {
3936
#[cfg(target_os = "linux")]
40-
"linux" => LinuxService::install(service_params).await,
37+
"linux" => LinuxService::install(_service_params).await,
4138
#[cfg(target_os = "windows")]
42-
"windows" => WindowsService::install(service_params).await,
39+
"windows" => WindowsService::install(_service_params).await,
4340
_ => anyhow::bail!("service mode is only supported on linux and windows"),
4441
}
4542
}

src/ssh.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use anyhow::bail;
55
use ed25519_dalek::SECRET_KEY_LENGTH;
66
use homedir::my_home;
77
use iroh::{
8-
Endpoint, NodeId, SecretKey,
9-
endpoint::Connection,
10-
protocol::{ProtocolHandler, Router},
8+
endpoint::Connection, protocol::{ProtocolHandler, Router}, Endpoint, EndpointId, SecretKey
119
};
1210
use tokio::{
1311
net::TcpStream,
@@ -56,8 +54,7 @@ impl Builder {
5654
e
5755
);
5856
eprintln!(
59-
"Warning: Failed to load/create persistent SSH keys: {:#}",
60-
e
57+
"Warning: Failed to load/create persistent SSH keys: {e:#}"
6158
);
6259
eprintln!("Continuing with ephemeral keys...");
6360
}
@@ -70,12 +67,11 @@ impl Builder {
7067
let secret_key = SecretKey::from_bytes(&self.secret_key);
7168
let endpoint = Endpoint::builder()
7269
.secret_key(secret_key)
73-
.discovery_n0()
7470
.bind()
7571
.await?;
7672

7773
let mut iroh_ssh = IrohSsh {
78-
public_key: *endpoint.node_id().as_bytes(),
74+
public_key: *endpoint.id().as_bytes(),
7975
secret_key: self.secret_key,
8076
inner: None,
8177
ssh_port: self.accept_port.unwrap_or(22),
@@ -183,9 +179,9 @@ impl IrohSsh {
183179
Ok(ssh_process)
184180
}
185181

186-
pub async fn connect(&self, node_id: NodeId) -> anyhow::Result<()> {
182+
pub async fn connect(&self, endpoint_id: EndpointId) -> anyhow::Result<()> {
187183
let inner = self.inner.as_ref().expect("inner not set");
188-
let conn = inner.endpoint.connect(node_id, &IrohSsh::ALPN()).await?;
184+
let conn = inner.endpoint.connect(endpoint_id, &IrohSsh::ALPN()).await?;
189185
let (mut iroh_send, mut iroh_recv) = conn.open_bi().await?;
190186
let (mut local_read, mut local_write) = (tokio::io::stdin(), tokio::io::stdout());
191187
let a_to_b = async move { tokio::io::copy(&mut local_read, &mut iroh_send).await };
@@ -202,22 +198,22 @@ impl IrohSsh {
202198
Ok(())
203199
}
204200

205-
pub fn node_id(&self) -> NodeId {
201+
pub fn node_id(&self) -> EndpointId {
206202
self.inner
207203
.as_ref()
208204
.expect("inner not set")
209205
.endpoint
210-
.node_id()
206+
.id()
211207
}
212208
}
213209

214210
impl ProtocolHandler for IrohSsh {
215211
async fn accept(&self, connection: Connection) -> Result<(), iroh::protocol::AcceptError> {
216-
let node_id = connection.remote_node_id()?;
212+
let endpoint_id = connection.remote_id()?;
217213

218214
match connection.accept_bi().await {
219215
Ok((mut iroh_send, mut iroh_recv)) => {
220-
println!("Accepted bidirectional stream from {node_id}");
216+
println!("Accepted bidirectional stream from {endpoint_id}");
221217

222218
match TcpStream::connect(format!("127.0.0.1:{}", self.ssh_port)).await {
223219
Ok(mut ssh_stream) => {
@@ -333,9 +329,8 @@ pub fn dot_ssh(
333329
tracing::debug!("dot_ssh: Writing to pub_key: {}", pub_key.display());
334330
tracing::debug!("dot_ssh: Writing to priv_key: {}", priv_key.display());
335331

336-
let key = default_secret_key.clone();
337-
let secret_key = key.secret();
338-
let public_key = key.public();
332+
let secret_key = default_secret_key.clone();
333+
let public_key = secret_key.public();
339334

340335
match std::fs::write(&pub_key, z32::encode(public_key.as_bytes())) {
341336
Ok(_) => {
@@ -351,7 +346,7 @@ pub fn dot_ssh(
351346
}
352347
}
353348

354-
match std::fs::write(&priv_key, z32::encode(secret_key.as_bytes())) {
349+
match std::fs::write(&priv_key, z32::encode(&secret_key.to_bytes())) {
355350
Ok(_) => {
356351
tracing::info!("dot_ssh: Successfully wrote priv_key");
357352
}
@@ -365,7 +360,7 @@ pub fn dot_ssh(
365360
}
366361
}
367362

368-
Ok(key)
363+
Ok(secret_key)
369364
}
370365
}
371366
(true, false) => {

0 commit comments

Comments
 (0)