Skip to content

Conversation

@DHR60
Copy link
Contributor

@DHR60 DHR60 commented Nov 1, 2025

固定证书

部分机场节点和 OpenSSL 获取到的 TLS 证书不一致,虽然 Wireshark 抓包显示 SNI 和目标地址一致,原因未知

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 1, 2025

UI 好像不太好看,后面看下怎么改进吧

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 1, 2025

内置一份 CA 指纹 Pinning,避免用户电脑已经被置入恶意 CA 获取到错误证书

取自火狐的 CA 列表 https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 1, 2025

脚本如下

import requests
import re

# Trusted CA Cert URL
url = "https://hg-edge.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt"

# Get Fingerprints (SHA-256) from certdata.txt
# Fingerprint (SHA-256): EB:D4:10:40:... CKA_CLASS CK_OBJECT_CLASS ... CKA_LABEL UTF8 "GlobalSign Root CA"
# Returns a string of fingerprints:
# "EBD41040...", // GlobalSign Root CA
# ...
def get_fingerprints(url):
    response = requests.get(url)
    data = response.text

    # Regex to find SHA-256 fingerprints and their labels
    pattern = r'Fingerprint \(SHA-256\): ([A-F0-9:]+).*?CKA_LABEL UTF8 "([^"]+)"'
    matches = re.findall(pattern, data, re.DOTALL)

    # Remove duplicates while preserving first-seen order.
    fingerprints = []
    seen = set()
    for match in matches:
        # normalize fingerprint: remove colons and uppercase
        fingerprint = match[0].replace(":", "").upper()
        label = match[1].strip()
        if fingerprint in seen:
            continue
        seen.add(fingerprint)
        fingerprints.append(f'"{fingerprint}", // {label}')

    return fingerprints


if __name__ == "__main__":
    fingerprints = get_fingerprints(url)
    for fp in fingerprints:
        print(fp)

@2dust
Copy link
Owner

2dust commented Nov 1, 2025

感谢你的 PR。
大概明白意思了,xray 和 sing-box 都支持 cert ;
但是是不是我们做的有些过多了,获取证书还需要我们做?

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 1, 2025

因为用户友好啊,并且 C# 有现成的类和方法

"" | openssl s_client -servername example.com -connect example.com:443 2>$null | openssl x509

比起这种方法更方便

一是不需要安装 openssl,二是可以验证 CA 证书是否可信

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

rebase?

{
domain += $":{SelectedSource.Port}";
}
Cert = await CertPemManager.Instance.GetCertPemAsync(domain, serverName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个获取的时候,把异常结果返回并显示出来吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

但是大部分情况是 AddServerWindow 直接把 MainWindow 的 StatusBarView 挡住的,用户根本看不到

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以用 TextBlock 文本控件在当前页面,比如原来已有的说明的地方,直接替换为异常信息

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Copy link
Contributor Author

@DHR60 DHR60 Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

啊,才发现,原来是 753e7b8 这意思,我还以为说的是前面的直接 return 需要做提示

我还在想为什么在这 Comment,语文没学好

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

做个国际化是不是更好?比如证书验证失败该CA不受信任,能区分是自签还是恶意 CA ,感觉用户友好一些

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以加你说的更友好的提示。
但是有时候域名会连接都不成功,这部分还是要提示出来

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

填写证书后,底层自动禁用 AllowInsecure 吧

一是符合目前界面说明的逻辑,二是避免用户填写了,但是 AllowInsecure = true 导致实际未使用的情况

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

不过现有的大多数客户端,固定证书和 AllowInsecure 是独立的

@2dust 2dust merged commit b218f0b into 2dust:master Nov 2, 2025
@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

填写证书后,底层自动禁用 AllowInsecure 吧

一是符合目前界面说明的逻辑,二是避免用户填写了,但是 AllowInsecure = true 导致实际未使用的情况

所以做吗?目前是即使填了证书,AllowInsecure 还是不会去验证

@2dust
Copy link
Owner

2dust commented Nov 2, 2025

填写证书后,底层自动禁用 AllowInsecure 吧
一是符合目前界面说明的逻辑,二是避免用户填写了,但是 AllowInsecure = true 导致实际未使用的情况

所以做吗?目前是即使填了证书,AllowInsecure 还是不会去验证

做呗,你可以继续完善功能。
个人意见是不要产生证书的功能,不过你既然都做了那就留着。

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

不是完善,是这个逻辑和现有的大部分客户端冲突

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

但是这个逻辑我认为是合理的,填写了证书应该禁用 AllowInsecure

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

所以问问你的意见

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 2, 2025

不是完善,是这个逻辑和现有的大部分客户端冲突

比如 nekobox, Exclave, husi 这些

@2dust
Copy link
Owner

2dust commented Nov 2, 2025

但是这个逻辑我认为是合理的,填写了证书应该禁用 AllowInsecure

挺合理的

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

两位大佬好,十分期望证书指纹能实现啊,无论使用 sha256(clash和小火箭的格式) 还是 base64 (sing-box的格式)都可以。

因为我是使用 sing-box 服务端,使用自签的,现在 v2rayN 在 trojan / hysteria2 / tuic / anyTLS 等,都要在 TLS 处 AllowInsecure = true。为了添加安全性,希望用证书指纹替代。现在小火箭 / clash mihomo / sing-box 客户端都可以实现了。但我还是喜欢用 v2rayN,感谢了!

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 6, 2025

两位大佬好,十分期望证书指纹能实现啊,无论使用 sha256(clash和小火箭的格式) 还是 base64 (sing-box的格式)都可以。

因为我是使用 sing-box 服务端,使用自签的,现在 v2rayN 在 trojan / hysteria2 / tuic / anyTLS 等,都要在 TLS 处 AllowInsecure = true。为了添加安全性,希望用证书指纹替代。现在小火箭 / clash mihomo / sing-box 客户端都可以实现了。但我还是喜欢用 v2rayN,感谢了!

#7977 ,xray 和 sing-box 无法同时适配

xray 是打算 公钥哈希 -> 密钥指纹
sing-box 是 密钥指纹(Removed) -> 公钥哈希,并且 1.13 版本才加入

反向的双向奔赴了属于是

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 6, 2025

如果 xray 那边不删公钥哈希的话倒也不是不能做,这边转换函数都写好了来着

https://github.com/2dust/v2rayN/pull/7977/files#diff-89a22d7ddceebb4eeb9b9f90c6a2aac862c806443ac0fa6fc1f305d34bb4fe8bR256

@2dust
Copy link
Owner

2dust commented Nov 6, 2025

这两天需要发一个版本,此 pr 已经合并,发出来用用先吧,属于实验性功能。
本身会设置此项的用户应该也不是小白了

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

这两天需要发一个版本,此 pr 已经合并,发出来用用先吧,属于实验性功能。 本身会设置此项的用户应该也不是小白了

协议URI要支持证书指纹的参数啊,否则不利于节点的导入、导出和订阅。

@2dust
Copy link
Owner

2dust commented Nov 6, 2025

https://github.com/2dust/v2rayN/wiki/Description-of-VLESS-share-link

VLESS 分享规范里面没有,所以我们自己糊一个?

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

我个人是觉得不用太执着这个官方 URI 规则。这样广大使用 v2rayN 的玩家才会更方便无阻碍分享。

我们参考一下小火箭,clash 都有自己一些参数的啊,大家也完全没有因为这个而吐槽他们画蛇添足,自作多情。

像 trojan , tuic 这些协议,作者完全停更了,即是他们的 URI 几乎永远不变更新了。但他们也有 tls 模块的,如果不自定义参数处理。就会挺奇怪的,v2rayN 设置好能通的节点,导出有问题。分享或者订阅给别人,还要另外说明哪里需要加些什么东西,很尴尬的。

大佬可以问问社区的意见,更好的判断呢!

这个问题之前和大佬一年前讨论过的了,当时大佬坚持不添加,导致我的脚本只能这样备注。

不太希望日后要这样备注 “请把信任不安全关闭,同时设置证书指纹33:3D:45:DA:45:47:C1:72:D0:EF:34:24:F7:7F:32:CB:DC:8A:D5:8F:41:BE:13:71:DF:A3:B9:8F:E9:AB:9B:1E
或者是
w97IGZjtMUaJvVagCU6KqEMs15LgWf1v8f7djHeXKsQ="

#4727

#3125 (comment)

image

@2dust
Copy link
Owner

2dust commented Nov 6, 2025

我个人是觉得不用太执着这个官方 URI 规则。这样广大使用 v2rayN 的玩家才会更方便无阻碍分享。

我们参考一下小火箭,clash 都有自己一些参数的啊,大家也完全没有因为这个而吐槽他们画蛇添足,自作多情。

你举得这两例子不合适。小火箭因为 iphone 的原因;clash 根本不需要管参数,因为它的参数自己决定的。

这边为什么坚持用 XTLS/Xray-core#716 这个规范,是因为这个规范制定的算比较合理的,我们应该尽量尊重和推广,这样才会更方便开发和使用。

如果上面提到的规范里面没有,建议先给这个规范反馈和提交我们的建议,这样更好。

VLESS allowInsecure 事实上也已经加进去了。

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

我个人是觉得不用太执着这个官方 URI 规则。这样广大使用 v2rayN 的玩家才会更方便无阻碍分享。
我们参考一下小火箭,clash 都有自己一些参数的啊,大家也完全没有因为这个而吐槽他们画蛇添足,自作多情。

你举得这两例子不合适。小火箭因为 iphone 的原因;clash 根本不需要管参数,因为它的参数自己决定的。

这边为什么坚持用 XTLS/Xray-core#716 这个规范,是因为这个规范制定的算比较合理的,我们应该尽量尊重和推广,这样才会更方便开发和使用。

如果上面提到的规范里面没有,建议先给这个规范反馈和提交我们的建议,这样更好。

VLESS allowInsecure 事实上也已经加进去了。

tuic 的 allowInsecure 应该没有吧?

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

我举那个例子,的确是我现在的使用情况,现在大家都不是一个客户端的了,pc有windows / mac ,手机有 安卓和 苹果,同一个节点,都是混着来的。其他工具分享无阻碍,就显得v2rayN在这方面保守了。

@2dust
Copy link
Owner

2dust commented Nov 6, 2025

item.AllowInsecure = new[] { "allowInsecure", "allow_insecure", "insecure" }.Any(k => (query[k] ?? "") == "1") ? "true" : "";
VLESS 和 tuic 都有这个,放到标准解析里面。
clash 不存在分享规范,因为就是一个文件,不讨论。
你说 v2rayN 保守,可以开一个讨论下具体是说哪个方面?

@fscarmen
Copy link

fscarmen commented Nov 6, 2025

可能我之前表达不太准确具体,比如我要分享一个 tuic 节点给别人,

情况一:小火箭

在小火箭,使用证书指纹是 tuic://20f7fca4-86e5-4ddf-9eed-24142073d197:20f7fca4-86e5-4ddf-9eed-24142073d197@31.22.111.140:8803?congestion_control=bbr&udp_relay_mode=native&alpn=h3&hpkp=A7:7B:DF:24:CF:8E:90:4A:12:8B:F7:99:2C:F0:27:D0:8F:F3:65:A7:9D:6D:EB:2B:F6:0F:2F:AB:98:8A:34:09#alice%20tuic

或者“信任不安全”是

tuic://20f7fca4-86e5-4ddf-9eed-24142073d197:20f7fca4-86e5-4ddf-9eed-24142073d197@31.22.111.140:8803?congestion_control=bbr&udp_relay_mode=native&alpn=h3&allow_insecure=1#alice%20tuic

情况二:clash

在 clash, 使用证书指纹是 - {name: "alice tuic", type: tuic, server: 31.22.111.140, port: 8803, uuid: 20f7fca4-86e5-4ddf-9eed-24142073d197, password: 20f7fca4-86e5-4ddf-9eed-24142073d197, alpn: [h3], disable-sni: true, reduce-rtt: true, request-timeout: 8000, udp-relay-mode: native, congestion-controller: bbr, skip-cert-verify: false, fingerprint: A7:7B:DF:24:CF:8E:90:4A:12:8B:F7:99:2C:F0:27:D0:8F:F3:65:A7:9D:6D:EB:2B:F6:0F:2F:AB:98:8A:34:09}

或者“信任不安全”是
- {name: "alice tuic", type: tuic, server: 31.22.111.140, port: 8803, uuid: 20f7fca4-86e5-4ddf-9eed-24142073d197, password: 20f7fca4-86e5-4ddf-9eed-24142073d197, alpn: [h3], disable-sni: true, reduce-rtt: true, request-timeout: 8000, udp-relay-mode: native, congestion-controller: bbr, skip-cert-verify: true}

在情况一和二中,我在tg里分享给别人,别人在相应的客户端粘贴就直接可以用了。

情况三:v2rayN

而该节点在 v2rayN 即遇到问题, TLS 里我把 “信任不安全” 打开

image

导出分享链接为 tuic://20f7fca4-86e5-4ddf-9eed-24142073d197%3A20f7fca4-86e5-4ddf-9eed-24142073d197@31.22.111.140:8803?alpn=h3&congestion_control=bbr#alice%20tuic

这时没有了 allowInsecure=true,把该 tuic URI再到v2rayN里导入,会没有了“信任不安全” ,导致节点不通。如果我是分享给别人,就要再人工告诉他,要打开那开关,以后有证书指纹,我需要另外复制证书指纹,让他再手动粘贴进去相应的地方。一个节点要复制两次。

image

记得之前还和你讨论过该问题,你提到 tuic 官方URI规则里没有这个allowInsecure=true,所以虽然你在界面里能设置,也能通,但却生成不了完整的链接。

@2dust
Copy link
Owner

2dust commented Nov 7, 2025

@fscarmen 新开一个 issue,把需要分享和解析的这个部分都发出来吧,我们一次都给加上。
既然大家都这样用,那就加上;也不要像 xray R佬那样为了大家的安全想那么多了,怎么方便怎么来吧

@fscarmen
Copy link

fscarmen commented Nov 9, 2025

UI 好像不太好看,后面看下怎么改进吧

#8267 (comment)

@DHR60
Copy link
Contributor Author

DHR60 commented Nov 9, 2025

说起界面设计,未来的 8 或 9 大版本考不考虑做成 fluent 这种,导航式而非多窗口的设计

前天试了试 Blazor,感觉也是个好玩的玩具

image

就是现在的多窗口不太适合适配 Blazor

@2dust
Copy link
Owner

2dust commented Nov 9, 2025

其实老早就有想过。
如果都只有一层弹出窗口,导航的不错;但是有多层弹出窗口,不是很好设计。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants