Closed mdepot closed 2 months ago
Interesting -- I guess that makes sense. Have you confirmed that fixes it for you? If so I can push a patch right away (or merge a PR if you want the credit).
I did not test any code changes, however I can say that removing the extra (second) newline at the end of my cert file did eliminate the error.
By adding a newline to a certificate I am not able to reproduce the error, so I can't fix the bug.
If you can post enough information here to reproduce the behavior, I can reopen this and patch it up. Until then this isn't actionable so I'll close the issue.
Caddy is throwing the error "input contained more than a single PEM block" even though I confirmed the cert I was referencing was a single block. It turns out this is happening simply because my cert file had an extra newline at the end of the file.
The error comes from function pemDecodeSingleCert in file caddy/modules/caddypki/crypto.go
Perhaps consider changing from
if len(remaining) > 0
toif len(strings.TrimSpace(remaining)) > 0