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

Fix the invalid use of SAN in the CSR #3

Merged
merged 1 commit into from Mar 30, 2019
Merged

Fix the invalid use of SAN in the CSR #3

merged 1 commit into from Mar 30, 2019

Conversation

breard-r
Copy link
Contributor

The current Certificate Signing Request (CSR) implementation include one
instance of the Subject Alternative Name (SAN) extension per domain name
after the Common Name (CN). This is forbidden by RFC 5280 which state,
in section 4.2, that "A certificate MUST NOT include more than one
instance of a particular extension".
This causes a bug when requesting a certificate for more than two domain
names since the ACME servers are likely to consider only the first SAN.
For instance, Let's Encrypt does that and, when requesting a
certificate for three or more domains, refuse to issue it and returns
"Order includes different number of names than CSR specifies" since it
can read only two domains in the CSR (one as the CN and one as the first
SAN).
Considering this issue, this commit changes the way acme-lib builds the
CSR. All domain names are now set up in one SAN. Please note that, since
the RFC 8555 (ACME protocol) does not differentiate domain names set in
the CN and domain names set in the SAN, this commit does not provide a
CN. This approach is simpler and does not affect the issuing process.
https://tools.ietf.org/html/rfc5280
https://tools.ietf.org/html/rfc8555

The current Certificate Signing Request (CSR) implementation include one
instance of the Subject Alternative Name (SAN) extension per domain name
after the Common Name (CN). This is forbidden by RFC 5280 which state,
in section 4.2, that "A certificate MUST NOT include more than one
instance of a particular extension".
This causes a bug when requesting a certificate for more than two domain
names since the ACME servers are likely to consider only the first SAN.
For instance, Let's Encrypt does that and, when requesting  a
certificate for three or more domains, refuse to issue it and returns
"Order includes different number of names than CSR specifies" since it
can read only two domains in the CSR (one as the CN and one as the first
SAN).
Considering this issue, this commit changes the way acme-lib builds the
CSR. All domain names are now set up in one SAN. Please note that, since
the RFC 8555 (ACME protocol) does not differentiate domain names set in
the CN and domain names set in the SAN, this commit does not provide a
CN. This approach is simpler and does not affect the issuing process.
https://tools.ietf.org/html/rfc5280
https://tools.ietf.org/html/rfc8555
@lolgesten
Copy link
Collaborator

Good point! I just need to glance over that I don't use the CN somewhere else.

@breard-r
Copy link
Contributor Author

I just need to glance over that I don't use the CN somewhere else.

It's quite unlikely: as far as i know, the CSR is built, sent to the ACME server and then discarded. After that, the server issue a certificate with the first SAN as the CN. I tested the patched version and it works just fine.
By the way, not setting a CN is the way most ACME client works (example: certbot).

@lolgesten
Copy link
Collaborator

Alright. Thank you so much!

@lolgesten lolgesten merged commit c3c8f34 into algesten:master Mar 30, 2019
breard-r added a commit to breard-r/acmed that referenced this pull request Mar 30, 2019
Due to a bug in the `acme-lib` dependency, the Certificate Signing
Request was not built correctly. This issue caused the ACME server to
reject such CSR when ordiring more than two domains.
algesten/acme-lib#3
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.

None yet

2 participants