!11 [Fix] changed API Field name and mitigated defunct(zombie) processes
* [Fix] zombie processes caused by `tail -f /dev/null` * [Fix] Rename field in API **GET** `/api/devstar_ssh/key_pair/new_temp`: `publicKeyFingerprint` -> `publicKeySsh`
This commit is contained in:
@@ -37,10 +37,10 @@ func GenerateNewSSHSessionKeyPair(ctx *gitea_web_context.Context) {
|
||||
Code: Result.RespSuccess.Code,
|
||||
Msg: Result.RespSuccess.Msg,
|
||||
Data: map[string]string{
|
||||
"publicKeyPem": vo.PublicKeyPEM,
|
||||
"privateKeyPem": vo.PrivateKeyPEM,
|
||||
"publicKeyFingerprint": vo.PublicKeyFingerprint,
|
||||
"KeySize": vo.KeySize,
|
||||
"publicKeyPem": vo.PublicKeyPEM,
|
||||
"privateKeyPem": vo.PrivateKeyPEM,
|
||||
"publicKeySsh": vo.PublicKeySsh,
|
||||
"KeySize": vo.KeySize,
|
||||
},
|
||||
}
|
||||
resp.RespondJson2HttpResponseWriter(ctx.Resp)
|
||||
|
||||
@@ -36,7 +36,7 @@ func AssignDevcontainerCreation2K8sOperator(ctx *context.Context, newDevContaine
|
||||
CommandList: []string{
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"service ssh restart && tail -f /dev/null",
|
||||
"service ssh restart && sleep infinity",
|
||||
},
|
||||
ContainerPort: 22,
|
||||
ServicePort: 22,
|
||||
|
||||
@@ -60,19 +60,19 @@ func GenerateNewRSASSHSessionKeyPair() (error, *vo.GenerateNewRSASSHSessionKeyPa
|
||||
}
|
||||
publicKeyPemStr := string(publicKeyPem)
|
||||
|
||||
// 3. 计算 SSH Public Key Fingerprint,用于 ~/.ssh/authorized_keys
|
||||
// 3. 计算 SSH Public SSH Key,用于 ~/.ssh/authorized_keys
|
||||
sshPublicKey, err := ssh.NewPublicKey(&publicKey)
|
||||
if err != nil {
|
||||
return errors.ErrGenerateNewRSASSHSessionKeyPair{
|
||||
Action: "Calculate SSH Public Key Fingerprint",
|
||||
Action: "Calculate SSH Public SSH Key",
|
||||
Message: err.Error(),
|
||||
}, nil
|
||||
}
|
||||
sshPublicKeyfingerprintSHA256Str := string(ssh.MarshalAuthorizedKey(sshPublicKey))
|
||||
sshPublicKeyStr := string(ssh.MarshalAuthorizedKey(sshPublicKey))
|
||||
return nil, &vo.GenerateNewRSASSHSessionKeyPairVO{
|
||||
PublicKeyPEM: publicKeyPemStr,
|
||||
PrivateKeyPEM: privateKeyPemStr,
|
||||
PublicKeyFingerprint: sshPublicKeyfingerprintSHA256Str,
|
||||
KeySize: strconv.Itoa(setting.Devstar.SSHKeypair.KeySize),
|
||||
PublicKeyPEM: publicKeyPemStr,
|
||||
PrivateKeyPEM: privateKeyPemStr,
|
||||
PublicKeySsh: sshPublicKeyStr,
|
||||
KeySize: strconv.Itoa(setting.Devstar.SSHKeypair.KeySize),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package vo
|
||||
|
||||
type GenerateNewRSASSHSessionKeyPairVO struct {
|
||||
PublicKeyPEM string
|
||||
PrivateKeyPEM string
|
||||
PublicKeyFingerprint string
|
||||
KeySize string
|
||||
PublicKeyPEM string
|
||||
PrivateKeyPEM string
|
||||
PublicKeySsh string
|
||||
KeySize string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user