1
0
mirror of https://github.com/projectatomic/bubblewrap.git synced 2026-02-06 09:46:09 +01:00
Commit Graph

35 Commits

Author SHA1 Message Date
Giuseppe Scrivano
4af205a7f1 bwrap.xml: clarify BPF variant
seccomp uses cBPF, not eBPF.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-22 17:02:01 +01:00
Alexander Larsson
46c7f1cca5 Add support for --pidns
This allows a sandbox to share a pid namespace with another sandbox.
For this to work the namespace passed in must be owned by the user
namespace that bwrap is using, which implies either that you pass in
--userns pointing, or run under that user namespace already. In the
former case you'd typically take the userns from a running bwrap
--unshare-user instance, whereas the second case happens when using
bwrap in the setuid mode without user namespaces.

If both --unshare-pid and --pidns are specified then we first
switch to the pid namespace, and then unshare from there. This is
useful if you want a pid-isolated sandob that is visible to another
sandbox.

The implementation is a bit tricky, as it needs to fork() in order
to activate the setns():ed pid namespaces, which means we have to
pass through the final pid via a socket to make the kernel translate
the pid to the initial pid namespace for us to waitpid() on it.
2019-11-26 09:28:51 +01:00
Alexander Larsson
75c2d94de8 Add support for --userns and --userns2
This allows you to reuse an existing user namespace to set up all the
other namespaces, entering that instead of creating a new one.  The
reason you want to do this is that you can then also reuse other
namespaces that are owned by the user namespace. Typically you use
this to partially re-enter a previoulsy created bubblewrap sandbox.

This also adds --userns2 which is similar to --userns, but this is
switched into at the end instead of the start. Bubblewrap sometimes
creates nested such user namespaces[1], and to be able to reuse such a
setup we need to similarly reuse both namespaces via --userns2.

Technically using setns() is probably safe even in the privileged
case, because we got passed in a file descriptor to the namespace, and
that can only be gotten if you have ptrace permissions against the
target, and then you could do whatever to the namespace
anyway. However, for practical reasons this isn't useable for bwrap,
because (as described in a comment in acquire_privs()) setuid mode
causes root to own the namespaces that it creates. So as you will not
be able to access these namespaces for reuse anyway, its best to
disable it (in case of unexpected security issues).

[1] This is to work around an issue with mounting devpts without uid 0
mapped in the user namespace, where the outer namespace owns all the
other namespaces but the inner one has the right mappings.
2019-11-22 11:11:32 +01:00
Jakub Wilk
cc44544f8c Fix typos
Closes: #302
Approved by: smcv
2019-02-26 17:14:25 +00:00
Simon McVittie
591b9dd90f man page: Describe --chdir, not nonexistent --cwd
Fixes: https://github.com/projectatomic/bubblewrap/issues/291
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #292
Approved by: cgwalters
2018-10-01 12:52:30 +00:00
Patrick Griffis
d3515d80d4 Add --bind-try options
These ignore source files not existing which allows bwrap using
applications to avoid repeatedly checking if files exist.

Closes: #283
Approved by: alexlarsson
2018-08-09 13:01:15 +00:00
chocolateboy
62e42c971f Fix doc typo
Closes: #280
Approved by: cgwalters
2018-07-26 13:20:26 +00:00
Giuseppe Scrivano
6724b418e9 bubblewrap: add option --userns-block-fd
It allows to configure the user namespace from outside.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #101
Approved by: alexlarsson
2017-06-29 23:02:31 +00:00
Giuseppe Scrivano
71660f4101 bubblewrap: add --cap-add and --cap-drop
When using namespaces, permit to leave some capabilities in the
sandbox.  This can be helpful to run a system instance of systemd.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #101
Approved by: alexlarsson
2017-06-29 23:02:31 +00:00
Giuseppe Scrivano
6e778109aa bubblewrap: add --as-pid-1
It allows to run a process with PID=1 in the new pid namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-06-13 22:13:51 +02:00
Marek Jarycki
b6370de0fc Add --die-with-parent
In scenarios such as running bwrap in test frameworks (`bwrap make check`),
one wants all of the processes to go away if the parent process
dies, or if the bwrap process is directly killed.

This ensures that in all cases (both with `--unshare-pid` and without), we use
`prctl(PR_SET_PDEATHSIG)` on both our outer and inner init procesesses if
`--die-with-parent` is specified.

Tests-by: Colin Walters <walters@verbum.org>

Closes: #165
Approved by: emdej
2017-02-27 21:15:11 +00:00
valoq
6388977429 Added --unshare-all to manpage
Updated the manpage to include the new --unshare-all option
Closes: #161
Approved by: cgwalters
2017-01-21 20:13:34 +00:00
Alexander Larsson
06a7f31fe4 Make the call to setsid() optional, with --new-session
This means we stay compatible with apps using the old bwrap, yet
still makes it easy to avoid CVE-2017-5226 in apps using bwrap.

Also, recommend that applications not using --new-session should
use a seccomp filter for the TIOCSTI ioctl to avoid the input
injection issue.

Closes: #154
Approved by: cgwalters
2017-01-17 13:43:49 +00:00
Colin Walters
9d368eece4 man: Correct namespace user -> mount
Closes: #141

Closes: #144
Approved by: valoq
2017-01-10 15:51:33 +00:00
Alexander Larsson
da38d86508 Add --ro-bind-data, which is the same as --bind-data but readonly
I need this for flatpak to create a sandbox-specific file that
the app can't modify.

Closes: #98
Approved by: alexlarsson
2016-09-07 09:31:24 +00:00
Chad Versace
d5fdb96ee0 manpage: Document option --unshare-user-try
Closes: #96
Approved by: rhatdan
2016-09-02 12:54:37 +00:00
Chad Versace
500e86860a Fix --unshare-user in manpage
The manpage lists non-existent option --share-user. It should be
--unshare-user.

Closes: #95
Approved by: rhatdan
2016-09-02 12:52:06 +00:00
Yawning Angel
75f86d30ef Add --hostname HOSTNAME.
This makes `--unshare-uts` actually useful by allowing the user to
specify a custom hostname for the newly created UTS namespace.

Implements #93.

Closes: #94
Approved by: alexlarsson
2016-09-02 09:33:58 +00:00
Alexander Larsson
3ebe54af1b Merge pull request #92 from giuseppe/bwrap-oci-hooks
Add `--block-fd` and `--info-fd` so to be able to manage OCI hooks.
2016-08-26 14:56:35 +02:00
Giuseppe Scrivano
beb8aa1a74 Implement info-fd
Add an interface for retrieving information about the child process.

For now the only information exported is the child pid, it is needed to
manage prestart OCI hooks, as the container pid must be provided to the
hook process.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-08-26 14:51:22 +02:00
Giuseppe Scrivano
f206c6d072 Implement block-fd
it is useful to manage OCI prestart hooks, as the container process is
blocked on block_fd until the hooks are processed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-08-26 14:50:28 +02:00
Giuseppe Scrivano
e4188b1d24 Add --remount-ro DEST
This allows to remount a mount point as read only.

It will allow us, by remounting / after other mount points are created,
to handle a readonly rootfs as specified in the OCI specs:

https://github.com/opencontainers/runtime-spec/blob/master/config.md#root-configuration

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-08-12 12:26:46 +02:00
Mrunal Patel
f41af1ff04 Add support for --try-unshare-cgroup flag
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

This flag will unshare cgroups only if supported else will skip it.

Closes: #62
Approved by: alexlarsson
2016-05-12 20:20:35 +00:00
Mrunal Patel
9d3c07c0c7 Add support for --unshare-cgroup
This requires linux kernel version 4.6 or higher.
We check for the presence of /proc/self/ns/cgroup
to determine if it is supported or not.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Closes: #62
Approved by: alexlarsson
2016-05-12 20:20:35 +00:00
Mrunal Patel
f525e670b8 Update documentation for --mqueue
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Closes: #59
Approved by: alexlarsson
2016-05-07 06:37:50 +00:00
Alexander Larsson
8a53e3a664 Add --tmpfs argument
This is very useful if you want to cover some area of the filesystem,
or if you want to make some part of a read-only tree writable.

Closes: #42
Approved by: cgwalters
2016-05-06 11:05:11 +00:00
Dan Walsh
506fb1b162 Add SELinux Support
Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Pull request: #25
Approved by: alexlarsson
2016-03-22 09:33:46 +00:00
Alexander Larsson
81d3aa11f5 Clarify filesystem ops in manpage 2016-03-08 17:11:45 +01:00
Alexander Larsson
4b87d00edf Merge pull request #18 from matthiasclasen/man
Some more documentation work
2016-03-08 17:08:33 +01:00
Matthias Clasen
2ecee82f19 docs: Some more intro
Explain that bwrap is not really an end-user tool.
2016-03-08 10:28:40 -05:00
Matthias Clasen
502e388616 docs: Add an Environment section
Only HOME appears here, but still.
2016-03-08 10:24:12 -05:00
Matthias Clasen
eaa7f3f8dc docs: Explain --seccomp data format
Well, at least point to the libseccomp api that generates it.
2016-03-08 10:17:48 -05:00
Matthias Clasen
122f3ffa4c docs: Add details about options
Document the effect of repeated options.
2016-03-08 10:17:10 -05:00
Alexander Larsson
08b93a15a2 fix up manpage 2016-03-08 15:30:55 +01:00
Matthias Clasen
cb8262c651 Add a man page for bwrap
This does use docbook stylesheets and xsltproc. If we want to
avoid that build dependency, we can just generate it once and
be done.
2016-03-07 17:28:36 -05:00