diff options
author | Colin Walters <walters@verbum.org> | 2017-01-16 17:29:27 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-01-17 16:28:16 +0000 |
commit | ad4a7293f4cf52b248ad852563e6ce18285519ce (patch) | |
tree | 6c2f51436fa3e39a510d437484811b91f5963745 /demos | |
parent | 589666f851bf14622a97a2463bac63b48e4118a2 (diff) | |
download | bubblewrap-ad4a7293f4cf52b248ad852563e6ce18285519ce.tar.gz |
Add --unshare-all and --share-net
In discussion in https://github.com/projectatomic/bubblewrap/pull/150
it was noted that most of the bwrap command line tends towards "closed
by default, request open". But the `--unshare` options are inverse.
Now, I suspect in practice there's only one namespace that most users
will care about, which is the network namespace. There are very useful
programs to build on both cases.
I think everything else (pid, ipc, uts) people will want as a group.
Any cases that are unusual enough to want to turn one of them off
can still fall back to the previous bwrap behavior of explicitly
unsharing. They're likely to be security sensitive enough
that if a new namespace were added, it would make sense to evaluate
the tool.
But again I think most users will want all namespaces, with the network one as a
primary "enable it" option.
Closes: #153
Approved by: alexlarsson
Diffstat (limited to 'demos')
-rwxr-xr-x | demos/bubblewrap-shell.sh | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/demos/bubblewrap-shell.sh b/demos/bubblewrap-shell.sh index 9fccbd7..2f0bb1b 100755 --- a/demos/bubblewrap-shell.sh +++ b/demos/bubblewrap-shell.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash # Use bubblewrap to run /bin/sh reusing the host OS binaries (/usr), but with -# separate /tmp, /var, /run, and /etc. For /etc we just inherit the host's -# resolv.conf, and set up "stub" passwd/group files. +# separate /tmp, /home, /var, /run, and /etc. For /etc we just inherit the +# host's resolv.conf, and set up "stub" passwd/group files. Not sharing +# /home for example is intentional. If you wanted to, you could design +# a bwrap-using program that shared individual parts of /home, perhaps +# public content. # -# You can build on this example; for example, use --unshare-net to disable +# Another way to build on this example is to remove --share-net to disable # networking. set -euo pipefail (exec bwrap --ro-bind /usr /usr \ @@ -18,12 +21,8 @@ set -euo pipefail --symlink usr/bin /bin \ --symlink usr/sbin /sbin \ --chdir / \ - --unshare-pid \ - --unshare-user-try \ - --unshare-ipc \ - --unshare-net \ - --unshare-uts \ - --unshare-cgroup-try \ + --unshare-all \ + --share-net \ --dir /run/user/$(id -u) \ --setenv XDG_RUNTIME_DIR "/run/user/`id -u`" \ --setenv PS1 "bwrap-demo$ " \ |