Custom subject parameters for private ACME CA

Thank you for Caddy!

The problem I’m having

For a private CA there is a requirement to set certain parameters (C, ST, L, O, OU) in the subject. This CA is now also offering an ACME directory endpoint, but these parameters are still required.

It would be nice to be able to use ACME with Caddy directly in this setting. Is there a way to configure these parameters in Caddy?

I could only find https://caddyserver.com/docs/json/apps/tls/automation/policies/subjects/ in the documentation, but that seems more Caddy internal policy related. Is that correct?

Caddy version:

2.9.1

Currently, there’s not a way to set those fields with the fully-automated internal CA. But you could provide your own root (and intermediate, if you wish) that has those filled out. Or someone could submit a PR to add this capability.

PS. The relevant part of the config is the pki app: JSON Config Structure - Caddy Documentation

Sorry, Matt. I meant an external CA (managed by a supplier; unsure of the used software) that requires those fields to be set in the CSR when using ACME.

Would it be possible to set those fields in this case?

More specifically, this is the error we are getting:

{"level":"error","ts":1739792194.9596744,"logger":"tls.obtain","msg":"could not get certificate from issuer","identifier":"test.internal.domain.org","issuer":"suppliername-acme-v2-directory","error":"HTTP 400 urn:ietf:params:acme:error:badCSR - Bad signature on CSR: Common Name (CN) is empty\n"}

Well, CommonName on leaf certs has been deprecated for over 20 years, so I don’t think Caddy has any interest in supporting that field in that case.

But I’m open to supporting the other fields.

2 Likes

Thank you, Matt! If we were to implement this, what would be the best place for this change?

Probably in CertMagic’s generateCSR() function:

Writing an issue with a proposal might be a good idea first before you spend too much time editing code that may have to be revised.

2 Likes