mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-26 05:55:10 +03:00
init: sandbox: also map rootfs user 10000
Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
This commit is contained in:
parent
72aa31cc79
commit
53b3415f58
1 changed files with 35 additions and 12 deletions
|
@ -428,20 +428,43 @@ def become_user(uid: int, gid: int) -> None:
|
||||||
# Fork again for UID map, bweh this is suuuper gross
|
# Fork again for UID map, bweh this is suuuper gross
|
||||||
newpid = os.fork()
|
newpid = os.fork()
|
||||||
if newpid == 0:
|
if newpid == 0:
|
||||||
os.execl("/usr/bin/newuidmap", "newuidmap",
|
os.execl(
|
||||||
str(ppid),
|
"/usr/bin/newuidmap",
|
||||||
"0", str(uid), "1",
|
"newuidmap",
|
||||||
"1", "100000", "9999",
|
str(ppid),
|
||||||
# 12345 is the UID of the "pmos" or "build" user in our containers
|
"0",
|
||||||
"12345", "110000", "55536")
|
str(uid),
|
||||||
# str(uid+1), "110000", "55536")
|
"1",
|
||||||
|
"1",
|
||||||
|
"100000",
|
||||||
|
"9999",
|
||||||
|
# 12345 is the UID of the "pmos" or "build" user in our containers
|
||||||
|
"12345",
|
||||||
|
"110000",
|
||||||
|
"1",
|
||||||
|
"10000",
|
||||||
|
"120000",
|
||||||
|
"1",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
os.waitpid(newpid, 0)
|
os.waitpid(newpid, 0)
|
||||||
os.execl("/usr/bin/newgidmap", "newgidmap",
|
os.execl(
|
||||||
str(ppid),
|
"/usr/bin/newgidmap",
|
||||||
"0", str(uid), "1",
|
"newgidmap",
|
||||||
"1", "100000", "9999",
|
str(ppid),
|
||||||
"12345", "110000", "55536")
|
"0",
|
||||||
|
str(uid),
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
"100000",
|
||||||
|
"9999",
|
||||||
|
"12345",
|
||||||
|
"110000",
|
||||||
|
"1",
|
||||||
|
"10000",
|
||||||
|
"120000",
|
||||||
|
"1",
|
||||||
|
)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(e.strerror, flush=True)
|
print(e.strerror, flush=True)
|
||||||
os._exit(e.errno or 1)
|
os._exit(e.errno or 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue