保存审查现场并开始修复剩余问题
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-06 11:03:16 +08:00
1 parent 391f6bfed6
commit addfcea1cd
2 files changed
+67 -8

No files matched your search

+13 -7
View File
@@ -295,6 +295,18 @@ func sslDomains(cfg *config.Config) []string {
}
return domains
}
func certificateMatchesConfiguredDomains(cert *x509.Certificate, cfg *config.Config) bool {
if cert == nil || cfg == nil {
return false
}
for _, domain := range sslDomains(cfg) {
if err := cert.VerifyHostname(domain); err != nil {
return false
}
}
return true
}
func wildcardCertificateDomains(cfg *config.Config) []string {
if cfg == nil {
return nil
@@ -509,13 +521,7 @@ func CheckSSLCrtInfo() (int, time.Time, bool, error) {
return -1, time.Now(), true, errors.Wrap(err)
}
nameMatchFail := true
for _, name := range cert.DNSNames {
if strings.Contains(name, "imap") {
nameMatchFail = false
break
}
}
nameMatchFail := !certificateMatchesConfiguredDomains(cert, cfg)
// 检查过期时间
hours := cert.NotAfter.Sub(time.Now()).Hours()