Files
secgate-vpn-docker/docker-entrypoint.sh
yuez f04ce9dcbb feat: 多架构镜像(linux/amd64 + linux/arm64,均用厂商原生包)
- 厂商按架构发包:amd64 海光麒麟 1.1.3.1010701,arm64 鲲鹏麒麟 1.1.5.1010901
  (飞腾麒麟同一文件),均为 AArch64/x86-64 原生二进制
- Dockerfile 用 buildx 的 TARGETARCH 选 deb,一次构建出双架构 manifest
- fetch-client-deb.sh 支持按架构取包 / fetch-all;CI 缓存两个 deb 并逐一校验 md5
- CI: setup-qemu 模拟 arm64 RUN;PR 用 --load 的 amd64 镜像跑冒烟,
  另加原生 arm64 runner(ubuntu-24.04-arm)跑同一套冒烟
- 新增 scripts/smoke-image.sh:起临时容器验证 Xvfb/noVNC/SOCKS5/GUI 进程
  存活 + ELF 机器码与镜像架构一致(make smoke)
- 镜像 tag 不再含客户端版本号(两架构版本不同),版本写入
  /opt/sslvpnclient/.client-version 并由 entrypoint 打印
- verify.sh 同时校验两个 deb;README/vendor 文档更新
2026-11-13 17:05:04 +08:00

56 lines
1.9 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 启动 Xvfb + openbox + x11vnc + noVNC + microsocks,然后拉起 SecGate Access 图形客户端。
set -uo pipefail
export DISPLAY="${DISPLAY:-:1}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/tmp/runtime-root}"
export HOME="${HOME:-/root}"
SCREEN="${SCREEN:-1280x800x24}"
mkdir -p "$XDG_RUNTIME_DIR" /opt/sslvpnclient/log
chmod 700 "$XDG_RUNTIME_DIR"
log() { echo "[entrypoint] $*"; }
if [ -f /opt/sslvpnclient/.client-version ]; then
log "客户端版本 $(cat /opt/sslvpnclient/.client-version)($(uname -m))"
fi
cleanup() {
log "收到退出信号,清理子进程"
jobs -p | xargs -r kill 2>/dev/null
wait 2>/dev/null
}
trap cleanup EXIT INT TERM
# 1) X 服务器(软件 GL,Qt Quick 不依赖真实 GPU)
log "启动 Xvfb $DISPLAY ($SCREEN)"
Xvfb "$DISPLAY" -screen 0 "$SCREEN" -nolisten tcp +extension GLX +render -noreset \
>/tmp/xvfb.log 2>&1 &
for _ in $(seq 1 50); do
xdpyinfo -display "$DISPLAY" >/dev/null 2>&1 && break
sleep 0.2
done
xdpyinfo -display "$DISPLAY" >/dev/null 2>&1 && log "X 就绪" || log "警告:X 未就绪"
# 2) 窗口管理器(Qt 的对话框/弹窗需要,否则二次认证窗口可能不显示)
openbox >/tmp/openbox.log 2>&1 &
# 3) VNC + WebSocket 桥接(noVNC 默认页面 /vnc.html)
x11vnc -display "$DISPLAY" -forever -shared -nopw -rfbport 5900 \
-noxdamage -repeat -quiet -o /tmp/x11vnc.log &
log "启动 noVNC http://0.0.0.0:6080/vnc.html"
websockify --web=/usr/share/novnc 6080 127.0.0.1:5900 >/tmp/websockify.log 2>&1 &
# 4) SOCKS5 出口(登录成功后容器内流量经 tun0 进内网)
microsocks -i 0.0.0.0 -p 1080 &
# 5) 图形客户端(容器内已是 root,官方 gui_start.sh 的 pkexec 不需要)
log "启动 sslvpn 图形客户端"
while true; do
/opt/sslvpnclient/files/bin/sslvpn >>/opt/sslvpnclient/log/gui.out 2>&1
rc=$?
log "sslvpn 退出 (rc=$rc),3 秒后重启"
sleep 3
done