mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-04 13:37:41 +03:00
tls/acme: Return certmagic.New config in GetConfigForCert
Might have caused partially broken configurations e.g. #619.
This commit is contained in:
parent
b8ff1168a0
commit
d9920f0763
1 changed files with 6 additions and 9 deletions
|
@ -83,10 +83,7 @@ func (l *Loader) Init(cfg *config.Map) error {
|
|||
l.cache = certmagic.NewCache(certmagic.CacheOptions{
|
||||
Logger: cmLog,
|
||||
GetConfigForCert: func(c certmagic.Certificate) (*certmagic.Config, error) {
|
||||
return &certmagic.Config{
|
||||
Storage: l.store,
|
||||
Logger: cmLog,
|
||||
}, nil
|
||||
return l.cfg, nil
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -95,7 +92,7 @@ func (l *Loader) Init(cfg *config.Map) error {
|
|||
Logger: cmLog,
|
||||
DefaultServerName: hostname,
|
||||
})
|
||||
mngr := certmagic.NewACMEIssuer(l.cfg, certmagic.ACMEIssuer{
|
||||
issuer := certmagic.NewACMEIssuer(l.cfg, certmagic.ACMEIssuer{
|
||||
Logger: cmLog,
|
||||
CA: caPath,
|
||||
Email: email,
|
||||
|
@ -104,19 +101,19 @@ func (l *Loader) Init(cfg *config.Map) error {
|
|||
|
||||
switch challenge {
|
||||
case "dns-01":
|
||||
mngr.DisableTLSALPNChallenge = true
|
||||
mngr.DisableHTTPChallenge = true
|
||||
issuer.DisableTLSALPNChallenge = true
|
||||
issuer.DisableHTTPChallenge = true
|
||||
if provider == nil {
|
||||
return fmt.Errorf("tls.loader.acme: dns-01 challenge requires a configured DNS provider")
|
||||
}
|
||||
mngr.DNS01Solver = &certmagic.DNS01Solver{
|
||||
issuer.DNS01Solver = &certmagic.DNS01Solver{
|
||||
DNSProvider: provider,
|
||||
OverrideDomain: overrideDomain,
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("tls.loader.acme: challenge not supported")
|
||||
}
|
||||
l.cfg.Issuers = []certmagic.Issuer{mngr}
|
||||
l.cfg.Issuers = []certmagic.Issuer{issuer}
|
||||
|
||||
if module.NoRun {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue