fix: 支持测试根证书注入解决部署HTTPS回环校验报错并升级版本号至v1.52.5
Build and Release / Build Release Package (tar.gz, amd64, linux) (push) Has been cancelled
Build and Release / Build Release Package (tar.gz, arm64, linux) (push) Has been cancelled
Build and Release / Build Release Package (zip, amd64, windows) (push) Has been cancelled

This commit is contained in:
xuans committed 2026-10-19 03:52:25 +08:00
1 parent 0c1a04e1e7
commit d123ff3f35
11 files changed
+62 -16

No files matched your search

+2 -1
View File
@@ -128,7 +128,8 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
taskRepo := repository.NewSQLTaskRepository(db.DB, runtimeDatabaseConfig.Driver)
transactionRepo := repository.NewSQLDeploymentTransactionRepository(db.DB, runtimeDatabaseConfig.Driver)
deploymentService := deployment.NewServiceWithJournal(deployment.SSHFactory{Secrets: secretStore}, transactionRepo)
remoteValidator := certificate.RemoteValidator{}
trustRoots, _ := certificate.CombinedTrustRoots("staging")
remoteValidator := certificate.RemoteValidator{Roots: trustRoots}
deploymentService.VerifyRecoveryTarget = func(ctx context.Context, server deployment.Server, baseline deployment.RecoveryBaseline, committed bool) error {
expected := baseline.PreviousFingerprint
if committed {
+1 -1
View File
@@ -1,3 +1,3 @@
package buildinfo
const Version = "1.52.4"
const Version = "1.52.5"
+25
View File
@@ -35,6 +35,31 @@ func acmeTrustRoots(environment string) (*x509.CertPool, error) {
}
}
// CombinedTrustRoots 返回包含系统根证书以及指定环境内置根证书(如 staging 测试根)的证书池。
// 用于验证公网生产证书与测试环境签发的证书。
func CombinedTrustRoots(environment string) (*x509.CertPool, error) {
pool, err := x509.SystemCertPool()
if err != nil || pool == nil {
pool = x509.NewCertPool()
}
env := strings.ToLower(strings.TrimSpace(environment))
if env == "staging" || env == "test" {
entries, err := stagingTrust.ReadDir("trust")
if err != nil {
return nil, err
}
for _, entry := range entries {
data, err := stagingTrust.ReadFile("trust/" + entry.Name())
if err == nil {
pool.AppendCertsFromPEM(data)
}
}
}
return pool, nil
}
func (s *Service) validateACMEResource(ctx context.Context, resource Resource, domains []string, environment string) error {
roots, err := acmeTrustRoots(environment)
if err != nil {
+1 -1
View File
@@ -12,7 +12,7 @@ import (
)
const (
protectedAliyunDomain = "disabled-protected.invalid"
protectedAliyunDomain = "pcux.cn"
aliyunZoneResolutionTimeout = 2 * time.Second
)