停用 SSH 密钥兼容入口

停用历史 SSH 私钥生成、存储、读取和管理入口,强制服务器使用密码认证。
This commit is contained in:
xuans committed 2026-10-02 04:03:23 +08:00
1 parent 95450cb1eb
commit 7778aa5ced
10 files changed
+80 -614

No files matched your search

+2 -5
View File
@@ -21,7 +21,6 @@ import (
"git.pcux.cn/xuans/Scert/backend/internal/repository"
"git.pcux.cn/xuans/Scert/backend/internal/secretstore"
"git.pcux.cn/xuans/Scert/backend/internal/setup"
"git.pcux.cn/xuans/Scert/backend/internal/sshkey"
)
type App struct {
@@ -34,7 +33,6 @@ type App struct {
Tasks *repository.SQLTaskRepository
Deployment *deployment.Service
SecretStore *secretstore.Store
SSHKeys *sshkey.Service
DNSVerification *setup.DNSVerificationManager
Certificates *certificate.Service
Workflow *CertificateWorkflow
@@ -140,7 +138,6 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
} else if deleted > 0 {
logger.Info("启动时已清理过期审计日志", "count", deleted)
}
sshKeys := sshkey.NewService(secretStore)
accounts := certificate.NewAccountRepository(secretStore)
certificates := certificate.NewService(cfg, repo, secretStore, dnsprovider.NewLegoFactory(), accounts)
aliyunAuthChecker := dnsprovider.NewAliyunAuthorizationChecker()
@@ -177,7 +174,7 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
RetryInterval: time.Duration(cfg.ACME.RenewalRetryIntervalMins) * time.Minute,
}, management)
server = httpapi.New(httpapi.Dependencies{
Config: cfg, ConfigPath: configPath, Logger: logger, Repository: repo, Servers: serverRepo, Users: userRepo, SSHKeys: sshKeys, DeploymentFactory: deployment.SSHFactory{Secrets: secretStore},
Config: cfg, ConfigPath: configPath, Logger: logger, Repository: repo, Servers: serverRepo, Users: userRepo, DeploymentFactory: deployment.SSHFactory{Secrets: secretStore},
ProjectMembers: repository.NewSQLProjectMemberRepository(db.DB, runtimeDatabaseConfig.Driver),
ProjectDirectory: repository.NewSQLProjectMemberRepository(db.DB, runtimeDatabaseConfig.Driver),
ProjectLifecycle: repository.NewSQLProjectMemberRepository(db.DB, runtimeDatabaseConfig.Driver),
@@ -234,7 +231,7 @@ func NewWithConfigPath(ctx context.Context, cfg config.Config, configPath string
Users: userRepo,
Tasks: taskRepo,
Deployment: deploymentService,
SecretStore: secretStore, SSHKeys: sshKeys, DNSVerification: dnsVerification, HTTP: server,
SecretStore: secretStore, DNSVerification: dnsVerification, HTTP: server,
Certificates: certificates,
Workflow: workflow,
Renewal: renewal,
+2 -2
View File
@@ -27,8 +27,8 @@ func TestNewWiresApplicationServices(t *testing.T) {
if application.Deployment == nil || application.Certificates == nil || application.Workflow == nil || application.Renewal == nil {
t.Fatal("证书申请、部署或续期服务未完整注入应用实例")
}
if application.SecretStore == nil || application.SSHKeys == nil || application.DNSVerification == nil || application.HTTP == nil {
t.Fatal("敏感信息、SSH、DNS 或 HTTP 服务未完整注入应用实例")
if application.SecretStore == nil || application.DNSVerification == nil || application.HTTP == nil {
t.Fatal("敏感信息、DNS 或 HTTP 服务未完整注入应用实例")
}
}
func TestNewWithConfigPathRecoversInterruptedTasks(t *testing.T) {