23 Commits

Author SHA1 Message Date
Hugo Osvaldo Barrera
d165751294 Drop support for Python<3.4 in demo code
This version of python reached its EOL in March 2019.

Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
2023-11-02 19:23:05 +01: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
Martin Krajnak
a744bda314 Use python3 for userns-block-fd.py 2020-01-17 14:40:05 +01:00
Simon McVittie
3c488585bd userns-block-fd: Add support for Python 3
According to PEP 394, the python command is meant to be Python 2
until at least 2020, so in practice this script will be run with
Python 2 for now (except on Arch Linux); but it seems good to be
more future-proof.

In Python 3, os.write() takes a bytestring (bytes object), not a
text string (str/unicode object). In Python 2 ≥ 2.6, the b'' syntax
is supported and gives a str object, because that was a bytestring
in Python 2; either way, b'1' is an acceptable argument to os.write().

In Python ≥ 3.4, the result of os.pipe() is close-on-exec
(non-inheritable) by default, so undo that where needed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #246
Approved by: giuseppe
2017-11-03 17:55:16 +00:00
Simon McVittie
b8fa270e89 userns-block-fd: Search the PATH for bwrap
This means we can use it with an installed bwrap, which seems a more
common use of a demo script than a just-compiled bwrap, and is
consistent with the shell scripts.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #246
Approved by: giuseppe
2017-11-03 17:55:16 +00:00
Simon McVittie
30338c3f0d userns-block-fd: Search $PATH for python
On systems without the /usr merge, it's almost certainly in /usr,
so this script would have failed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #246
Approved by: giuseppe
2017-11-03 17:55:16 +00:00
Giuseppe Scrivano
0bffcf1679 demos: add demo userns-block-fd.py
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #101
Approved by: alexlarsson
2017-06-29 23:02:32 +00:00
Colin Walters
b8e6e1159e demos/shell: Use --die-with-parent
As I said in the release notes, I think the majority of use cases want this,
which includes this interactive shell.

Closes: #189
Approved by: alexlarsson
2017-03-29 06:25:24 +00:00
Colin Walters
ad4a7293f4 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
2017-01-17 16:28:16 +00:00
Alexander Larsson
a6e15164f9 demos/bubblewrap-shell.sh: Unshare all namespaces
Lets demo things as sandboxed as possible.

Closes: #154
Approved by: cgwalters
2017-01-17 13:43:49 +00:00
Colin Walters
e8e47a9dd4 demo/shell: Add /var/tmp compat symlink, tweak PS1, add more docs
I was working on rpm-ostree's use of bwrap and realized we weren't setting up
/var/tmp. I think this should be a best practice for app compatibility.

I also took the opportunity to expand the docs a bit, and overriding PS1 helps
users know they're in the container shell.

Closes: #137
Approved by: alexlarsson
2017-01-11 17:35:06 +00:00
Matthias Clasen
95a2ded375 Update xdg-app references
Rename the example from xdg-app to flatpak, just for consistency.

Closes: #86
Approved by: cgwalters
2016-07-22 21:08:41 +00:00
Alexander Larsson
05435925ae Clean up demo shells using bash redirection features 2016-03-07 14:36:35 +01:00
Alexander Larsson
b77727bb2a Add xdg-app demo bpf file 2016-02-29 15:34:35 +01:00
Alexander Larsson
46037fc88f Add seccomp support 2016-02-29 14:44:23 +01:00
Alexander Larsson
05762b42fb Make commandline args shorter, drom --mount and --make prefixes
Its pretty obvious (in this context) what e.g. --bind does. Having
unnecessary large names just makes things harder to read.
2016-02-29 10:50:25 +01:00
Alexander Larsson
db1782164e Refresh bubblewrap-shell demo
This adds host (ro) resolv.conf, minimal passwd/group and sets
XDG_RUNTIME_DIR.
2016-02-19 12:11:43 +01:00
Alexander Larsson
56de89e0cd xdg-app demo: Clean up tmpfiles 2016-02-19 12:05:21 +01:00
Alexander Larsson
1cfadbd225 Add --setenv and --unsetenv args 2016-02-19 11:53:31 +01:00
Alexander Larsson
e0c16e5643 Fix up xdg-app-run demo to use the right /etc/passwd file
This accidentally used the passwd file twice
2016-02-19 11:40:31 +01:00
Alexander Larsson
4dbb24709b xdg-app-demo: Use less features 2016-02-19 11:35:27 +01:00
Alexander Larsson
c79b61e90a Rename binary to bwrap
This is shorter and less cutesy
2016-02-18 08:45:44 +01:00
Colin Walters
a998dedf7d Move xdg-app-run.sh into demos/, add new bubblewrap-shell.sh
Let's accumulate use cases/tests here.
2016-02-17 17:36:21 -05:00