caddyserver / caddyserver/certmagic
CacheUnmanagedCertificatePEMBytes returns only the first certificate and omits intermediate and root certificates. What am I doing wrong?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.6k
- Forks
- 354
- Avg merge
- 9d 23h
- Merged PRs (30d)
- 3
Description
What is your question?
I'm using CacheUnmanagedCertificatePEMBytes and manage custom TLS for several websites using the following code:
cnf := certmagic.NewDefault()
cnf.CacheUnmanagedCertificatePEMBytes(
context.Background(),
[]byte(appConfig.CertValue),
[]byte(appConfig.CertKey),
nil,
)
// I also manage `on-demand` certificates on the same
// server for applications that do not define a custom certificate:
certmagic.Default.OnDemand = &certmagic.OnDemandConfig{
DecisionFunc: myDecisionFunc(),
}
// and finally spin up the server using `HTTPS` method:
certmagic.HTTPS(/* ... */)
Despite passing the full certificate chain to certmagic, the server returns only the first certificate and omits intermediary and root certificates.
Browsers are handling this correctly because they retrieve the missing certificates, but when I use SSL tools, they also throw errors.
What have you already tried?
Include any other information or discussion.
Bonus: What do you use this package for, and does it help you?
I use this at stormkit.io to issue dynamic certificates for hosted apps. Self-hosted enterprise customers usually prefer to host their managed certificates so I have to use a combination between dynamic and managed certificates. It works pretty well, thanks for your work 🙏
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing CacheUnmanagedCertificatePEMBytes through the HTTPS setup and compare the certificate chain it receives with what the server exposes. Done means determining whether the reported omission is expected behavior or a defect and identifying the required change or configuration; the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100