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

use multi wild-domains cert, got error #92

Closed
sharper opened this issue Mar 17, 2020 · 8 comments
Closed

use multi wild-domains cert, got error #92

sharper opened this issue Mar 17, 2020 · 8 comments
Labels

Comments

@sharper
Copy link

sharper commented Mar 17, 2020

multi wild-domains cert, SAN: *.domain1.com, *.domain2.com
when use fetch-h2 access site (such as: www.domain2.com )
using multi wild-domains cert will got error:
Error: unable to verify the first certificate.

@grantila
Copy link
Owner

Which version of fetch-h2 is this, and do you have a certificate to share?

This looks more like your CA is not trusted. Is it self-signed? Then you need to allow self-signed certificates. In either case, look here for the discussion: https://stackoverflow.com/questions/31673587/error-unable-to-verify-the-first-certificate-in-nodejs
This is not fetch-h2 related per se.

If you want to allow self-signed certs, do:

setup( { session: { rejectUnauthorized: false } } );

before doing any fetch( ).

@sharper
Copy link
Author

sharper commented Mar 18, 2020

san.js 31 / san.ts 50
if subject.CN like: *.domain1.com,*.domain2.com
will throw exception: Invalid CN/subjectAltNames
@grantila

@grantila
Copy link
Owner

Do you have a certificate I can test with? Doesn't look right, you can't have multiple names in subject.CN, you need to use SAN, so the error is correct.

@sharper
Copy link
Author

sharper commented Mar 18, 2020

Our a server crt, CN="*.wanscloud.com,*.ajyun.com.cn,*.ajcloud.net"
and SAN = DNS: wanscloud.com, DNS:*.wanscloud.com, DNS:....

[Subject]
E=[email protected], CN="*.wanscloud.com,*.ajyun.com.cn,*.ajcloud.net", OU=Ajcloud Certification Authority, O="Nanjing Ajcloud Infotech Co., Ltd", C=CN

san.ts line: 50
name.match( /.*\*.*\*.*/ )
the regex for check subdomain, such as: *.*.domain1.com;
but the regex make the CN like: *.domain1.com,*.domain2.com fail.

@grantila

@grantila
Copy link
Owner

Is this a valid certificate, to have multiple comma-separated domains (wildcard or not) in the CN fields? I don't think you're allowed to.

The CN (afaik) should only contain one domain, and the rest (including that in the CN) should be in the SAN.

Also, if you have a SAN, the CN can be ignored, although fetch-h2 doesn't ignore it - it would be allowed to ignore it.

Is this certificate created by a trusted well-known CA? Are browsers like Chrome and Firefox accepting it?

@sharper
Copy link
Author

sharper commented Mar 20, 2020

YES
the self-signed certification can accepted by Chrome and Firefox , Microsoft Edge.

@sharper
Copy link
Author

sharper commented Mar 20, 2020

CN contains one domain, I also see other certs.
I think to re-sign the cert, BUT all services should restart.

grantila added a commit that referenced this issue Mar 21, 2020
Will no longer care about subject CN in certificates, when a subjectaltname is present

fix #92
@github-actions
Copy link

🎉 This issue has been resolved in version 2.4.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants