移除SSH密钥入口并固定密码认证

This commit is contained in:
xuans 2026-10-02 06:58:22 +08:00
parent fb1e36313b
commit 626de357ba
5 changed files with 3 additions and 7 deletions

View File

@ -81,7 +81,7 @@ func newRootCommand() *cobra.Command {
newLogsCommand(), newConfigCommand(), newBackupCommand(), newRestoreCommand(),
newServiceCommand(), newDNSCommand(),
)
for _, name := range []string{"domain", "server", "ssh-key", "renew", "deploy"} {
for _, name := range []string{"domain", "server", "renew", "deploy"} {
root.AddCommand(newRetiredBusinessCommand(name))
}
localizeHelpFlags(root)

View File

@ -33,7 +33,7 @@ func TestRootExposesOnlyOperationalCommands(t *testing.T) {
if err := root.Execute(); err != nil {
t.Fatal(err)
}
for _, name := range []string{"domain", "server", "ssh-key", "renew", "deploy"} {
for _, name := range []string{"domain", "server", "renew", "deploy"} {
if strings.Contains(output.String(), "\n "+name+" ") {
t.Errorf("正式帮助仍展示历史业务命令:%s", name)
}
@ -48,8 +48,6 @@ func TestRetiredBusinessCommandsRejectBeforeAccessingData(t *testing.T) {
{"domain", "import", "--private-key", "not-a-real-key.pem"},
{"server", "add", "--password", "test-secret-not-real"},
{"server", "delete", "--id", "example"},
{"ssh-key", "add", "--name", "example"},
{"ssh-key", "delete", "--id", "example"},
{"renew"},
{"renew", "--id", "example"},
{"deploy", "--id", "example"},

View File

@ -399,7 +399,6 @@ type serverRequest struct {
Address string `json:"address" binding:"required"`
Port int `json:"port"`
Username string `json:"username" binding:"required"`
AuthMethod string `json:"auth_method"`
Password string `json:"password"`
HostKeyFingerprint string `json:"host_key_fingerprint" binding:"required"`
CertificatePath string `json:"certificate_path"`

View File

@ -518,7 +518,6 @@ export function useDashboard() {
address: serverForm.value.address,
port: Number(serverForm.value.port),
username: serverForm.value.username,
auth_method: "password",
host_key_fingerprint: serverForm.value.host_key_fingerprint,
certificate_path: serverForm.value.certificate_path,
private_key_path: serverForm.value.private_key_path,

View File

@ -328,8 +328,8 @@ test("部署服务器仅使用密码认证且不暴露私钥管理入口", async
state.serverForm.value.host_key_fingerprint = "SHA256:test";
await state.saveServer();
const payload = JSON.parse(requests.at(-1).body);
assert.equal(payload.auth_method, "password");
assert.equal(payload.password, "test-password");
assert.equal("auth_method" in payload, false);
assert.equal("private_key_ref" in payload, false);
});