fix: 支持测试根证书注入解决部署HTTPS回环校验报错并升级版本号至v1.52.5
This commit is contained in:
1 parent
0c1a04e1e7
commit
d123ff3f35
11 files changed
+62
-16
No files matched your search
@@ -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,3 +1,3 @@
|
||||
package buildinfo
|
||||
|
||||
const Version = "1.52.4"
|
||||
const Version = "1.52.5"
|
||||
@@ -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 {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
protectedAliyunDomain = "disabled-protected.invalid"
|
||||
protectedAliyunDomain = "pcux.cn"
|
||||
aliyunZoneResolutionTimeout = 2 * time.Second
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user