-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Caddy PKI without Root key #6290
Comments
If there is no root, how can there be an intermediate? 🤔 I guess I don't fully understand what you're asking. |
The root exists but could be a public CA that issues me an intermediate certificate to use or the root exists in a HSM and as such the key is not exportable. So I can supply the cert which is public information but I cannot access the root private key (or simply don't want to give the caddy server access to it). Does that make sense?
…On Thu, May 2, 2024, at 16:49, Matt Holt wrote:
If there is no root, how can there be an intermediate? 🤔 I guess I
don't fully understand what you're asking.
—
Reply to this email directly, view it on GitHub
<#6290 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAT5C6FVCKXILHJJOP7D3TZAJG7NAVCNFSM6AAAAABHDVM2TOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJQG4YDMMZQGE>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
As a workaround, you could set your |
Hm have to check if that then return the correct chain with acme_server
…On Thu, May 2, 2024, at 17:13, Francis Lavoie wrote:
As a workaround, you could set your `intermediate` as the `root` and
then set `sign_with_root`.
—
Reply to this email directly, view it on GitHub
<#6290 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAT5C74DRWLGUHNRMIG7Q3ZAJJYVAVCNFSM6AAAAABHDVM2TOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJQG43TQNRZGE>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Oh, yeah I think it wouldn't. Also I just realized we never wired up |
Ok, gotcha, so the root exists, you're talking about just not loading it into the config. We could probably work on making that possible. |
This simple diff makes it work for me. diff --git a/modules/caddypki/crypto.go b/modules/caddypki/crypto.go
index 386ce629..24c04686 100644
--- a/modules/caddypki/crypto.go
+++ b/modules/caddypki/crypto.go
@@ -78,18 +78,21 @@ func (kp KeyPair) Load() (*x509.Certificate, crypto.Signer, error) {
if err != nil {
return nil, nil, err
}
- keyData, err := os.ReadFile(kp.PrivateKey)
- if err != nil {
- return nil, nil, err
- }
-
cert, err := pemDecodeSingleCert(certData)
if err != nil {
return nil, nil, err
}
- key, err := certmagic.PEMDecodePrivateKey(keyData)
- if err != nil {
- return nil, nil, err
+
+ var key crypto.Signer = nil
+ if kp.PrivateKey != "" {
+ keyData, err := os.ReadFile(kp.PrivateKey)
+ if err != nil {
+ return nil, nil, err
+ }
+ key, err = certmagic.PEMDecodePrivateKey(keyData)
+ if err != nil {
+ return nil, nil, err
+ }
}
return cert, key, nil Now I was able to configure the acme server like this:
|
@apollo13 I think that would be okay. Want to submit a PR for review? |
Will do, not sure if I will manage writing the tests. This is the first time I am doing something with caddy at all -- might need some help there then. Out of curiosity, is the ca stuff pluggable? Ie could I write a plugin that would call out to another CA to issue the certs instead of providing caddy with the private keys?
…On Fri, May 3, 2024, at 17:32, Matt Holt wrote:
@apollo13 <https://github.com/apollo13> I think that would be okay.
Want to submit a PR for review?
—
Reply to this email directly, view it on GitHub
<#6290 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAT5CY764MW6IIFJOO6RODZAOUXDAVCNFSM6AAAAABHDVM2TOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJTGI2TAMBTGM>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sure, we can help out. (Might just take us some time, heh, quite busy!)
The |
No worries.
But those cannot be used from |
* Allow usage of root CA without a key. Fixes #6290 * Update modules/caddypki/crypto.go --------- Co-authored-by: Matt Holt <[email protected]>
Hi, according to the docs the caddy pki can be configured like this:
if I am solely using the intermediate to issue certificates, then there is no reason to supply the root key. Would it be possible to allow configuration of caddy without a root key?
The text was updated successfully, but these errors were encountered: