askrobots / dbbasic-browser
Public
A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.
danq9
site icons (favicons) in tabs, address bar suggestions and the bookmarks panel
7249579
15 hours, 50 minutes ago
History
linux-sandbox.sh · 1.4 KB · 37 lines
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # |
| 4 | # Let Chromium's page sandbox start on Linux systems that restrict unprivileged user namespaces (Ubuntu 24.04 and later). |
| 5 | # |
| 6 | # sudo apps/browser/scripts/linux-sandbox.sh /path/to/electron |
| 7 | # |
| 8 | # On those systems the browser stops at start-up with "The SUID sandbox helper binary was found, but is not configured |
| 9 | # correctly". This loads an AppArmor profile that allows user namespaces for that one binary, and nothing else. The |
| 10 | # sandbox itself stays on, so --no-sandbox is never needed. Run it again when the binary moves. |
| 11 | # |
| 12 | # Elsewhere it does nothing: no AppArmor, or no restriction. |
| 13 | set -eu |
| 14 | |
| 15 | bin=${1:?usage: linux-sandbox.sh /path/to/electron} |
| 16 | [ -x "$bin" ] || { echo "not an executable: $bin" >&2; exit 2; } |
| 17 | case "$bin" in *'"'*) echo "path must not contain a double quote" >&2; exit 2 ;; esac |
| 18 | |
| 19 | restrict=/proc/sys/kernel/apparmor_restrict_unprivileged_userns |
| 20 | if [ ! -r "$restrict" ] || [ "$(cat "$restrict")" != 1 ]; then |
| 21 | echo "user namespaces are not restricted here; nothing to do" |
| 22 | exit 0 |
| 23 | fi |
| 24 | command -v apparmor_parser >/dev/null || { echo "apparmor_parser not found" >&2; exit 1; } |
| 25 | |
| 26 | profile=/etc/apparmor.d/dbbasic-electron |
| 27 | cat > "$profile" <<EOF |
| 28 | abi <abi/4.0>, |
| 29 | include <tunables/global> |
| 30 | |
| 31 | profile dbbasic-electron "$bin" flags=(unconfined) { |
| 32 | userns, |
| 33 | include if exists <local/dbbasic-electron> |
| 34 | } |
| 35 | EOF |
| 36 | apparmor_parser -r "$profile" |
| 37 | echo "loaded $profile for $bin" |