You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Reproduce
Consider the following use-case: I'm trying to change uid of a process running inside the jail.
For that purpose I use std::os::unix::process::CommandExt.uid.
In code:
let stopped_jail = StoppedJail::new(&path).name("container 42").param("vnet",Value::Int(1)).param("enforce_statfs",Value::Int(1)).unwrap();Command::new(command).jail(&jail).uid(uid).gid(gid).spawn().unwrap();
The spawn call returns EPERM error.
Expected behavior
The spawn call succeeds
Additional context
Underlying issue is jail_attach call. Per man page
The jail_attach() and jail_remove() system calls will fail if:
[EPERM] A user other than the super-user attempted to attach
to or remove a jail.
stdlib calls setuid here, before calling pre-exec hooks here. Since the process uid set to a non-priveleged user, alas, we fail.
Possible workarounds
Either
Attempt to change stdlib (unrealistically)
exec.jail_user. Well, not quite. It's not uid, not sure if it works for jail_attach.
just create another hook to call setuid there!
WDYT?
The text was updated successfully, but these errors were encountered:
Could this uid workaround method be added to the jail::Jailed trait? It's a breaking change, but I don't think would present much friction to downstream users, especially if we gave it a different name like jail_uid so that it doesn't conflict with CommandExt::uid.
Describe the bug
Inability to set uid of a jailed process.
To Reproduce
Consider the following use-case: I'm trying to change uid of a process running inside the jail.
For that purpose I use std::os::unix::process::CommandExt.uid.
In code:
The spawn call returns EPERM error.
Expected behavior
The spawn call succeeds
Additional context
Underlying issue is
jail_attach
call. Per man pagestdlib calls setuid here, before calling pre-exec hooks here. Since the process uid set to a non-priveleged user, alas, we fail.
Possible workarounds
Either
exec.jail_user
. Well, not quite. It's not uid, not sure if it works forjail_attach
.WDYT?
The text was updated successfully, but these errors were encountered: