Unhardcode user IDs

This commit is contained in:
Val Packett 2025-12-05 04:48:37 -03:00
parent fa0bf056d0
commit ea34b7b08c
3 changed files with 14 additions and 4 deletions

View file

@ -18,3 +18,4 @@ rustix = { version = "1.0.8", features = ["fs"] }
url = "2.5.4"
rand = "0.9.2"
futures = "0.3.31"
libc = "0.2.178"

View file

@ -43,6 +43,14 @@ struct BrokerCli {
/// Unix socket path to listen on for the VM bus
#[clap(long)]
unix_path: Option<PathBuf>,
/// The user ID for the appvm user inside of the guest
#[clap(long, default_value = "1337")]
guest_uid: u32,
/// The group ID for the appvm group inside of the guest
#[clap(long, default_value = "1337")]
guest_gid: u32,
}
async fn new_hosted_bus() -> eyre::Result<(
@ -129,9 +137,9 @@ async fn main() -> eyre::Result<()> {
"--socket-path",
cli.runtime_dir.join("fs.sock").to_str().unwrap(),
"--uid-map",
":1000:1001:1:",
&format!(":{}:{}:1:", cli.guest_uid, unsafe { libc::getuid() }),
"--gid-map",
":100:100:1:",
&format!(":{}:{}:1:", cli.guest_gid, unsafe { libc::getgid() }),
"--log-level",
"debug",
])