Skip to content

Handle externally-generated CSRs that have no attributes#317

Merged
rmbolger merged 2 commits into
mainfrom
unknown repository
Feb 4, 2021
Merged

Handle externally-generated CSRs that have no attributes#317
rmbolger merged 2 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 4, 2021

Copy link
Copy Markdown

Hi Ryan,

I've made a small patch to Get-CsrDetails so that it can handle CSRs that have no attributes, such as if there were no SANs in the CSR. Get-CsrDetails already handles CSRs that have a CN and non-SAN attributes but no SANs, so it was just the no-attributes-at-all case that it didn't like.

Of course it would be good if every program that generated CSRs automatically added the CN as a SAN, but for those that don't and which need to generate the private key themselves (eg if it's generated and stored in a hardware security module) this will allow Posh-ACME to be used to submit their CSRs.

Thanks!

Martin

@rmbolger

rmbolger commented Feb 4, 2021

Copy link
Copy Markdown
Owner

Ooh, nice! Thanks @methorpe. Would it be possible to add an example CSR with no attributes into the Tests\TestFiles folder? I'd like to add a test for this in the Pester tests, but I'm not sure how to generate one specifically like this.

@rmbolger rmbolger self-assigned this Feb 4, 2021
@rmbolger rmbolger added the enhancement New feature or request label Feb 4, 2021
…t case

A similar CSR can be generated as follows:
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out rsa-2048-onlyCN-no-attrs.pem
openssl req -new -key rsa-2048-onlyCN-no-attrs.pem -out rsa-2048-onlyCN-no-attrs.csr -subj "/CN=example.com"
@ghost

ghost commented Feb 4, 2021 via email

Copy link
Copy Markdown
Author

@rmbolger

rmbolger commented Feb 4, 2021

Copy link
Copy Markdown
Owner

Perfect! Thanks a ton. You are awesome.

@rmbolger rmbolger merged commit 53c852a into rmbolger:main Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant