1 parent
74493f0d5b
commit
606861822b
18 files changed
+129
-90
No files matched your search
@@ -133,8 +133,8 @@ func CurrentWebDomain() string {
|
||||
return cfg.WebDomain
|
||||
}
|
||||
|
||||
// CurrentAdminRecoveryDomain 返回超级管理员本机恢复通道的部署标识域名。
|
||||
// 此值不用于提供公网重置路由;未配置时沿用主邮件域名。
|
||||
// CurrentAdminRecoveryDomain 仅用于读取旧配置。
|
||||
// 公网一次性恢复入口统一使用 CurrentWebDomain,不再使用独立恢复域名。
|
||||
func CurrentAdminRecoveryDomain() string {
|
||||
if manager := CurrentManager(); manager != nil {
|
||||
runtime := manager.Snapshot()
|
||||
|
||||
@@ -192,9 +192,6 @@ func validationCertificateDomains(candidate *RuntimeConfig) []string {
|
||||
if candidate.Root.Domains.Web != "" {
|
||||
domains = append(domains, candidate.Root.Domains.Web)
|
||||
}
|
||||
if candidate.Root.Domains.AdminRecovery != "" {
|
||||
domains = append(domains, candidate.Root.Domains.AdminRecovery)
|
||||
}
|
||||
for _, domain := range candidate.Root.Domains.Accepted {
|
||||
domains = append(domains, "smtp."+domain, "imap."+domain, "pop."+domain)
|
||||
}
|
||||
@@ -204,11 +201,11 @@ func validationCertificateDomains(candidate *RuntimeConfig) []string {
|
||||
}
|
||||
|
||||
func runtimeCertificateDomains(candidate *RuntimeConfig) []string {
|
||||
return SSLCertificateDomains(candidate.Root.Domains.Primary, candidate.Root.Domains.Web, candidate.Root.Domains.Accepted, candidate.Root.Domains.AdminRecovery)
|
||||
return SSLCertificateDomains(candidate.Root.Domains.Primary, candidate.Root.Domains.Web, candidate.Root.Domains.Accepted)
|
||||
}
|
||||
|
||||
// SSLCertificateDomains 统一初始化和配置管理所需的 Web、主域、邮件协议及恢复通道域名。
|
||||
func SSLCertificateDomains(primary, web string, accepted []string, adminRecovery ...string) []string {
|
||||
// SSLCertificateDomains 统一初始化和配置管理所需的 Web、主域及邮件协议域名。
|
||||
func SSLCertificateDomains(primary, web string, accepted []string) []string {
|
||||
seen := make(map[string]bool)
|
||||
var domains []string
|
||||
appendDomain := func(value string) {
|
||||
@@ -220,9 +217,6 @@ func SSLCertificateDomains(primary, web string, accepted []string, adminRecovery
|
||||
}
|
||||
appendDomain(web)
|
||||
appendDomain(primary)
|
||||
for _, domain := range adminRecovery {
|
||||
appendDomain(domain)
|
||||
}
|
||||
for _, domain := range accepted {
|
||||
domain = strings.TrimSpace(domain)
|
||||
if domain == "" {
|
||||
|
||||
@@ -191,9 +191,9 @@ func TestValidateSSLMaterialRejectsDomainExpiryAndWeakKeys(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSSLCertificateDomainsIncludesConfiguredAdminRecoveryDomain(t *testing.T) {
|
||||
domains := SSLCertificateDomains("example.com", "mail.example.com", []string{"example.com"}, "recovery.example.com")
|
||||
for _, want := range []string{"example.com", "mail.example.com", "recovery.example.com", "smtp.example.com", "imap.example.com", "pop.example.com"} {
|
||||
func TestSSLCertificateDomainsIncludesWebAndMailServiceDomains(t *testing.T) {
|
||||
domains := SSLCertificateDomains("example.com", "mail.example.com", []string{"example.com"})
|
||||
for _, want := range []string{"example.com", "mail.example.com", "smtp.example.com", "imap.example.com", "pop.example.com"} {
|
||||
found := false
|
||||
for _, got := range domains {
|
||||
if got == want {
|
||||
|
||||
Reference in new issue
Block a user