保存内置DNS续期与证书同步接续修复前基线

This commit is contained in:
xuans committed 2026-09-20 04:39:25 +08:00
1 parent 7fec05650f
commit d6ea80a040
23 files changed
+704 -13

No files matched your search

+22 -2
View File
@@ -931,11 +931,20 @@ func applySectionPayload(current RuntimeConfig, section Section, payload json.Ra
}
candidate.Email.Policy.LoginVerificationPolicy = candidate.SMTP.Relay.LoginPolicy
case SectionSSL:
var value SSLSectionConfig
var value struct {
SSLSectionConfig
DNSAccessKeyStatus json.RawMessage `json:"dnsAccessKeyStatus"`
DNSSecretKeyStatus json.RawMessage `json:"dnsSecretKeyStatus"`
}
if err := ParseStrict(payload, &value); err != nil {
return RuntimeConfig{}, err
}
candidate.SSL = value
if storedSecretHasMaterial(value.TLS.DNSAccessKey) || storedSecretHasMaterial(value.TLS.DNSSecretKey) {
return RuntimeConfig{}, ErrInvalidSecretChange
}
value.TLS.DNSAccessKey = current.SSL.TLS.DNSAccessKey
value.TLS.DNSSecretKey = current.SSL.TLS.DNSSecretKey
candidate.SSL = value.SSLSectionConfig
case SectionPlugins:
var value PluginsSectionConfig
if err := ParseStrict(payload, &value); err != nil {
@@ -1018,6 +1027,17 @@ func applySecretChanges(candidate *RuntimeConfig, section Section, changes map[s
return err
}
candidate.SMTP.Relay.Password = stored
case section == SectionSSL && (name == "tls.dnsAccessKey" || name == "tls.dnsSecretKey"):
target := &candidate.SSL.TLS.DNSAccessKey
if name == "tls.dnsSecretKey" {
target = &candidate.SSL.TLS.DNSSecretKey
}
required := candidate.SSL.TLS.DNSProvider != ""
stored, err := ApplySecretChange(vault, *target, change, SecretPolicy{Required: required, AllowClear: !required, MaxLength: 4096}, now)
if err != nil {
return err
}
*target = stored
default:
return ErrInvalidSecretChange
}