2022-08-24 09:31:32 +00:00
|
|
|
|
### 入站
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"enabled": true,
|
|
|
|
|
"server_name": "",
|
|
|
|
|
"alpn": [],
|
|
|
|
|
"min_version": "",
|
|
|
|
|
"max_version": "",
|
|
|
|
|
"cipher_suites": [],
|
|
|
|
|
"certificate": "",
|
|
|
|
|
"certificate_path": "",
|
|
|
|
|
"key": "",
|
|
|
|
|
"key_path": "",
|
|
|
|
|
"acme": {
|
|
|
|
|
"domain": [],
|
|
|
|
|
"data_directory": "",
|
|
|
|
|
"default_server_name": "",
|
|
|
|
|
"email": "",
|
|
|
|
|
"provider": "",
|
|
|
|
|
"disable_http_challenge": false,
|
|
|
|
|
"disable_tls_alpn_challenge": false,
|
|
|
|
|
"alternative_http_port": 0,
|
|
|
|
|
"alternative_tls_port": 0,
|
|
|
|
|
"external_account": {
|
|
|
|
|
"key_id": "",
|
|
|
|
|
"mac_key": ""
|
|
|
|
|
}
|
2023-02-25 08:24:08 +00:00
|
|
|
|
},
|
|
|
|
|
"reality": {
|
|
|
|
|
"enabled": false,
|
|
|
|
|
"handshake": {
|
|
|
|
|
"server": "google.com",
|
|
|
|
|
"server_port": 443,
|
|
|
|
|
|
|
|
|
|
... // 拨号字段
|
|
|
|
|
},
|
|
|
|
|
"private_key": "UuMBgl7MXTPx9inmQp2UC7Jcnwc6XYbwDNebonM-FCc",
|
|
|
|
|
"short_id": [
|
|
|
|
|
"0123456789abcdef"
|
|
|
|
|
],
|
|
|
|
|
"max_time_difference": "1m"
|
2022-08-24 09:31:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 出站
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"enabled": true,
|
2022-08-26 10:36:49 +00:00
|
|
|
|
"disable_sni": false,
|
2022-08-24 09:31:32 +00:00
|
|
|
|
"server_name": "",
|
|
|
|
|
"insecure": false,
|
|
|
|
|
"alpn": [],
|
|
|
|
|
"min_version": "",
|
|
|
|
|
"max_version": "",
|
|
|
|
|
"cipher_suites": [],
|
|
|
|
|
"certificate": "",
|
2022-09-10 14:42:20 +00:00
|
|
|
|
"certificate_path": "",
|
|
|
|
|
"ech": {
|
|
|
|
|
"enabled": false,
|
|
|
|
|
"pq_signature_schemes_enabled": false,
|
|
|
|
|
"dynamic_record_sizing_disabled": false,
|
|
|
|
|
"config": ""
|
|
|
|
|
},
|
|
|
|
|
"utls": {
|
|
|
|
|
"enabled": false,
|
|
|
|
|
"fingerprint": ""
|
2023-02-25 08:24:08 +00:00
|
|
|
|
},
|
|
|
|
|
"reality": {
|
|
|
|
|
"enabled": false,
|
|
|
|
|
"public_key": "jNXHt1yRo0vDuchQlIP6Z0ZvjT3KtzVI-T4E7RoLJS0",
|
|
|
|
|
"short_id": "0123456789abcdef"
|
2022-09-10 14:42:20 +00:00
|
|
|
|
}
|
2022-08-24 09:31:32 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
TLS 版本值:
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
* `1.0`
|
|
|
|
|
* `1.1`
|
|
|
|
|
* `1.2`
|
|
|
|
|
* `1.3`
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
密码套件值:
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
* `TLS_RSA_WITH_AES_128_CBC_SHA`
|
|
|
|
|
* `TLS_RSA_WITH_AES_256_CBC_SHA`
|
|
|
|
|
* `TLS_RSA_WITH_AES_128_GCM_SHA256`
|
|
|
|
|
* `TLS_RSA_WITH_AES_256_GCM_SHA384`
|
|
|
|
|
* `TLS_AES_128_GCM_SHA256`
|
|
|
|
|
* `TLS_AES_256_GCM_SHA384`
|
|
|
|
|
* `TLS_CHACHA20_POLY1305_SHA256`
|
|
|
|
|
* `TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA`
|
|
|
|
|
* `TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`
|
|
|
|
|
* `TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`
|
|
|
|
|
* `TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`
|
|
|
|
|
* `TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256`
|
|
|
|
|
* `TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384`
|
|
|
|
|
* `TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`
|
|
|
|
|
* `TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`
|
|
|
|
|
* `TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256`
|
|
|
|
|
* `TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256`
|
|
|
|
|
|
|
|
|
|
!!! note ""
|
|
|
|
|
|
|
|
|
|
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
|
|
|
|
|
|
|
|
|
### 字段
|
|
|
|
|
|
|
|
|
|
#### enabled
|
|
|
|
|
|
|
|
|
|
启用 TLS
|
|
|
|
|
|
2022-08-26 10:36:49 +00:00
|
|
|
|
#### disable_sni
|
|
|
|
|
|
|
|
|
|
==仅客户端==
|
|
|
|
|
|
|
|
|
|
不要在 ClientHello 中发送服务器名称.
|
|
|
|
|
|
2022-08-24 09:31:32 +00:00
|
|
|
|
#### server_name
|
|
|
|
|
|
|
|
|
|
用于验证返回证书上的主机名,除非设置不安全。
|
|
|
|
|
|
|
|
|
|
它还包含在 ClientHello 中以支持虚拟主机,除非它是 IP 地址。
|
|
|
|
|
|
|
|
|
|
#### insecure
|
|
|
|
|
|
|
|
|
|
==仅客户端==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
接受任何服务器证书。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### alpn
|
|
|
|
|
|
|
|
|
|
支持的应用层协议协商列表,按优先顺序排列。
|
|
|
|
|
|
|
|
|
|
如果两个对等点都支持 ALPN,则选择的协议将是此列表中的一个,如果没有相互支持的协议则连接将失败。
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
参阅 [Application-Layer Protocol Negotiation](https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation)。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### min_version
|
|
|
|
|
|
|
|
|
|
可接受的最低 TLS 版本。
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
默认情况下,当前使用 TLS 1.2 作为客户端的最低要求。作为服务器时使用 TLS 1.0。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### max_version
|
|
|
|
|
|
|
|
|
|
可接受的最大 TLS 版本。
|
|
|
|
|
|
|
|
|
|
默认情况下,当前最高版本为 TLS 1.3。
|
|
|
|
|
|
|
|
|
|
#### cipher_suites
|
|
|
|
|
|
|
|
|
|
将在 ECDHE 握手中使用的椭圆曲线,按优先顺序排列。
|
|
|
|
|
|
|
|
|
|
如果为空,将使用默认值。
|
|
|
|
|
|
|
|
|
|
客户端将使用第一个首选项作为其在 TLS 1.3 中的密钥共享类型。
|
|
|
|
|
这在未来可能会改变。
|
|
|
|
|
|
|
|
|
|
#### certificate
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器 PEM 证书。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### certificate_path
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器 PEM 证书路径。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### key
|
|
|
|
|
|
|
|
|
|
==仅服务器==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器 PEM 私钥。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### key_path
|
|
|
|
|
|
|
|
|
|
==仅服务器==
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
服务器 PEM 私钥路径。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
2022-09-10 14:42:20 +00:00
|
|
|
|
#### ech
|
|
|
|
|
|
|
|
|
|
==仅客户端==
|
|
|
|
|
|
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含 ECH, 参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
|
|
|
|
ECH (Encrypted Client Hello) 是一个 TLS 扩展,它允许客户端加密其 ClientHello 的第一部分
|
|
|
|
|
信息。
|
|
|
|
|
|
|
|
|
|
如果您不知道如何填写其他配置,只需设置 `enabled` 即可。
|
|
|
|
|
|
|
|
|
|
#### utls
|
|
|
|
|
|
|
|
|
|
==仅客户端==
|
|
|
|
|
|
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含 uTLS, 参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
|
|
|
|
!!! note ""
|
|
|
|
|
|
|
|
|
|
uTLS 维护不善且其效果可能未经证实,使用风险自负。
|
|
|
|
|
|
|
|
|
|
uTLS 是 "crypto/tls" 的一个分支,它提供了 ClientHello 指纹识别阻力。
|
|
|
|
|
|
|
|
|
|
可用的指纹值:
|
|
|
|
|
|
|
|
|
|
* chrome
|
|
|
|
|
* firefox
|
2022-10-26 11:31:57 +00:00
|
|
|
|
* edge
|
|
|
|
|
* safari
|
|
|
|
|
* 360
|
|
|
|
|
* qq
|
2022-09-10 14:42:20 +00:00
|
|
|
|
* ios
|
|
|
|
|
* android
|
|
|
|
|
* random
|
2023-02-28 13:10:11 +00:00
|
|
|
|
* randomized
|
2022-09-10 14:42:20 +00:00
|
|
|
|
|
2022-10-26 11:31:57 +00:00
|
|
|
|
默认使用 chrome 指纹。
|
|
|
|
|
|
2022-08-24 09:31:32 +00:00
|
|
|
|
### ACME 字段
|
|
|
|
|
|
2022-09-10 14:42:20 +00:00
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含 ACME,参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
2022-08-24 09:31:32 +00:00
|
|
|
|
#### domain
|
|
|
|
|
|
|
|
|
|
一组域名。
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
默认禁用 ACME。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### data_directory
|
|
|
|
|
|
|
|
|
|
ACME 数据目录。
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
默认使用 `$XDG_DATA_HOME/certmagic|$HOME/.local/share/certmagic`。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### default_server_name
|
|
|
|
|
|
|
|
|
|
如果 ClientHello 的 ServerName 字段为空,则选择证书时要使用的服务器名称。
|
|
|
|
|
|
|
|
|
|
#### email
|
|
|
|
|
|
|
|
|
|
创建或选择现有 ACME 服务器帐户时使用的电子邮件地址。
|
|
|
|
|
|
|
|
|
|
#### provider
|
|
|
|
|
|
|
|
|
|
要使用的 ACME CA 供应商。
|
|
|
|
|
|
|
|
|
|
| 值 | 供应商 |
|
|
|
|
|
|--------------------|---------------|
|
|
|
|
|
| `letsencrypt (默认)` | Let's Encrypt |
|
|
|
|
|
| `zerossl` | ZeroSSL |
|
|
|
|
|
| `https://...` | 自定义 |
|
|
|
|
|
|
|
|
|
|
#### disable_http_challenge
|
|
|
|
|
|
|
|
|
|
禁用所有 HTTP 质询。
|
|
|
|
|
|
|
|
|
|
#### disable_tls_alpn_challenge
|
|
|
|
|
|
|
|
|
|
禁用所有 TLS-ALPN 质询。
|
|
|
|
|
|
|
|
|
|
#### alternative_http_port
|
|
|
|
|
|
|
|
|
|
用于 ACME HTTP 质询的备用端口;如果非空,将使用此端口而不是 80 来启动 HTTP 质询的侦听器。
|
|
|
|
|
|
|
|
|
|
#### alternative_tls_port
|
|
|
|
|
|
|
|
|
|
用于 ACME TLS-ALPN 质询的备用端口; 系统必须将 443 转发到此端口以使质询成功。
|
|
|
|
|
|
|
|
|
|
#### external_account
|
|
|
|
|
|
|
|
|
|
EAB(外部帐户绑定)包含将 ACME 帐户绑定或映射到其他已知帐户所需的信息由 CA。
|
|
|
|
|
|
|
|
|
|
外部帐户绑定“用于将 ACME 帐户与非 ACME 系统中的现有帐户相关联,例如 CA 客户数据库。
|
|
|
|
|
|
2022-08-26 10:36:49 +00:00
|
|
|
|
为了启用 ACME 帐户绑定,运行 ACME 服务器的 CA 需要向 ACME 客户端提供 MAC 密钥和密钥标识符,使用 ACME 之外的一些机制。
|
|
|
|
|
§7.3.4
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### external_account.key_id
|
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
|
密钥标识符。
|
2022-08-24 09:31:32 +00:00
|
|
|
|
|
|
|
|
|
#### external_account.mac_key
|
|
|
|
|
|
2022-09-10 14:42:20 +00:00
|
|
|
|
MAC 密钥。
|
|
|
|
|
|
2023-02-25 08:24:08 +00:00
|
|
|
|
### Reality 字段
|
|
|
|
|
|
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含 reality 服务器,参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
|
|
|
|
!!! warning ""
|
|
|
|
|
|
|
|
|
|
默认安装不包含被 reality 客户端需要的 uTLS, 参阅 [安装](/zh/#_2)。
|
|
|
|
|
|
|
|
|
|
#### handshake
|
|
|
|
|
|
|
|
|
|
==仅服务器==
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
|
|
|
|
握手服务器地址和 [拨号参数](/zh/configuration/shared/dial/)。
|
|
|
|
|
|
|
|
|
|
#### private_key
|
|
|
|
|
|
|
|
|
|
==仅服务器==
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
2023-03-05 02:50:51 +00:00
|
|
|
|
私钥,由 `sing-box generate reality-keypair` 生成。
|
2023-02-25 08:24:08 +00:00
|
|
|
|
|
|
|
|
|
#### public_key
|
|
|
|
|
|
|
|
|
|
==仅客户端==
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
2023-03-05 02:50:51 +00:00
|
|
|
|
公钥,由 `sing-box generate reality-keypair` 生成。
|
2023-02-25 08:24:08 +00:00
|
|
|
|
|
|
|
|
|
#### short_id
|
|
|
|
|
|
|
|
|
|
==必填==
|
|
|
|
|
|
|
|
|
|
一个八位十六进制的字符串。
|
|
|
|
|
|
|
|
|
|
#### max_time_difference
|
|
|
|
|
|
|
|
|
|
服务器与和客户端之间允许的最大时间差。
|
|
|
|
|
|
|
|
|
|
默认禁用检查。
|
|
|
|
|
|
2022-09-10 14:42:20 +00:00
|
|
|
|
### 重载
|
|
|
|
|
|
|
|
|
|
对于服务器配置,如果修改,证书和密钥将自动重新加载。
|