diff options
author | Jürg Billeter <j@bitron.ch> | 2018-02-07 16:36:25 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-02-22 22:47:20 +0900 |
commit | 11f2de77287ff06d60b88452aa125a37de375030 (patch) | |
tree | 4433c429b0712a21b235a58d0b02fc0136545d6d /buildstream/sandbox | |
parent | b2197bc2aa7300ec9663686ce767aa02d78bbb99 (diff) | |
download | buildstream-11f2de77287ff06d60b88452aa125a37de375030.tar.gz |
Inherit user id and group id for bst shell
This allows D-Bus access.
Fixes #227
Diffstat (limited to 'buildstream/sandbox')
-rw-r--r-- | buildstream/sandbox/_sandboxbwrap.py | 4 | ||||
-rw-r--r-- | buildstream/sandbox/sandbox.py | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py index 71fd6951b..cab178f0f 100644 --- a/buildstream/sandbox/_sandboxbwrap.py +++ b/buildstream/sandbox/_sandboxbwrap.py @@ -130,7 +130,9 @@ class SandboxBwrap(Sandbox): # Set UID and GUI if self.user_ns_available: - bwrap_command += ['--unshare-user', '--uid', '0', '--gid', '0'] + bwrap_command += ['--unshare-user'] + if not flags & SandboxFlags.INHERIT_UID: + bwrap_command += ['--uid', '0', '--gid', '0'] # Add the command bwrap_command += command diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index bc080e30d..9f0a58628 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -61,6 +61,15 @@ class SandboxFlags(): the terminal entirely. """ + INHERIT_UID = 0x08 + """Whether to use the user id and group id from the host environment + + This determines if processes in the sandbox should run with the + same user id and group id as BuildStream itself. By default, + processes run with user id and group id 0, protected by a user + namespace where available. + """ + class Sandbox(): """Sandbox() |