Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reality does not verify certificates of its destination #1734

Closed
testcaoy7 opened this issue Mar 3, 2023 · 7 comments
Closed

Reality does not verify certificates of its destination #1734

testcaoy7 opened this issue Mar 3, 2023 · 7 comments

Comments

@testcaoy7
Copy link

Actually, I consider this is a "feature".
We can use a self-signed CA to issue any certificates to Reality.
And Reality does not care if the certificate is self-signed. It will not verify it.

Config:

    "inbounds": [
        {
            "tag": "vless-in",
            "listen": "0.0.0.0",
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "e7608361-3f0b-4d52-bf9f-bd9dea5a2a6b",
                        "flow": "xtls-rprx-vision"
                    }
                ],
		"decryption": "none"
            },
            "streamSettings": {
                "network": "tcp",
                "security": "reality",
                "realitySettings": {
                    "show": false,
                    "privateKey": "<Server_X25519_Private_Key>",
                    "shortIds": ["<Server_Short_ID>"],
                    "dest": "127.0.0.1:444",
                    "serverNames": ["www.gov.cn"]
                }
            }
        },
        {
            "tag": "dummy-ca",
            "listen": "127.0.0.1",
            "port": 444,
            "protocol": "http",
            "settings": {"allowTransparent": true},
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "rejectUnknownSni": false,
                    "alpn": ["http/1.1"],
					"minVersion": "1.3",
                    "certificates": [
                        {
                            "usage": "issue",
                            "oneTimeLoading": true,
                            "certificateFile": "fakeCA.cer",
                            "keyFile": "fakeCA.key"
                        }
                    ]
                }
            }
        }
    ]

Just set a dummy HTTP inbound, with TLS configuration set to use a CA certificate. And it will sign your Reality with any SNI you set, in the "serverNames" array.

@RPRX
Copy link
Member

RPRX commented Mar 3, 2023

我强调过,REALITY 是全程真实的 TLS,它并不需要,实际也没有“偷证书”,因为 TLSv1.3 把证书给加密了,中间人看不到证书

Example 也有说明:REALITY 客户端应当收到由“临时认证密钥”签发的“临时可信证书”,正常不会收到目标网站的真证书

目标网站是自己选的,你得保证目标网站的证书有效,就像允许哪些 serverNames 也由服务端决定一样,想的话你随便填都行

@RPRX RPRX closed this as completed Mar 3, 2023
@RPRX
Copy link
Member

RPRX commented Mar 3, 2023

还有,只要 dest 有默认证书,你就可以填任何 serverNames,查看 #1681 (comment) ,并不是自签 CA 的功劳

其实我本地早就根据近期 issue 更新了 example,包括这部分内容,只是还没放出来,我讨厌单独花时间解释

@cross-hello
Copy link
Contributor

image
Indeed, now you could spend time to talk with assembly.

@RPRX
Copy link
Member

RPRX commented Mar 3, 2023

你看,现在又变成 1023 了(干得漂亮!)

@RPRX
Copy link
Member

RPRX commented Mar 21, 2023

我讨厌单独花时间解释

抱歉这句话说得比较直。对于 REALITY 我本来是打算所有事情都就绪后一起放出,尤其是一篇详细介绍它的文章。因为这个项目比较受关注,逐步放出的话肯定会有非常多的 issue & discussion(REALITY 都没开,所以全发这里了),会严重拖慢剩下的进度。

其实对于提问类的 issue 我根本不想回复,因为文章会给出答案,希望大家明白,我在这件事上能花的时间是有限的,没事不要开 issue、追着我问问题,因为单独花时间去回答个人的提问,尤其是回复一大段那种,很占时间,结果就是没时间做其它事了,比如写文章、写代码,我把时间花在这些事上才是利益最大化、最符合公共利益的。比如现在你们去搜索 REALITY 的原理,只会得到一些散装的、零碎的回答,而若省下写这些回答的时间,本可以写完一篇面面俱到的文章,创造每个人都可以从中受益的价值。

问题是,出现一些错误解读,我不得不单独花时间去认真回复、及时纠正,心很累。最典型的比如 issue 2,其次,光一个“REALITY 的原理并不是偷证书”我都说过无数次了,所以又看到错误的理解难免会说话比较直,还有因为还没有更新 example,又要先单独花时间回复这里,说实话,搞成现在这样,简直是日了狗。问题的根源就在于,本来我是很有耐心的,一直在等 Xray-core、Vision、uTLS 的代码更加完善,并且想在发布 REALITY 前发个 v1.7.5,没想到半路杀出个友商,虽然区别很大,但我也想尽早公布代码了,所以很快就发了 v1.7.5,紧接着先放出了 REALITY 的代码,而没有等模板、文章一起,于是就这样了,果然还是不该逐步放出。

所以现在的计划是这样,我会用能花在这件事上的时间,第一步更新 example(包含对 SpiderX 及其参数的说明),第二步写完并发布文章,第三步写 release note(v1.8.0 会变成正式版),在这些事情都完成前不会回复 issue 之类的,希望大家能理解。

@Fangliding
Copy link
Member

@RPRX 我也想说reality不是偷证书()

@RPRX
Copy link
Member

RPRX commented Mar 21, 2023

并不是自签 CA 的功劳

这个更准确的表述为,自签 CA 并没有起到特别的作用,反而遇到主动探测的话会露馅得很彻底,还不如返回 dest 默认的证书。

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

No branches or pull requests

4 participants