mirror of
https://github.com/valoq/bwscripts.git
synced 2023-12-13 21:30:26 +01:00
59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
echo -n $RANDOM | md5sum | tr -d '-' > /tmp/fakeid
|
|
(
|
|
exec bwrap \
|
|
--ro-bind /usr/bin/ /usr/bin/ \
|
|
--ro-bind /usr/share/ /usr/share/ \
|
|
--ro-bind /usr/lib /usr/lib \
|
|
--ro-bind /usr/lib32 /usr/lib32 \
|
|
--ro-bind /lib /lib \
|
|
--ro-bind /lib64 /lib64 \
|
|
--ro-bind /lib32 /lib32 \
|
|
--ro-bind /libx32 /libx32 \
|
|
--ro-bind /bin /bin \
|
|
--ro-bind /sbin /sbin \
|
|
--proc /proc \
|
|
--dev /dev \
|
|
--dev-bind /dev/snd /dev/snd \
|
|
--ro-bind /tmp/.X11-unix /tmp/.X11-unix \
|
|
--ro-bind /etc/passwd /etc/passwd \
|
|
--ro-bind /etc/group /etc/group \
|
|
--ro-bind /etc/hostname /etc/hostname \
|
|
--ro-bind /etc/hosts /etc/hosts \
|
|
--ro-bind /etc/localtime /etc/localtime \
|
|
--ro-bind /etc/nsswitch.conf /etc/nsswitch.conf \
|
|
--ro-bind /etc/resolv.conf /etc/resolv.conf \
|
|
--ro-bind /etc/xdg /etc/xdg \
|
|
--ro-bind /etc/gtk-2.0 /etc/gtk-2.0 \
|
|
--ro-bind /etc/gtk-3.0 /etc/gtk-3.0 \
|
|
--ro-bind /etc/X11 /etc/X11 \
|
|
--ro-bind /etc/fonts /etc/fonts \
|
|
--ro-bind /etc/mime.types /etc/mime.types \
|
|
--ro-bind /etc/pulse /etc/pulse \
|
|
--ro-bind /tmp/fakeid /etc/machine-id \
|
|
--tmpfs /run \
|
|
--ro-bind ~/.Xauthority /home/jail/.Xauthority \
|
|
--bind ~/.mozilla /home/jail/.mozilla \
|
|
--bind ~/.cache/mozilla /home/jail/.cache/mozilla \
|
|
--bind ~/Downloads /home/jail/Downloads \
|
|
--chdir /home/jail \
|
|
--unsetenv DBUS_SESSION_BUS_ADDRESS \
|
|
--unsetenv XDG_RUNTIME_DIR \
|
|
--setenv SHELL /bin/false \
|
|
--setenv HOME /home/jail \
|
|
--setenv XAUTHORITY /home/jail/.Xauthority \
|
|
--setenv USER nobody \
|
|
--setenv LOGNAME nobody \
|
|
--unshare-all \
|
|
--share-net \
|
|
--new-session \
|
|
--seccomp 10 \
|
|
10< /usr/local/bin/seccomp_default_filter.bpf \
|
|
/usr/bin/firefox
|
|
)
|
|
|
|
|
|
|
|
|