mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-30 10:01:40 +02:00
caddypki: Prefer user-configured root instead of generating new one (#5189)
instead of generating a new root certificate at the default location load the certificate from the configuration. fixes: #5181
This commit is contained in:
parent
6efd1b3bb1
commit
33fdea8f26
1 changed files with 3 additions and 0 deletions
|
@ -240,6 +240,9 @@ func (ca *CA) NewAuthority(authorityConfig AuthorityConfig) (*authority.Authorit
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ca CA) loadOrGenRoot() (rootCert *x509.Certificate, rootKey any, err error) {
|
func (ca CA) loadOrGenRoot() (rootCert *x509.Certificate, rootKey any, err error) {
|
||||||
|
if ca.Root != nil {
|
||||||
|
return ca.Root.Load()
|
||||||
|
}
|
||||||
rootCertPEM, err := ca.storage.Load(ca.ctx, ca.storageKeyRootCert())
|
rootCertPEM, err := ca.storage.Load(ca.ctx, ca.storageKeyRootCert())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, fs.ErrNotExist) {
|
if !errors.Is(err, fs.ErrNotExist) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue