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

Discuss: Certificate signed with self-signed CA. #38

Closed
tomac4t opened this issue Feb 8, 2020 · 4 comments
Closed

Discuss: Certificate signed with self-signed CA. #38

tomac4t opened this issue Feb 8, 2020 · 4 comments

Comments

@tomac4t
Copy link
Contributor

tomac4t commented Feb 8, 2020

See "Generate certificates" in https://www.chromium.org/quic/playing-with-quic and https://source.chromium.org/chromium/chromium/src/+/master:docs/linux/cert_management.md (though you don't actually need certutil for adding root CA; you can do that in the browser with GUI). #37 (comment)

I see it make possible to use a certificate signed with self-signed CA. To those who don't have a domain name, this will save them a lot of money. It can write an IP address in SSL certificate's "Common Name(CN)". Then run ./naive --listen=socks://127.0.0.1:1080 --proxy=https://aa.bb.cc.dd/.

The remain question is naive doesn't allow proxy URL contain an IP address:

constexpr char kDefaultHostName[] = "example";

// SNI should only contain DNS hostnames not IP addresses per RFC 6066.
if (url.HostIsIPAddress()) {
GURL::Replacements set_host;
set_host.SetHostStr(kDefaultHostName);
params->proxy_url =
GetProxyFromURL(url_no_auth.ReplaceComponents(set_host));
LOG(INFO) << "Using '" << kDefaultHostName << "' as the hostname for "
<< url.host();
params->host_resolver_rules =
std::string("MAP ") + kDefaultHostName + " " + url.host();
}

I don't see it is necessary to replace server_name to "example", because It shouldn't be sent server_name when you visit an IP address directly, like https://1.1.1.1/.

Another problem is missing server_name will change the ClientHello fingerprint, and make it become uncommon traffic(Hoping the Chromium will enable the DoH by default:-)):
https://tlsfingerprint.io/id/e94fcb2176c0b827
https://tlsfingerprint.io/compare/bbf04e5f1881f506/e94fcb2176c0b827

Edited: The way to workaround now is write both IP address and domain name(eg. example) in "subjectAltName(SAN)".

What do you think? @klzgrad

@klzgrad
Copy link
Owner

klzgrad commented Feb 8, 2020

Have you tried anything you said here? If it does work then maybe you have a point, otherwise...

// SNI should only contain DNS hostnames not IP addresses per RFC 6066.

This comment was a summary of why it didn't work with naked ip addresses. Either this SNI rule stops proxies with naked ip addresses from working, or it was other CA base requirements that made it problematic to use naked ip addresses in certificates. I forgot which one it was and for reasons below I'm not bothered to test it.

In general using naked ip addresses and even self-signed CAs is a red flag in the PKI system because it stands out from most other certificates. I read papers and I knew the GFW is surveying circulating certificates. There is or are several 'trustworthiness' rankings of certificates, and the rankings are used to classify malwares, and of course, hidden tunnels of adversaries. The way to rank certificates is not too far from standard traffic classification, that is, feature extraction and learning. The features of a certificate is then obviously the way and parameters used to generate it. Then my opinion is that what you described (which is what I tried first; don't know if it has become working again since then) is one of the rarest way to generate certificates, as most certificates are either signed by a known CA or self-signed, and as a consequence it stands out among all certificates.

@klzgrad
Copy link
Owner

klzgrad commented Feb 8, 2020

I think I wrote more here trojan-gfw/trojan#14 about the best practices wrt certificates. In short the best practice now is to use Let's Encrypt.

@tomac4t tomac4t closed this as completed Feb 10, 2020
@klzgrad
Copy link
Owner

klzgrad commented Feb 11, 2020

论文要在知网上找。除了找标题还要看通讯作者历史记录,和项目资金编号。

@klzgrad
Copy link
Owner

klzgrad commented Feb 11, 2020

I removed the part you requested. It was meant to make testing easier, and testing is now possible without it.

klzgrad pushed a commit that referenced this issue Mar 28, 2020
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

2 participants