595 Commits

Author SHA1 Message Date
Simon McVittie
74c76818a6 Merge pull request #400 from smcv/descendant
Fix typos for "descendant" in man page
2021-06-17 11:01:27 +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
8492c5fc4b Merge pull request #344 from mkrajnak/py3-tests-fix
Use python3 instead of python
2021-06-10 19:31:21 +01:00
Simon McVittie
40815dc6b5 Implement --perms and --chmod
This allows files and directories created programmatically by bubblewrap
to be made less permissive (as requested in #346) or more permissive
(as requested in #131 and #329).

Resolves: https://github.com/containers/bubblewrap/issues/131
Resolves: https://github.com/containers/bubblewrap/issues/329
Resolves: https://github.com/containers/bubblewrap/issues/346
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-10 19:04:20 +01:00
Simon McVittie
29a18ead61 Merge pull request #410 from haraldkubota/zsh_completion
Add zsh completion
2021-06-10 18:55:16 +01:00
Colin Walters
fdc3f23c97 Merge pull request #355 from TheJJ/fix-selinux-build
ensure pkg-config is found
2021-06-10 13:27:44 -04:00
Colin Walters
a7c070a966 Merge pull request #428 from cgwalters/test-multi-args
tests: Use --args multiple times
2021-06-10 13:24:56 -04:00
Colin Walters
9c889eb473 tests: Use --args multiple times
The code supports this today, so test it.
xref https://github.com/containers/bubblewrap/pull/426
where I thought it didn't.
2021-06-10 11:59:06 -04:00
Colin Walters
7d4f226323 Merge pull request #409 from smcv/mount-onto-socket
Don't require mount point for a non-directory to be a regular file
2021-06-10 11:33:18 -04:00
Simon McVittie
474d11579d Fix typos for "descendant" in man page
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-05-14 12:24:44 +01:00
Simon McVittie
a00f39fc4e Don't require mount point for a non-directory to be a regular file
Previously, mounting a socket over the top of an existing socket
would fail, because create_file() opens it with creat():

    $ test -e /run/systemd/resolve/io.systemd.Resolve && echo exists
    exists
    $ bwrap \
      --bind / / \
      --bind /run/systemd/resolve/io.systemd.Resolve \
             /run/systemd/resolve/io.systemd.Resolve \
      /bin/true
    bwrap: Can't create file at /run/systemd/resolve/io.systemd.Resolve: No such device or address

Tolerate the file existing as any type that we will be able to mount
a non-directory onto.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-05-14 12:23:41 +01:00
Harald Kubota
6e4c8bb12d Typo fix 2021-04-25 13:06:19 +09:00
Harald Kubota
bdeb727221 Copy _bwrap zsh completion on install 2021-04-25 12:51:54 +09:00
Colin Walters
dc4c266cc5 Merge pull request #421 from smcv/distcheck
workflows: List installed files and run distcheck
2021-04-19 20:45:24 -04:00
Colin Walters
edc214462f Merge pull request #419 from smcv/no-third-party-workflow
workflows: Remove third-party workflow
2021-04-19 20:45:07 -04:00
Simon McVittie
187918b1d1 workflows: List installed files and run distcheck
This helps to ensure that the build system is working correctly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-19 13:23:41 +01:00
Simon McVittie
4c3eb5b391 workflows: Remove third-party workflow
I copied this from Flatpak, but Colin was concerned about the trust
implications of this third-party dependency, and it doesn't seem
particularly important.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-19 10:20:07 +01:00
Colin Walters
33a9bd4f56 Merge pull request #417 from smcv/github-workflow
Add CI using Github workflows
2021-04-18 13:00:17 -04:00
Colin Walters
b86fdc75f7 Merge pull request #418 from smcv/disable-papr
Disable PAPR
2021-04-18 12:55:02 -04:00
Simon McVittie
ef3a107064 Disable PAPR
It has been decommissioned:
https://github.com/projectatomic/papr/issues/105

For now I've kept ci/papr.sh for reference.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-18 14:29:51 +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
Simon McVittie
4d948dc556 tests: Add a way to assert that bwrap is fully supported
If we're running on an operating system configuration where bwrap is
expected to work (unprivileged user namespace creation is allowed,
not in a chroot, not in a container, etc.), run with BWRAP_MUST_WORK=1.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-18 13:40:26 +01:00
Simon McVittie
7cf7c33cd2 libtest-core: On failure, make it clearer what has happened
If we fail as a result of `set -x`, It's often not completely obvious
which command failed or how. Use a trap on ERR to show the command that
failed, and its exit status.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-18 12:45:35 +01:00
Simon McVittie
4b5335c26b build: Make sure test-bwrap is executable
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-18 12:45:35 +01:00
Colin Walters
cfa39516c8 Merge pull request #405 from smcv/create-mountpoint-ro
Create files as mount points with read-only permissions
2021-04-16 09:16:58 -04:00
Simon McVittie
411135b279 Create files as mount points with read-only permissions
If two mount namespaces can both see a directory, and we bind-mount a
non-directory into that directory, we have to create a non-directory
to mount it onto:

    $ ls -l ~/tmp/mountpoint
    ls: cannot access '/home/smcv/tmp/mountpoint': No such file or directory
    $ bwrap --bind / / --bind /etc/os-release ~/tmp/mountpoint true
    $ ls -l ~/tmp/mountpoint
    -rw-rw-rw- 1 smcv smcv 0 Feb 16 10:27 /home/smcv/tmp/mountpoint

The mount point is currently created as an empty world-writable file,
but this doesn't seem like a least-astonishment thing to do.
Create it with read-only permissions instead, to make it clearer that
it's just a placeholder and prevent other users from filling it.

Resolves: https://github.com/containers/bubblewrap/issues/337
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-07 12:46:30 +01:00
Harald Kubota
6db33cdcb2 Fix --cap-add and --cap-drop completions 2021-03-12 21:23:04 +09:00
Harald Kubota
741f371e22 Add zsh completion 2021-03-12 21:10:06 +09:00
Colin Walters
e1b11e6592 Merge pull request #408 from giuseppe/fix-man-page
bwrap.xml: clarify BPF variant
2021-02-22 12:54:31 -05:00
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
Ludovico de Nittis
04c0ca17ad Add support for bind-mount on case-insensitive filesystems
If we are using a case-insensitive filesystem the bind-mount operation
might fail when `/proc/self/mountinfo` is checked.

In a case-insensitive filesystem, if we ask to mount a certain
directory, e.g. '/CI_fs/foo', the kernel might add its entry in
`mountinfo` as '/CI_fs/FOO'. This happens because the kernel populates
`mountinfo` with whatever case combination first appeared in the dcache.

With this patch we open the requested path and look at its
`/proc/self/fd`, using readlink(), to get the path case combination that
the kernel is also expected to be using.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-16 13:46:10 +01:00
Jonas Jelten
81af7d7d0e ensure pkg-config is found
bubblewrap uses pkg-config to find e.g. the selinux libraries.
pkg-config itself is not looked for if the path for the bash
completions is given by command line.
this call makes sure that pkg-config is found either way.

downstream bug: https://bugs.gentoo.org/674312
2020-12-13 17:17:36 +01:00
Alexander Larsson
bae85baf72 Merge pull request #389 from mwleeds/fix-op-shadow
Fix shadow of previous local
2020-09-14 10:34:16 +02:00
Phaedrus Leeds
a6f02a3043 Fix shadow of previous local
Fix the build failure in https://github.com/flatpak/flatpak/pull/3853
2020-09-11 21:07:19 -07:00
Colin Walters
4e310cadf6 Merge pull request #386 from juergbi/proc-erofs
Accept EROFS for access() check of /proc entries
2020-08-25 11:48:33 -04:00
Colin Walters
4f76b9e421 Merge pull request #383 from TimothyEBaldwin/fixtest
Fix broken test
2020-08-25 11:28:55 -04:00
Jürg Billeter
4c35d7a5f9 Accept EROFS for access() check of /proc entries
This is required to work in a Docker container.
2020-08-18 17:59:35 +02:00
Timothy E Baldwin
598e586c91 Fix Test - $BWRAP is inaccessable when run sudo root
Ironically, if running sudo root the path to test-bwrap may
be unreachable in the user namespace as root does not have
permission, and CAP_DAC_OVERRIDE only works for mapped uids.

Fix by using /proc/self/exe for nested bwrap.
2020-07-30 21:48:39 +01:00
Timothy E Baldwin
2564824e10 Fix Test - /proc mismatches pid namespace
`--bind /proc /proc` and `--unshare-all` results in `/proc` being
for the wrong pid namespace causing `namespace_ids_read` to fail,
either reading the wrong process dying with an error.

For example try: unshare -rpfm --mount-proc make check
2020-07-30 21:48:39 +01:00
Colin Walters
af30473596 Merge pull request #379 from smcv/no-new-typos
Correct name of PR_SET_NO_NEW_PRIVS in error message
2020-05-23 11:08:33 -04:00
Simon McVittie
e8f67bc6c9 Correct name of PR_SET_NO_NEW_PRIVS in error message
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-05-23 15:33:20 +01:00
Colin Walters
a9700fa13c Merge pull request #374 from TomSweeneyRedHat/sec
Add Security Policy
2020-05-19 14:42:14 -04:00
Colin Walters
04ad0edef0 Merge branch 'master' into sec 2020-05-19 14:42:02 -04:00
Colin Walters
4e9e6f7ee4 Merge pull request #377 from cgwalters/silence-is-golden
Add MS_SILENT to most mount() invocations
2020-05-19 08:21:05 -04:00
Colin Walters
765dd0e94f Add MS_SILENT to most mount() invocations
There's an effort to migrate Linux filesystems to handle the y2038
problem, which is great.  However, recently a kernel change landed
that emits a warning when mounting a filesystem that doesn't
handle it, and this notably shows up even when *remounting* e.g.
for a read-only bind mount:

Using e.g. `rpm-ostree install cowsay` there's a spam of:

```
[  189.529594] xfs filesystem being remounted at /sysroot supports timestamps until 2038 (0x7fffffff)
```

Now particularly when creating a our bind mounts, let's
ask the kernel to be quiet about it.  This is not a major event
worthy of a kernel log.
2020-05-18 21:20:43 +00:00
TomSweeneyRedHat
fade5ba881 Add Security Policy
As the title says

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-05-09 14:06:38 -04:00
Alexander Larsson
5feb64dc60 Bump version to 0.4.1 2020-03-30 15:10:44 +02:00
Alexander Larsson
1f7e2ad948 Merge pull request from GHSA-j2qp-rvxj-43vj
Fix setuid vulnerability
2020-03-30 15:08:41 +02:00
Alexander Larsson
38dd7e4bb8 Merge pull request #354 from ckastner/master
tests: Update output patterns for libcap >= 2.29
2020-03-30 12:46:53 +02:00
Alexander Larsson
6f815ceead drop_privs: More explicit argument name
changed_uid => already_changed_uid
2020-03-30 12:31:36 +02:00