一键导入
dockerizing-vpn-clients
Use when containerizing VPN clients into Docker, supporting both GUI (VNC) and CLI (Web management) modes with danted SOCKS5 proxy
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when containerizing VPN clients into Docker, supporting both GUI (VNC) and CLI (Web management) modes with danted SOCKS5 proxy
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when the user mentions Calibre 草稿、元数据草稿、删除书籍草稿、drafts API、 批量更新元数据、批量提交元数据、批量删除书籍、清理标签草稿、撤销草稿、 元数据搜索、在线元数据、/api/drafts、/api/drafts/update、/api/drafts/cancel、 /api/drafts/delete、/api/metadata/search,或需要向 Calibre 配套服务提交待审核的 元数据修改、删除书籍请求或搜索在线元数据。
Use when the user asks to check disk status, report on hard disk health, temperature, or SMART data, or when performing routine server maintenance.
Calibre 书库入库质量筛选。通过元数据检查识别不合格书籍:非中文、色情内容、 日系漫画、作者/出版社含邮箱、低质出版源、元数据缺失等。 Use when the user mentions 书籍筛选, 书库清理, 不合格书籍, 质量检查, 书籍审核, or wants to screen/filter/review books in Calibre library.
只读访问个人 Calibre 书库,通过 AJAX API 搜索、浏览、下载书籍。支持按 标题/作者/标签/ISBN 搜索,按作者/出版社/标签/丛书分类浏览,获取书籍详情与 元数据,下载 epub/mobi/pdf 等格式。Use when the user mentions Calibre, 书库, 找书, 下载书籍, 搜书, or wants to browse/search/download books. FORBIDDEN: Any write/modify/delete operations.
Grafana Alloy HCL 配置文件编写指南。涵盖基本语法、核心组件(Loki/Prometheus)、日志采集、数据处理流水线及 FnOS 特定配置模式。Use when editing .alloy files, configuring Grafana Alloy, setting up log pipelines, or debugging Alloy configurations.
飞牛 fnOS FPK 应用包开发指南。涵盖目录结构、manifest 配置、生命周期脚本、用户向导、权限管理、resource 资源声明和桌面图标配置。Use when developing fnOS FPK packages, creating fnOS apps, writing cmd scripts, configuring wizard/manifest/privilege/resource, desktop icons, ui/config, or when the user mentions 飞牛、fnOS、fpk。
| name | dockerizing-vpn-clients |
| description | Use when containerizing VPN clients into Docker, supporting both GUI (VNC) and CLI (Web management) modes with danted SOCKS5 proxy |
将 VPN 客户端封装到 Docker 容器中,提供 SOCKS5 代理出口。支持两种模式:GUI 客户端使用 VNC,CLI 客户端使用 Web 管理界面。
VPN 客户端是否有 GUI?
├─ YES → 模式 A: VNC + Supervisor
│ ├─ xvfb 虚拟显示
│ ├─ x11vnc/tigervnc 远程访问
│ └─ 轻量桌面 (XFCE4/flwm)
│
└─ NO → 模式 B: Web 管理 + lighttpd
├─ lighttpd 提供 Web UI
├─ CGI 脚本封装 VPN 命令
└─ 前端展示状态/控制连接
| 组件 | 作用 | 工具选择 |
|---|---|---|
| VPN 客户端 | 建立 VPN 隧道,创建 tun0 | 原厂客户端 |
| 代理层 | SOCKS5 代理出口 | danted (端口 1080) |
| 管理层 | 用户交互界面 | VNC / lighttpd+CGI |
| 网络层 | NAT 转发 | iptables MASQUERADE |
Dockerfile 基础设置
debian:12-slimxvfb, x11vnc, supervisor, xfce4, dante-serverDISPLAY=:0, VNC_PASSWORDSupervisor 进程管理
[program:xvfb]
command=Xvfb :0 -screen 0 1024x768x24
priority=1
[program:x11vnc]
command=x11vnc -display :0 -forever -rfbport 5900 -rfbauth /root/.vnc/passwd
priority=2
[program:vpn]
command=/opt/start.sh
priority=3
端口暴露: 5900 (VNC), 1080 (SOCKS5)
Dockerfile 基础设置
debian:12-slimlighttpd, dante-server, curl, iproute2, iptables/var/www/html/ 和 /var/www/cgi-bin/lighttpd 配置
server.modules = ("mod_indexfile", "mod_cgi", "mod_alias")
server.port = 8080
cgi.assign = ( ".cgi" => "" )
$HTTP["url"] =~ "^/cgi-bin/" {
alias.url = ( "/cgi-bin/" => "/var/www/cgi-bin/" )
}
CGI API 端点
?action=status - 查询连接状态?action=connect - 执行连接?action=disconnect - 断开连接端口暴露: 8080 (Web), 1080 (SOCKS5)
(while true; do
sleep 5
if [ -d /sys/class/net/tun0 ] && ! pgrep -x danted > /dev/null 2>&1; then
su daemon -s /bin/sh -c "/usr/sbin/danted -f /run/danted.conf"
fi
done) &
externals=""
for iface in $({ ip -f inet -o addr; ip -f inet6 -o addr; } | sed -E 's/^[0-9]+: ([^ ]+) .*/\1/'); do
externals="${externals}external: $iface\\n"
done
sed s/^#external-lines/"$externals"/ -i /run/danted.conf
update-alternatives --set iptables /usr/sbin/iptables-legacy 2>/dev/null || true
iptables -t nat -C POSTROUTING -o tun0 -j MASQUERADE 2>/dev/null || \
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
# 拒绝 tun0 侧主动连接
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i tun0 -p tcp -j DROP
echo "Content-Type: application/json"
echo ""
echo '{"success": true, "data": {...}}'
| 文件 | 用途 | 模式 |
|---|---|---|
Dockerfile.gui | GUI 模式镜像 | GUI |
Dockerfile.cli | CLI 模式镜像 | CLI |
supervisord.conf | Supervisor 进程管理 | GUI |
start-gui.sh | GUI 模式启动脚本 | GUI |
start.sh | CLI 模式启动脚本 | CLI |
danted.conf | SOCKS5 代理配置 | 通用 |
lighttpd.conf | Web 服务器配置 | CLI |
api.cgi | CGI API 脚本 | CLI |
所有模板位于 templates/ 目录。
# GUI 模式
docker run -d --name vpn \
--cap-add NET_ADMIN \
--device /dev/net/tun \
-p 5900:5900 \
-p 1080:1080 \
-v ./config:/opt/vpn/conf \
vpn-client:gui
# CLI 模式
docker run -d --name vpn \
--cap-add NET_ADMIN \
--device /dev/net/tun \
-p 8080:8080 \
-p 1080:1080 \
-v ./config:/opt/vpn/conf \
vpn-client:cli
实现前检查:
实现后验证:
curl --socks5 localhost:1080 ...)| 错误做法 | 正确做法 |
|---|---|
| 在 tun0 创建前启动 danted | 后台循环检测 tun0 后启动 |
| 直接使用 iptables-nft | 切换到 iptables-legacy |
| 硬编码网络接口 | 动态检测所有接口 |
| 同步等待 VPN 连接 | 后台重试,不阻塞启动 |