feat(docker): browser desktop image (Selkies Wayland + headed camofox) and optional TLS proxy

Selkies baseimage (debiantrixie, digest-pinned) with camofox 1.17.0 copied
from camofox-browser:1.17.0, run headed under labwc so the desktop shows the
same Firefox the agent drives. s6 service waits for wayland-0 and depends on
svc-de and svc-dbus so shutdown persists login state. Selkies control/view
passwords derive from CAMOFOX_ACCESS_KEY. Compose defaults to the new image;
CAMOFOX_IMAGE=camofox-browser:1.17.0 switches back. Optional caddy (profile tls).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 02:30:55 +08:00
1 parent 3f0327ad97
commit 880cec4d23
18 files changed
+235 -12

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
# labwc autostart(UMT 浏览器桌面):不自启应用;浏览器窗口由 svc-camofox(camofox-browser)按会话打开。
# 容器内输入法是备选(缺省用访问者本机输入法,由 Selkies 注入上屏文本);UMT_DESKTOP_IME=fcitx5 时启用
if [ "$UMT_DESKTOP_IME" = "fcitx5" ] && command -v fcitx5 >/dev/null 2>&1; then
fcitx5 -d --replace >/dev/null 2>&1 &
fi
@@ -0,0 +1,30 @@
#!/usr/bin/with-contenv bash
# UMT 浏览器桌面:在 linuxserver 的 init-selkies-config 之后、Selkies/桌面启动之前执行(root)。
# 1) Selkies 双口令:由 CAMOFOX_ACCESS_KEY 经 HMAC 派生(app 用同一算法),不另设密钥;
# 2) labwc autostart 每次覆盖(只起可选 fcitx5,不起终端等其它应用);
# 3) 登录状态目录(与旧 camofox 镜像同一个卷 /root/.camofox)交给运行用户 abc。
set -e
ENVDIR=/run/s6/container_environment
derive() { printf '%s' "$1" | openssl dgst -sha256 -hmac "$CAMOFOX_ACCESS_KEY" -r | cut -c1-48; }
if [ -n "${CAMOFOX_ACCESS_KEY}" ]; then
printf '%s' "$(derive umt-desktop/control)" > "$ENVDIR/SELKIES_BASIC_AUTH_PASSWORD"
printf '%s' "$(derive umt-desktop/view)" > "$ENVDIR/SELKIES_BASIC_AUTH_VIEWONLY_PASSWORD"
else
echo "[umt-desktop] CAMOFOX_ACCESS_KEY 未设置:桌面口令随机生成,app 无法接入桌面模式(原站视图回退截图模式)"
printf '%s' "$(openssl rand -hex 24)" > "$ENVDIR/SELKIES_BASIC_AUTH_PASSWORD"
printf '%s' "$(openssl rand -hex 24)" > "$ENVDIR/SELKIES_BASIC_AUTH_VIEWONLY_PASSWORD"
fi
# 口令只经 Selkies 自己的 basic auth 校验;nginx 层不开(设 PASSWORD 会让 nginx 只认单口令,拦掉只读口令)
printf 'true' > "$ENVDIR/SELKIES_ENABLE_BASIC_AUTH"
rm -f "$ENVDIR/PASSWORD" "$ENVDIR/PASSWD"
LABWC_DIR="$HOME/.config/labwc"
mkdir -p "$LABWC_DIR"
cp /defaults/autostart_wayland "$LABWC_DIR/autostart"
chown root:abc "$LABWC_DIR/autostart"
chmod 550 "$LABWC_DIR/autostart"
PROFILE_ROOT="$(dirname "${CAMOFOX_PROFILE_DIR:-/root/.camofox/profiles}")"
mkdir -p "${CAMOFOX_PROFILE_DIR:-/root/.camofox/profiles}"
chown -R abc:abc "$PROFILE_ROOT"
chmod 711 /root
@@ -0,0 +1 @@
oneshot
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-umt-desktop/run
@@ -0,0 +1,17 @@
#!/usr/bin/with-contenv bash
# camofox-browser 以有头模式跑在 labwc(应用合成器 wayland-0)里:桌面画面上的窗口就是 Agent 驱动的同一个 Firefox 进程。
SOCKET_PATH="${XDG_RUNTIME_DIR}/wayland-0"
until [ -e "${SOCKET_PATH}" ]; do sleep 0.5; done
export WAYLAND_DISPLAY=wayland-0
export DISPLAY=:0
export MOZ_ENABLE_WAYLAND="${MOZ_ENABLE_WAYLAND:-1}"
export CAMOFOX_INTERACTIVE=desktop
if [[ "${UMT_DESKTOP_IME,,}" == "fcitx5" ]]; then
# Wayland 下 Firefox 经 text-input-v3 接 fcitx5;不要设 GTK_IM_MODULE(会绕过 text-input-v3)
export XMODIFIERS=@im=fcitx
fi
# Selkies 的手柄/摄像头 LD_PRELOAD 不给浏览器
unset LD_PRELOAD
cd /opt/camofox
# exec:SIGTERM 直达 node,持久化插件关机落盘(docker/camofox/Dockerfile 同样的教训)
exec s6-setuidgid abc node --max-old-space-size="${MAX_OLD_SPACE_SIZE:-128}" server.js
@@ -0,0 +1 @@
longrun