bind a namespaced agent's socket dir off /run so its owner maps to the agent user
This commit is contained in:
parent
23f4f1823b
commit
6847ed865a
1 changed files with 53 additions and 7 deletions
|
|
@ -54,7 +54,7 @@ let
|
|||
++ [
|
||||
{
|
||||
host_path = nsSocketDir;
|
||||
container_path = nsSocketDir;
|
||||
container_path = "/agents/${nsAgent}/sockets";
|
||||
read_only = false;
|
||||
}
|
||||
];
|
||||
|
|
@ -368,6 +368,9 @@ pkgs.testers.runNixOSTest {
|
|||
assert as_ns(f"cat /agents/{NS_AGENT}/state/pre.txt") == "before"
|
||||
assert as_ns(f"stat -c %u:%g /agents/{NS_AGENT}/state/pre.txt") == "1000:1000"
|
||||
as_ns(f"echo after > /agents/{NS_AGENT}/state/post.txt")
|
||||
# The socket dir is bound off /run (an owneridmap mount point under the
|
||||
# container's /run tmpfs would belong to root) and linked back.
|
||||
assert as_ns(f"readlink /run/hive-agent/{NS_AGENT}") == f"/agents/{NS_AGENT}/sockets"
|
||||
as_ns(f"touch /run/hive-agent/{NS_AGENT}/web.sock")
|
||||
assert as_ns(f"cat /agents/{NS_AGENT}/config/cfg") == "from-config"
|
||||
host.fail(f"nixos-container run {NS} -- runuser -l {NS_AGENT} -c 'touch /agents/{NS_AGENT}/config/new'")
|
||||
|
|
|
|||
Loading…
Reference in a new issue