11 Commits

Author SHA1 Message Date
Simon McVittie
1927981240 Add a Meson build system
This allows bwrap to be built as a subproject in larger Meson projects.
When built as a subproject, we install into the --libexecdir and
require a program prefix to be specified: for example, Flatpak would use
program_prefix=flatpak- to get /usr/libexec/flatpak-bwrap. Verified to
be backwards-compatible as far as Meson 0.49.0 (Debian 9 backports).

Loosely based on previous work by Jussi Pakkanen (see #133).

Differences between the Autotools and Meson builds:

The Meson build requires a version of libcap that has pkg-config
metadata (introduced in libcap 2.23, in 2013).

The Meson build has no equivalent of --with-priv-mode=setuid. On
distributions like Debian <= 10 and RHEL <= 7 that require a setuid bwrap
executable, the sysadmin or distribution packaging will need to set the
correct permissions on the bwrap executable; Debian already did this via
packaging rather than the upstream build system.

The Meson build supports being used as a subproject, and there is CI
for this. It automatically disables shell completions and man pages,
moves the bubblewrap executable to ${libexecdir}, and renames the
bubblewrap executable according to a program_prefix option that the
caller must specify (for example, Flatpak would use
-Dprogram_prefix=flatpak- to get /usr/libexec/flatpak-bwrap). See the
tests/use-as-subproject/ directory for an example.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-18 10:42:55 +00:00
a1346054
d69d21b036 bash: Fix shellcheck warnings
Signed-off-by: a1346054 <36859588+a1346054@users.noreply.github.com>
2021-10-14 14:40:10 +02:00
a1346054
f2a2dbbeb9 bash: Invoke bash using /usr/bin/env
Signed-off-by: a1346054 <36859588+a1346054@users.noreply.github.com>
2021-10-14 14:40:10 +02:00
Simon McVittie
0fe6aebfab Remove obsolete papr CI
We no longer use this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-31 12:29:54 +01:00
Simon McVittie
5ab38c734e Stop installing python-is-python2 for CI
Merging #344 made this unnecessary.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-10 19:32:49 +01:00
Simon McVittie
be95ff6156 Add CI using Github workflows
Loosely based on the configuration used in Flatpak.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-18 13:41:11 +01:00
Giuseppe Scrivano
56609f8647 bwrap, pivot_root: do not require write access to the rootfs
Keep a reference to the previous working directory and use it for the
umount.

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

Closes: #256
Approved by: cgwalters
2018-04-30 16:50:19 +00:00
Colin Walters
abc5664456 Retain all caps when invoked by uid 0, work around systemd seccomp filter
In <https://github.com/projectatomic/bubblewrap/pull/101>, specifically
commit cde7fab7ec we started dropping
all capabilities, even if the caller was privileged.

This broke rpm-ostree, which runs RPM scripts using bwrap, and some
of those scripts depend on capabilities (mostly `CAP_DAC_OVERRIDE`).

Fix this by retaining capabilities by default if the caller's uid is zero.

I considered having the logic be to simply retain any capabilities the invoking
process has (imagine filecaps binaries like `ping` or
`/usr/bin/gnome-keyring-daemon` using bwrap) but we currently explicitly abort
in that scenario to catch broken packages which used file capabilites for bwrap
itself (we switched to suid). For now this works, and if down the line there's a
real-world use case for capability-bearing non-zero-uid processes to invoke
bwrap *and* retain those privileges, we can revisit.

Another twist here is that we need to do some gymnastics to first avoid calling
`capset()` if we don't need to, as that can fail due to systemd installing a
seccomp filter that denies it (for dubious reasons).  Then we also need to ignore
`EPERM` when dropping caps in the init process.  (I considered unilaterally
handling `EPERM`, but it seems nicer to avoid calling `capset()` unless we need to)

Closes: https://github.com/projectatomic/bubblewrap/issues/197

Closes: #205
Approved by: alexlarsson
2017-08-14 13:46:34 +00:00
Jonathan Lebon
9c0753aa5a ci: rename files to new name and bump to f26
Rename the YAML file and its auxiliary files to the newly supported
name and bump tests to use F26.

Closes: #202
Approved by: cgwalters
2017-08-02 15:47:35 +00:00
Colin Walters
a27841ed09 ci: Disable ASAN leak checking
If you read the logs, ASAN gets confused by us using PID namespaces.
Perhaps we could figure out an API to change this later, but in
the meantime, let's disable leak checks.

We still get use-after-free detection.

Closes: #170
Approved by: alexlarsson
2017-01-27 10:49:31 +00:00
Colin Walters
a26b09ae8c ci: Revamp to actually run the tests
Previously we were just building in a container, now we actually run the test
script.

This explicitly does builds in a container still, and only installs
the bwrap binaries into the host's `/usr`.  Down the line I think
we can enable better support for this model in redhat-ci.

Closes: #160
Approved by: jlebon
2017-01-23 18:07:49 +00:00