主要变更: - RDP 远程桌面:新增 backend/pkg/rdp(RDP 引擎 + credssp/display/rle/trace)、 backend/controller/rdp*(连接/凭证/文件/会话/实时)、frontend RDP 组件与 API - Windows SMB 文件传输:backend/pkg/winsmb - 云账单同步:backend/pkg/billingsync + billing_sync/aliyun_billing,前端账单详情 - Agent CLI Kubernetes 工具:kubernetes_action/get、pod_execute/logs - 服务器导入助手:server_import_helpers、ImportCredentialSettings - 国际化与组件重构(cloud/deploy/monitor/server/system 等多模块) - 清理编译产物二进制:移除 backend/server、backend/agent/bin/aiops-agent-* - .gitignore:新增 backend/agent/ 与 .cache/(避免 334MB go-build 缓存误入库) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
886 B
Go
35 lines
886 B
Go
package controller
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
|
|
"ezops/model"
|
|
"ezops/pkg/crypto"
|
|
)
|
|
|
|
// loadRDPCredential 解密并解析 Windows 服务器 RDP 凭据 // Logan.Li
|
|
func loadRDPCredential(crypt *crypto.SecretBox, server model.Server) (model.RDPSecretContent, error) {
|
|
var cred model.RDPSecretContent
|
|
if server.Password == "" {
|
|
return cred, errors.New("该 Windows 资产未关联 RDP 凭据")
|
|
}
|
|
plain := server.Password
|
|
if dec, err := crypt.Decrypt(server.Password); err == nil {
|
|
plain = dec
|
|
}
|
|
if err := json.Unmarshal([]byte(plain), &cred); err != nil {
|
|
cred.Username = server.Username
|
|
cred.Password = plain
|
|
}
|
|
if cred.Username == "" {
|
|
cred.Username = server.Username
|
|
}
|
|
if cred.Security == "" {
|
|
cred.Security = "nla"
|
|
}
|
|
if cred.Username == "" || cred.Password == "" {
|
|
return cred, errors.New("RDP 凭据缺少用户名或密码")
|
|
}
|
|
return cred, nil
|
|
} |