git.delta.rocks / remowt / refs/commits / 11447649e1e7

difftreelog

feat remowt user identity

nulpnyxpYaroslav Bolyukin2 days agoparent: #075f103.patch.diff
in: trunk

5 files changed

modifiedCargo.lockdiffbeforeafterboth
308308
309[[package]]309[[package]]
310name = "bifrostlink"310name = "bifrostlink"
311version = "0.2.6"311version = "0.2.7"
312source = "registry+https://github.com/rust-lang/crates.io-index"312source = "registry+https://github.com/rust-lang/crates.io-index"
313checksum = "2fb01af731c11dd31b23783a83a36a29f644cc1972481f6fa4f4fabc709079eb"313checksum = "0c8ce9dc1425ee2aaffd3324548f114acccd456b9b1ffb33fe9eb9a7be6475a8"
314dependencies = [314dependencies = [
315 "async-trait",315 "async-trait",
316 "async_fn_traits",316 "async_fn_traits",
322 "serde_json",322 "serde_json",
323 "tokio",323 "tokio",
324 "tracing",324 "tracing",
325 "uuid",
326]325]
327326
328[[package]]327[[package]]
329name = "bifrostlink-macros"328name = "bifrostlink-macros"
330version = "0.2.6"329version = "0.2.7"
331source = "registry+https://github.com/rust-lang/crates.io-index"330source = "registry+https://github.com/rust-lang/crates.io-index"
332checksum = "8c4b7a5fb38b36bd81910c17ebf369f9296e508d92b1277a768a63c8a2254fdb"331checksum = "a7d071add2d3b90486fe141edb2e811f7735155d320aee3936ebd67e535d6ac1"
333dependencies = [332dependencies = [
334 "proc-macro2",333 "proc-macro2",
335 "quote",334 "quote",
338337
339[[package]]338[[package]]
340name = "bifrostlink-ports"339name = "bifrostlink-ports"
341version = "0.2.6"340version = "0.2.7"
342source = "registry+https://github.com/rust-lang/crates.io-index"341source = "registry+https://github.com/rust-lang/crates.io-index"
343checksum = "977acfcb8ed3c24ab7c2f76fb3eeebff1533c72708733ce6020f2501980b7cf2"342checksum = "ccf6ba32d0ff83b27a242f9d2fca124ad215ddd9bf99144d66b7ca44a885de50"
344dependencies = [343dependencies = [
345 "bifrostlink",344 "bifrostlink",
346 "bytes",345 "bytes",
17771776
1778[[package]]1777[[package]]
1779name = "polkit-backend"1778name = "polkit-backend"
1780version = "0.1.7"1779version = "0.1.8"
1781dependencies = [1780dependencies = [
1782 "anyhow",1781 "anyhow",
1783 "clap",1782 "clap",
19511950
1952[[package]]1951[[package]]
1953name = "remowt-agent"1952name = "remowt-agent"
1954version = "0.1.7"1953version = "0.1.8"
1955dependencies = [1954dependencies = [
1956 "anyhow",1955 "anyhow",
1957 "bifrostlink",1956 "bifrostlink",
19761975
1977[[package]]1976[[package]]
1978name = "remowt-client"1977name = "remowt-client"
1979version = "0.1.7"1978version = "0.1.8"
1980dependencies = [1979dependencies = [
1981 "anyhow",1980 "anyhow",
1982 "bifrostlink",1981 "bifrostlink",
19981997
1999[[package]]1998[[package]]
2000name = "remowt-endpoints"1999name = "remowt-endpoints"
2001version = "0.1.7"2000version = "0.1.8"
2002dependencies = [2001dependencies = [
2003 "bifrostlink",2002 "bifrostlink",
2004 "camino",2003 "camino",
20132012
2014[[package]]2013[[package]]
2015name = "remowt-link-shared"2014name = "remowt-link-shared"
2016version = "0.1.7"2015version = "0.1.8"
2017dependencies = [2016dependencies = [
2018 "bifrostlink",2017 "bifrostlink",
2019 "bytes",2018 "bytes",
20272026
2028[[package]]2027[[package]]
2029name = "remowt-plugin"2028name = "remowt-plugin"
2030version = "0.1.7"2029version = "0.1.8"
2031dependencies = [2030dependencies = [
2032 "anyhow",2031 "anyhow",
2033 "bifrostlink",2032 "bifrostlink",
20402039
2041[[package]]2040[[package]]
2042name = "remowt-polkit-shared"2041name = "remowt-polkit-shared"
2043version = "0.1.7"2042version = "0.1.8"
2044dependencies = [2043dependencies = [
2045 "nix",2044 "nix",
2046 "serde",2045 "serde",
20492048
2050[[package]]2049[[package]]
2051name = "remowt-ssh"2050name = "remowt-ssh"
2052version = "0.1.7"2051version = "0.1.8"
2053dependencies = [2052dependencies = [
2054 "anyhow",2053 "anyhow",
2055 "clap",2054 "clap",
20642063
2065[[package]]2064[[package]]
2066name = "remowt-ui-prompt"2065name = "remowt-ui-prompt"
2067version = "0.1.7"2066version = "0.1.8"
2068dependencies = [2067dependencies = [
2069 "anyhow",2068 "anyhow",
2070 "bifrostlink",2069 "bifrostlink",
modifiedCargo.tomldiffbeforeafterboth
3resolver = "2"3resolver = "2"
44
5[workspace.package]5[workspace.package]
6version = "0.1.7"6version = "0.1.8"
7license = "MIT"7license = "MIT"
8edition = "2021"8edition = "2021"
9repository = "https://git.delta.rocks/r/remowt"9repository = "https://git.delta.rocks/r/remowt"
1010
11[workspace.dependencies]11[workspace.dependencies]
12remowt-client = { version = "0.1.7", path = "crates/remowt-client" }12remowt-client = { version = "0.1.8", path = "crates/remowt-client" }
13remowt-polkit-shared = { version = "0.1.7", path = "crates/polkit-shared" }13remowt-polkit-shared = { version = "0.1.8", path = "crates/polkit-shared" }
14remowt-link-shared = { version = "0.1.7", path = "crates/remowt-link-shared" }14remowt-link-shared = { version = "0.1.8", path = "crates/remowt-link-shared" }
15remowt-plugin = { version = "0.1.7", path = "crates/remowt-plugin" }15remowt-plugin = { version = "0.1.8", path = "crates/remowt-plugin" }
16remowt-ui-prompt = { version = "0.1.7", path = "crates/remowt-ui-prompt" }16remowt-ui-prompt = { version = "0.1.8", path = "crates/remowt-ui-prompt" }
17remowt-endpoints = { version = "0.1.7", path = "crates/remowt-endpoints" }17remowt-endpoints = { version = "0.1.8", path = "crates/remowt-endpoints" }
1818
19bifrostlink = "0.2.0"19bifrostlink = "0.2.0"
20bifrostlink-macros = "0.2.0"20bifrostlink-macros = "0.2.0"
modifiedcmds/remowt-ssh/src/main.rsdiffbeforeafterboth
54 let bundle = AgentBundle::from_dir(agents_dir()?)?;54 let bundle = AgentBundle::from_dir(agents_dir()?)?;
55 let (conn, escalate) = match &opts {55 let (conn, escalate) = match &opts {
56 Opts::Ssh { host, escalate } => (Remowt::connect(host, &bundle).await?, *escalate),56 Opts::Ssh { host, escalate } => (
57 Remowt::connect(host, &bundle, "remowt-ssh".to_owned()).await?,
58 *escalate,
59 ),
57 Opts::Local { escalate } => (Remowt::connect_local(&bundle).await?, *escalate),60 Opts::Local { escalate } => (
61 Remowt::connect_local(&bundle, "remowt-ssh".to_owned()).await?,
62 *escalate,
63 ),
58 };64 };
59 let mut rpc = conn.rpc();65 let mut rpc = conn.rpc();
modifiedcrates/remowt-client/src/lib.rsdiffbeforeafterboth
249 #[allow(dead_code)]249 #[allow(dead_code)]
250 children: Mutex<Vec<tokio::process::Child>>,250 children: Mutex<Vec<tokio::process::Child>>,
251 _runtime_tmp: Option<TempDir>,251 _runtime_tmp: Option<TempDir>,
252 user: String,
252}253}
253254
254#[derive(Clone)]255#[derive(Clone)]
259impl Remowt {260impl Remowt {
260 /// Connect to the remote host over ssh, detect the architecture and deploy the required261 /// Connect to the remote host over ssh, detect the architecture and deploy the required
261 /// agent binary.262 /// agent binary.
262 pub async fn connect(host: &str, bundle: &AgentBundle) -> Result<Self> {263 pub async fn connect(host: &str, bundle: &AgentBundle, remowt_user: String) -> Result<Self> {
263 let conf = russh_config::parse_home(host)?;264 let conf = russh_config::parse_home(host)?;
264 let port = conf.host_config.port.or(conf.port).unwrap_or(22);265 let port = conf.host_config.port.or(conf.port).unwrap_or(22);
265 let hostname = conf266 let hostname = conf
337 elevated: tokio::sync::OnceCell::new(),338 elevated: tokio::sync::OnceCell::new(),
338 children: Mutex::new(Vec::new()),339 children: Mutex::new(Vec::new()),
339 _runtime_tmp: None,340 _runtime_tmp: None,
341 user: remowt_user,
340 })))342 })))
341 }343 }
342344
343 /// "Connect" to the local machine's agent, by starting the agent binary locally.345 /// "Connect" to the local machine's agent, by starting the agent binary locally.
344 pub async fn connect_local(bundle: &AgentBundle) -> Result<Self> {346 pub async fn connect_local(bundle: &AgentBundle, user: String) -> Result<Self> {
345 let agent_path = bundle.local_binary()?;347 let agent_path = bundle.local_binary()?;
346 let mut child = tokio::process::Command::new(&agent_path)348 let mut child = tokio::process::Command::new(&agent_path)
347 .arg("real-agent")349 .arg("real-agent")
368 elevated: tokio::sync::OnceCell::new(),370 elevated: tokio::sync::OnceCell::new(),
369 children: Mutex::new(vec![child]),371 children: Mutex::new(vec![child]),
370 _runtime_tmp: runtime_tmp,372 _runtime_tmp: runtime_tmp,
373 user,
371 })))374 })))
372 }375 }
373376
431 args.push("-w".to_owned());434 args.push("-w".to_owned());
432 args.push(tool.to_owned());435 args.push(tool.to_owned());
433 args.extend(flags.iter().copied().map(str::to_owned));436 args.extend(flags.iter().copied().map(str::to_owned));
437 if tool == "run0" {
438 args.push(format!(
439 "--unit={}-{}-{}.scope",
440 self.0.user,
441 std::process::id(),
442 Uuid::new_v4()
443 ));
444 }
434 args.push(agent_path);445 args.push(agent_path);
435 args.push("real-agent".to_owned());446 args.push("real-agent".to_owned());
436 args.push("--privileged".to_owned());447 args.push("--privileged".to_owned());
modifiedcrates/remowt-endpoints/Cargo.tomldiffbeforeafterboth
15 "net",
16 "io-util",
17 "rt",
18 "process",
19 "io-std",
20] }
15tracing.workspace = true21tracing.workspace = true
16nix = { workspace = true, features = ["process", "signal", "term"] }22nix = { workspace = true, features = ["process", "signal", "term"] }