dsh-vpn 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/THIRD_PARTY_NOTICES.md +177 -0
- package/assets/vpn-ops.md +46 -0
- package/cordis.patch.yml +11 -0
- package/lib/client.js +1346 -0
- package/lib/index.js +20820 -0
- package/lib/skill.js +54 -0
- package/package.json +84 -0
- package/scripts/vpn.sh +644 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AIcivilization
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# dsh-vpn
|
|
2
|
+
|
|
3
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件:在 dsh 里填好 VPS 的 IP、端口、用户名和密码,一键部署 sing-box,然后扫二维码导入代理客户端。
|
|
4
|
+
|
|
5
|
+
- **不依赖本机的 ssh 命令**:内置纯 JS 的 SSH 客户端([ssh2](https://github.com/mscdex/ssh2)),用密码登录。
|
|
6
|
+
- **两种用法**:在设置页点按钮,或者直接对 agent 说“帮我装个节点”。
|
|
7
|
+
- **五种协议可选**:VLESS Reality、Hysteria2(默认)、TUIC v5、AnyTLS、Shadowsocks 2022。
|
|
8
|
+
- **免域名的正规证书**:可选 Let's Encrypt 为服务器 IP 签发的证书,所有客户端都能正常校验证书。
|
|
9
|
+
|
|
10
|
+
## 使用
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
dsh plugin --profile web add dsh-vpn
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
打开 dsh →「插件」→ dsh-vpn:
|
|
17
|
+
|
|
18
|
+
1. 填写服务器 IP、SSH 端口、用户名、密码,点「保存」和「测试连接」。
|
|
19
|
+
2. 勾选要安装的协议,选择证书类型(推荐「IP 证书」),保存后点「安装 / 更新」。
|
|
20
|
+
3. 在「节点二维码」里点「刷新」,用手机或电脑上的客户端扫码导入。
|
|
21
|
+
4. 在云服务商控制台的安全组里放行页面提示的端口。用 IP 证书时,TCP 80 端口要一直开放,用于续期。
|
|
22
|
+
|
|
23
|
+
## 证书
|
|
24
|
+
|
|
25
|
+
| 类型 | 适合 | 客户端校验 |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| 自签证书(默认) | 不想开放 80 端口 | Hysteria2 锁定证书指纹;TUIC 和 AnyTLS 的链接无法锁定,客户端会跳过校验 |
|
|
28
|
+
| IP 证书(推荐) | 大多数情况 | 所有协议都正常校验证书,不需要域名 |
|
|
29
|
+
|
|
30
|
+
IP 证书由 sing-box 1.14 内置的 ACME 向 Let's Encrypt 申请([2026 年起正式提供](https://letsencrypt.org/2026/01/15/6day-and-ip-general-availability)),通过 80 端口完成 HTTP 验证。证书有效期 6 天,由 sing-box 自动续期。
|
|
31
|
+
|
|
32
|
+
- 签发失败(常见原因是 80 端口没开):自动退回自签证书,节点仍可使用,页面会提示原因。
|
|
33
|
+
- 80 端口被其他程序占用:直接拒绝,不改动正在运行的节点。
|
|
34
|
+
- 「查看状态」会显示证书剩余时间;剩余不到 24 小时仍未续期时会发出警告,因为证书过期后客户端将无法连接。
|
|
35
|
+
|
|
36
|
+
## 安全设计
|
|
37
|
+
|
|
38
|
+
| 方面 | 做法 |
|
|
39
|
+
|---|---|
|
|
40
|
+
| 密码存储 | 存在 dsh 凭据库(`$DSH_HOME/.credentials.yaml`,权限 0600),不写进配置文件;浏览器只能写入,读不回来 |
|
|
41
|
+
| 接口鉴权 | 设置页的接口挂在 dsh 自己的 `/api` 下,复用 dsh 的登录 cookie 和防跨站、防 DNS rebinding 检查 |
|
|
42
|
+
| 主机指纹 | 首次连接时记录 SSH 主机指纹,之后指纹变化就拒绝连接,防止中间人截获密码 |
|
|
43
|
+
| sudo | 非 root 用户用 `sudo -S`:密码只经 stdin 传入,不会出现在命令行,也不会传给脚本 |
|
|
44
|
+
| agent 操作 | agent 安装或卸载前会弹出审批,提示语言跟随电脑系统语言,并写明目标服务器、协议,以及是否重新生成密钥 |
|
|
45
|
+
| 证书 | 推荐用 IP 证书,所有协议都正常校验;自签模式下 Hysteria2 锁定指纹,TUIC 和 AnyTLS 会标注“需跳过证书校验” |
|
|
46
|
+
|
|
47
|
+
## 组成
|
|
48
|
+
|
|
49
|
+
| 路径 | 作用 |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `scripts/vpn.sh` | 在服务器上运行的安装脚本,也可以单独使用:`ssh vps 'sudo bash -s -- install --protocols reality,hy2' < scripts/vpn.sh` |
|
|
52
|
+
| `src/ssh.ts` / `src/remote.ts` | SSH 连接、主机指纹锁定、上传并执行脚本 |
|
|
53
|
+
| `src/core.ts` | 统一的操作入口(设置页和 agent 共用),同一时间只执行一个操作 |
|
|
54
|
+
| `src/settings.ts` / `src/credential-store.ts` | 服务器设置的校验和存储 |
|
|
55
|
+
| `src/api.ts` | 设置页调用的 `/api/dsh-vpn/*` 接口 |
|
|
56
|
+
| `src/index.ts` | agent 工具 `vpn_install` / `vpn_status` / `vpn_links` / `vpn_uninstall`,以及执行前的审批 |
|
|
57
|
+
| `src/client/` | 浏览器端:设置页、二维码 |
|
|
58
|
+
| `src/skill.ts` + `assets/vpn-ops.md` | `vpn-ops` 技能:操作流程和排障 |
|
|
59
|
+
|
|
60
|
+
## 远端落盘位置
|
|
61
|
+
|
|
62
|
+
- `/usr/local/bin/sing-box`
|
|
63
|
+
- `/etc/dsh-vpn/`:`state.env`(密钥、端口、已选协议、证书类型)、`config.json`、`cert/`(自签证书)、`acme/`(IP 证书,由 sing-box 维护)
|
|
64
|
+
- `/etc/systemd/system/dsh-vpn.service`
|
|
65
|
+
- `/etc/sysctl.d/99-dsh-vpn.conf`:开启 BBR
|
|
66
|
+
|
|
67
|
+
## 开发与测试
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm install
|
|
71
|
+
pnpm test # 单元测试(进程内的假 SSH 服务器,不联网)
|
|
72
|
+
pnpm build # lib/:宿主端 tsc 转译 + 浏览器端 esbuild 打包
|
|
73
|
+
DSH_SRC=/path/to/deepseek-harness pnpm typecheck # 对照 dsh 源码做宿主端和浏览器端的类型检查
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`build` 用 esbuild 把 `ssh2` 打包进 `lib/`,所以发布到 npm 的包没有任何运行时依赖,也就没有安装脚本。这是必须的:dsh 自带的 pnpm 11 在依赖的安装脚本被跳过时会让 `dsh plugin add` 直接失败。被打包的第三方库的许可证见 `THIRD_PARTY_NOTICES.md`。
|
|
77
|
+
|
|
78
|
+
npm 上的 `@deepseek-ai/*` 包版本过旧,所以 `build` 不做类型检查,类型检查对照 dsh 源码单独进行。
|
|
79
|
+
|
|
80
|
+
## 发布
|
|
81
|
+
|
|
82
|
+
推送与 `package.json` 版本号一致的标签,GitHub Actions 会先跑测试,再发布到 npm,并附带来源证明(provenance)。需要在仓库 Secrets 里配置 `NPM_TOKEN`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git tag v0.1.0 && git push origin v0.1.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
端到端测试会在目标机器上**安装再卸载**,并用 sing-box 客户端实测每种协议的连通性。本地可以用 [Lima](https://lima-vm.io) 虚拟机:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
limactl start --name=vps --vm-type=vz --network=vzNAT --set '.mounts=[]' template:ubuntu-24.04
|
|
92
|
+
# 在虚拟机里开启 sshd 的密码登录并设置密码,然后:
|
|
93
|
+
DSH_VPN_E2E_HOST=192.168.64.2 DSH_VPN_E2E_USER=root DSH_VPN_E2E_PASSWORD=… pnpm test:e2e
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
IP 证书的测试需要一个本地 ACME 服务器,用 Let's Encrypt 官方的 [Pebble](https://github.com/letsencrypt/pebble) 模拟。**只能在测试虚拟机上运行**,因为它会把 Pebble 的根证书加入系统信任:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
ssh 测试机 'sudo bash -s' < tests/e2e/pebble-setup.sh
|
|
100
|
+
DSH_VPN_E2E_ACME=https://localhost:14000/dir DSH_VPN_E2E_HOST=… pnpm test:e2e
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
在插件配置里设置 `acmeProvider`,就可以让插件改用 Pebble 或其他 ACME 服务器。
|
|
104
|
+
|
|
105
|
+
## TODO
|
|
106
|
+
|
|
107
|
+
- [ ] SSH 私钥登录
|
|
108
|
+
- [ ] 导出客户端配置文件(sing-box / mihomo)和订阅链接
|
|
109
|
+
- [ ] 可自定义 Reality 的 SNI、协议端口
|
|
110
|
+
- [ ] 证书使用自己的域名(DNS 验证:Cloudflare / 阿里云)
|
|
111
|
+
- [ ] IPv6 的 IP 证书(目前只在 IPv4 上验证过)
|
|
112
|
+
- [ ] 支持 OpenRC(Alpine)和 iptables/nftables
|
|
113
|
+
- [ ] 支持 GitHub 下载镜像
|
|
114
|
+
- [ ] 在真实 VPS 上跑端到端测试(Debian 12 / Ubuntu 24.04 / Rocky 9)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
lib/ bundles the following packages.
|
|
4
|
+
|
|
5
|
+
## asn1@0.2.6 (MIT)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Copyright (c) 2011 Mark Cavage, All rights reserved.
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## bcrypt-pbkdf@1.0.2 (BSD-3-Clause)
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
The Blowfish portions are under the following license:
|
|
33
|
+
|
|
34
|
+
Blowfish block cipher for OpenBSD
|
|
35
|
+
Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
|
36
|
+
All rights reserved.
|
|
37
|
+
|
|
38
|
+
Implementation advice by David Mazieres <dm@lcs.mit.edu>.
|
|
39
|
+
|
|
40
|
+
Redistribution and use in source and binary forms, with or without
|
|
41
|
+
modification, are permitted provided that the following conditions
|
|
42
|
+
are met:
|
|
43
|
+
1. Redistributions of source code must retain the above copyright
|
|
44
|
+
notice, this list of conditions and the following disclaimer.
|
|
45
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
46
|
+
notice, this list of conditions and the following disclaimer in the
|
|
47
|
+
documentation and/or other materials provided with the distribution.
|
|
48
|
+
3. The name of the author may not be used to endorse or promote products
|
|
49
|
+
derived from this software without specific prior written permission.
|
|
50
|
+
|
|
51
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
52
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
53
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
54
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
55
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
56
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
57
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
58
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
59
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
60
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
The bcrypt_pbkdf portions are under the following license:
|
|
65
|
+
|
|
66
|
+
Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
|
|
67
|
+
|
|
68
|
+
Permission to use, copy, modify, and distribute this software for any
|
|
69
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
70
|
+
copyright notice and this permission notice appear in all copies.
|
|
71
|
+
|
|
72
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
73
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
74
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
75
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
76
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
77
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
78
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
Performance improvements (Javascript-specific):
|
|
83
|
+
|
|
84
|
+
Copyright 2016, Joyent Inc
|
|
85
|
+
Author: Alex Wilson <alex.wilson@joyent.com>
|
|
86
|
+
|
|
87
|
+
Permission to use, copy, modify, and distribute this software for any
|
|
88
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
89
|
+
copyright notice and this permission notice appear in all copies.
|
|
90
|
+
|
|
91
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
92
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
93
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
94
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
95
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
96
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
97
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## safer-buffer@2.1.2 (MIT)
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
MIT License
|
|
104
|
+
|
|
105
|
+
Copyright (c) 2018 Nikita Skovoroda <chalkerx@gmail.com>
|
|
106
|
+
|
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
108
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
109
|
+
in the Software without restriction, including without limitation the rights
|
|
110
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
111
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
112
|
+
furnished to do so, subject to the following conditions:
|
|
113
|
+
|
|
114
|
+
The above copyright notice and this permission notice shall be included in all
|
|
115
|
+
copies or substantial portions of the Software.
|
|
116
|
+
|
|
117
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
123
|
+
SOFTWARE.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## ssh2@1.17.0 (MIT)
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Copyright Brian White. All rights reserved.
|
|
130
|
+
|
|
131
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
132
|
+
of this software and associated documentation files (the "Software"), to
|
|
133
|
+
deal in the Software without restriction, including without limitation the
|
|
134
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
135
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
136
|
+
furnished to do so, subject to the following conditions:
|
|
137
|
+
|
|
138
|
+
The above copyright notice and this permission notice shall be included in
|
|
139
|
+
all copies or substantial portions of the Software.
|
|
140
|
+
|
|
141
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
142
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
143
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
144
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
145
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
146
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
147
|
+
IN THE SOFTWARE.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## tweetnacl@0.14.5 (Unlicense)
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
This is free and unencumbered software released into the public domain.
|
|
154
|
+
|
|
155
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
156
|
+
distribute this software, either in source code form or as a compiled
|
|
157
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
158
|
+
means.
|
|
159
|
+
|
|
160
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
161
|
+
of this software dedicate any and all copyright interest in the
|
|
162
|
+
software to the public domain. We make this dedication for the benefit
|
|
163
|
+
of the public at large and to the detriment of our heirs and
|
|
164
|
+
successors. We intend this dedication to be an overt act of
|
|
165
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
166
|
+
software under copyright law.
|
|
167
|
+
|
|
168
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
169
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
170
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
171
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
172
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
173
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
174
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
175
|
+
|
|
176
|
+
For more information, please refer to <http://unlicense.org>
|
|
177
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# vpn-ops
|
|
2
|
+
|
|
3
|
+
Deploy and operate a personal sing-box server on the user's VPS. The plugin logs in over SSH with the password saved on its settings page (dsh → Plugins → dsh-vpn). No local ssh client is needed.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. **Check first.** Call `vpn_status`.
|
|
8
|
+
- `error: not_configured` → tell the user to open dsh → 插件 (Plugins) → dsh-vpn, fill in server IP, SSH port, username and password, then click 保存 and 测试连接. Never ask for the password in chat.
|
|
9
|
+
- Installed and active → offer `vpn_links` instead of reinstalling.
|
|
10
|
+
2. **Install.** Call `vpn_install`. Omit `protocols` to use the selection saved in settings. Only pass `regenerate: true` when the user explicitly wants new keys, because every old link stops working.
|
|
11
|
+
3. **Deliver.** Say the links are ready and that the settings page shows scannable QR codes (刷新 button). Client apps: v2rayN, NekoBox, Shadowrocket, sing-box, Clash Meta / mihomo.
|
|
12
|
+
4. **Remind** the user to open the reported ports in the cloud provider's security group, using the right transport for each protocol.
|
|
13
|
+
|
|
14
|
+
## Certificates
|
|
15
|
+
|
|
16
|
+
The settings page offers **self-signed** (default) or **IP certificate** (recommended): a Let's Encrypt certificate for the server IP, issued and renewed automatically by sing-box. With it, every client verifies normally and no link needs "skip certificate verification". It needs TCP port 80 open at all times for renewal; the certificate lasts 6 days.
|
|
17
|
+
|
|
18
|
+
## Protocols
|
|
19
|
+
|
|
20
|
+
| id | Name | Transport | Notes |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| `reality` | VLESS Reality | TCP | Default. Hardest to detect. |
|
|
23
|
+
| `hy2` | Hysteria2 | UDP | Default. Fast on lossy links; the link pins the certificate. |
|
|
24
|
+
| `tuic` | TUIC v5 | UDP | With a self-signed cert, clients skip verification; with an IP certificate, they verify normally. |
|
|
25
|
+
| `anytls` | AnyTLS | TCP | Same as TUIC. |
|
|
26
|
+
| `ss` | Shadowsocks 2022 | TCP+UDP | Widely supported; no TLS disguise. |
|
|
27
|
+
|
|
28
|
+
## Troubleshooting
|
|
29
|
+
|
|
30
|
+
| Error / symptom | Likely cause | What to do |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `auth_failed` | Wrong username or password | User fixes it on the settings page |
|
|
33
|
+
| `host_key_mismatch` | Server reinstalled or replaced, or a man-in-the-middle | Ask whether the server was reinstalled. Only then may the user click 重置指纹 (Reset fingerprint) |
|
|
34
|
+
| `connect_failed` / `timeout` | Wrong IP or port, SSH blocked, server down | Check the IP and SSH port on the settings page |
|
|
35
|
+
| `sudo_failed` | User is not root and lacks sudo, or the sudo password differs | Use root, or grant sudo |
|
|
36
|
+
| `no_systemd` | Container or OpenRC VPS | Not supported yet |
|
|
37
|
+
| `download_failed` | VPS cannot reach GitHub | Retry later |
|
|
38
|
+
| `cert_failed` | IP certificate not issued (usually port 80 closed). The node fell back to self-signed and still works | Open TCP 80 in the security group, then install again |
|
|
39
|
+
| `port80_in_use` | Another program (nginx, …) holds port 80 | Stop it, or use self-signed |
|
|
40
|
+
| Status says the certificate expires within 24 h or has expired | Renewal failing | Open TCP 80; an expired certificate breaks every TLS protocol |
|
|
41
|
+
| Installed and active, but the client times out | Cloud security group or upstream firewall | Open the TCP/UDP ports in the cloud console |
|
|
42
|
+
| Reality fails, others work | SNI site blocked | Reinstall with another SNI (future option) |
|
|
43
|
+
| UDP protocols fail, TCP works | ISP blocks or throttles UDP | Use Reality or AnyTLS |
|
|
44
|
+
| Everything stopped after working | IP blocked | `vpn_install` with `regenerate: true` for new ports; if it is still blocked, the IP must change |
|
|
45
|
+
|
|
46
|
+
Never paste passwords, private keys or the state file into chat. Share links are secrets too: show them only to the user.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
- insert:
|
|
2
|
+
- id: vpn
|
|
3
|
+
name: dsh-vpn
|
|
4
|
+
# Server, password and protocols are set on the plugin's settings page
|
|
5
|
+
# (stored in dsh's credential store, not here).
|
|
6
|
+
config: {}
|
|
7
|
+
# config:
|
|
8
|
+
# timeoutMs: 600000 # per-operation deadline
|
|
9
|
+
# confirm: true # ask before the agent installs/uninstalls
|
|
10
|
+
- id: vpn-skill
|
|
11
|
+
name: dsh-vpn/skill
|