difftreelog
feat remowt user identity
in: trunk
5 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -308,9 +308,9 @@
[[package]]
name = "bifrostlink"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fb01af731c11dd31b23783a83a36a29f644cc1972481f6fa4f4fabc709079eb"
+checksum = "0c8ce9dc1425ee2aaffd3324548f114acccd456b9b1ffb33fe9eb9a7be6475a8"
dependencies = [
"async-trait",
"async_fn_traits",
@@ -322,14 +322,13 @@
"serde_json",
"tokio",
"tracing",
- "uuid",
]
[[package]]
name = "bifrostlink-macros"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c4b7a5fb38b36bd81910c17ebf369f9296e508d92b1277a768a63c8a2254fdb"
+checksum = "a7d071add2d3b90486fe141edb2e811f7735155d320aee3936ebd67e535d6ac1"
dependencies = [
"proc-macro2",
"quote",
@@ -338,9 +337,9 @@
[[package]]
name = "bifrostlink-ports"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "977acfcb8ed3c24ab7c2f76fb3eeebff1533c72708733ce6020f2501980b7cf2"
+checksum = "ccf6ba32d0ff83b27a242f9d2fca124ad215ddd9bf99144d66b7ca44a885de50"
dependencies = [
"bifrostlink",
"bytes",
@@ -1777,7 +1776,7 @@
[[package]]
name = "polkit-backend"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"clap",
@@ -1951,7 +1950,7 @@
[[package]]
name = "remowt-agent"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"bifrostlink",
@@ -1976,7 +1975,7 @@
[[package]]
name = "remowt-client"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"bifrostlink",
@@ -1998,7 +1997,7 @@
[[package]]
name = "remowt-endpoints"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"bifrostlink",
"camino",
@@ -2013,7 +2012,7 @@
[[package]]
name = "remowt-link-shared"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"bifrostlink",
"bytes",
@@ -2027,7 +2026,7 @@
[[package]]
name = "remowt-plugin"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"bifrostlink",
@@ -2040,7 +2039,7 @@
[[package]]
name = "remowt-polkit-shared"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"nix",
"serde",
@@ -2049,7 +2048,7 @@
[[package]]
name = "remowt-ssh"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"clap",
@@ -2064,7 +2063,7 @@
[[package]]
name = "remowt-ui-prompt"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"anyhow",
"bifrostlink",
Cargo.tomldiffbeforeafterboth1[workspace]2members = ["cmds/*", "crates/*"]3resolver = "2"45[workspace.package]6version = "0.1.7"7license = "MIT"8edition = "2021"9repository = "https://git.delta.rocks/r/remowt"1011[workspace.dependencies]12remowt-client = { version = "0.1.7", path = "crates/remowt-client" }13remowt-polkit-shared = { version = "0.1.7", path = "crates/polkit-shared" }14remowt-link-shared = { version = "0.1.7", path = "crates/remowt-link-shared" }15remowt-plugin = { version = "0.1.7", path = "crates/remowt-plugin" }16remowt-ui-prompt = { version = "0.1.7", path = "crates/remowt-ui-prompt" }17remowt-endpoints = { version = "0.1.7", path = "crates/remowt-endpoints" }1819bifrostlink = "0.2.0"20bifrostlink-macros = "0.2.0"21bifrostlink-ports = "0.2.0"2223camino = { version = "1.2.2", features = ["serde1"] }24anyhow = "1.0.86"25bytes = "1.11.0"26clap = "4.5.16"27futures = "0.3.30"28nix = "0.31.3"29pam-client = "0.5.0"30russh = { version = "0.61.2", default-features = false, features = [31 "ring",32 "flate2",33 "rsa",34] }35russh-config = "0.58.0"36serde = "1.0.228"37serde_json = "1.0.149"38tempfile = "3"39tokio = { version = "1.39.3", features = ["fs"] }40tokio-util = "0.7.11"41tracing = "0.1.40"42tracing-subscriber = "0.3.18"43uuid = "1.10.0"44zbus = "5.16.0"45zbus_polkit = "5.0.0"46thiserror = "2.0.18"4748[profile.release]49panic = "unwind"50opt-level = "z"51lto = true52codegen-units = 153debug = "full"54split-debuginfo = "off"1[workspace]2members = ["cmds/*", "crates/*"]3resolver = "2"45[workspace.package]6version = "0.1.8"7license = "MIT"8edition = "2021"9repository = "https://git.delta.rocks/r/remowt"1011[workspace.dependencies]12remowt-client = { version = "0.1.8", path = "crates/remowt-client" }13remowt-polkit-shared = { version = "0.1.8", path = "crates/polkit-shared" }14remowt-link-shared = { version = "0.1.8", path = "crates/remowt-link-shared" }15remowt-plugin = { version = "0.1.8", path = "crates/remowt-plugin" }16remowt-ui-prompt = { version = "0.1.8", path = "crates/remowt-ui-prompt" }17remowt-endpoints = { version = "0.1.8", path = "crates/remowt-endpoints" }1819bifrostlink = "0.2.0"20bifrostlink-macros = "0.2.0"21bifrostlink-ports = "0.2.0"2223camino = { version = "1.2.2", features = ["serde1"] }24anyhow = "1.0.86"25bytes = "1.11.0"26clap = "4.5.16"27futures = "0.3.30"28nix = "0.31.3"29pam-client = "0.5.0"30russh = { version = "0.61.2", default-features = false, features = [31 "ring",32 "flate2",33 "rsa",34] }35russh-config = "0.58.0"36serde = "1.0.228"37serde_json = "1.0.149"38tempfile = "3"39tokio = { version = "1.39.3", features = ["fs"] }40tokio-util = "0.7.11"41tracing = "0.1.40"42tracing-subscriber = "0.3.18"43uuid = "1.10.0"44zbus = "5.16.0"45zbus_polkit = "5.0.0"46thiserror = "2.0.18"4748[profile.release]49panic = "unwind"50opt-level = "z"51lto = true52codegen-units = 153debug = "full"54split-debuginfo = "off"cmds/remowt-ssh/src/main.rsdiffbeforeafterboth--- a/cmds/remowt-ssh/src/main.rs
+++ b/cmds/remowt-ssh/src/main.rs
@@ -53,8 +53,14 @@
let bundle = AgentBundle::from_dir(agents_dir()?)?;
let (conn, escalate) = match &opts {
- Opts::Ssh { host, escalate } => (Remowt::connect(host, &bundle).await?, *escalate),
- Opts::Local { escalate } => (Remowt::connect_local(&bundle).await?, *escalate),
+ Opts::Ssh { host, escalate } => (
+ Remowt::connect(host, &bundle, "remowt-ssh".to_owned()).await?,
+ *escalate,
+ ),
+ Opts::Local { escalate } => (
+ Remowt::connect_local(&bundle, "remowt-ssh".to_owned()).await?,
+ *escalate,
+ ),
};
let mut rpc = conn.rpc();
crates/remowt-client/src/lib.rsdiffbeforeafterboth--- a/crates/remowt-client/src/lib.rs
+++ b/crates/remowt-client/src/lib.rs
@@ -249,6 +249,7 @@
#[allow(dead_code)]
children: Mutex<Vec<tokio::process::Child>>,
_runtime_tmp: Option<TempDir>,
+ user: String,
}
#[derive(Clone)]
@@ -259,7 +260,7 @@
impl Remowt {
/// Connect to the remote host over ssh, detect the architecture and deploy the required
/// agent binary.
- pub async fn connect(host: &str, bundle: &AgentBundle) -> Result<Self> {
+ pub async fn connect(host: &str, bundle: &AgentBundle, remowt_user: String) -> Result<Self> {
let conf = russh_config::parse_home(host)?;
let port = conf.host_config.port.or(conf.port).unwrap_or(22);
let hostname = conf
@@ -337,11 +338,12 @@
elevated: tokio::sync::OnceCell::new(),
children: Mutex::new(Vec::new()),
_runtime_tmp: None,
+ user: remowt_user,
})))
}
/// "Connect" to the local machine's agent, by starting the agent binary locally.
- pub async fn connect_local(bundle: &AgentBundle) -> Result<Self> {
+ pub async fn connect_local(bundle: &AgentBundle, user: String) -> Result<Self> {
let agent_path = bundle.local_binary()?;
let mut child = tokio::process::Command::new(&agent_path)
.arg("real-agent")
@@ -368,6 +370,7 @@
elevated: tokio::sync::OnceCell::new(),
children: Mutex::new(vec![child]),
_runtime_tmp: runtime_tmp,
+ user,
})))
}
@@ -431,6 +434,14 @@
args.push("-w".to_owned());
args.push(tool.to_owned());
args.extend(flags.iter().copied().map(str::to_owned));
+ if tool == "run0" {
+ args.push(format!(
+ "--unit={}-{}-{}.scope",
+ self.0.user,
+ std::process::id(),
+ Uuid::new_v4()
+ ));
+ }
args.push(agent_path);
args.push("real-agent".to_owned());
args.push("--privileged".to_owned());
crates/remowt-endpoints/Cargo.tomldiffbeforeafterboth--- a/crates/remowt-endpoints/Cargo.toml
+++ b/crates/remowt-endpoints/Cargo.toml
@@ -11,7 +11,13 @@
serde = { workspace = true }
tempfile.workspace = true
thiserror.workspace = true
-tokio = { workspace = true, features = ["net", "io-util", "rt", "process"] }
+tokio = { workspace = true, features = [
+ "net",
+ "io-util",
+ "rt",
+ "process",
+ "io-std",
+] }
tracing.workspace = true
nix = { workspace = true, features = ["process", "signal", "term"] }
zbus.workspace = true