SSH登录支持Passphrase

This commit is contained in:
GoEdgeLab
2021-11-06 15:31:07 +08:00
parent a1ec1d8b1d
commit 3f0e664529
10 changed files with 59 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ func (this *CreateAction) RunPost(params struct {
Username string
Password string
PrivateKey string
Passphrase string
Description string
Must *actions.Must
@@ -58,6 +59,7 @@ func (this *CreateAction) RunPost(params struct {
Username: params.Username,
Password: params.Password,
PrivateKey: params.PrivateKey,
Passphrase: params.Passphrase,
Description: params.Description,
NodeId: 0,
})

View File

@@ -29,6 +29,7 @@ func (this *CreatePopupAction) RunPost(params struct {
Username string
Password string
PrivateKey string
Passphrase string
Description string
Must *actions.Must
@@ -59,6 +60,7 @@ func (this *CreatePopupAction) RunPost(params struct {
Username: params.Username,
Password: params.Password,
PrivateKey: params.PrivateKey,
Passphrase: params.Passphrase,
Description: params.Description,
NodeId: 0,
})

View File

@@ -40,6 +40,7 @@ func (this *GrantAction) RunGet(params struct {
"username": grant.Username,
"password": strings.Repeat("*", len(grant.Password)),
"privateKey": grant.PrivateKey,
"passphrase": strings.Repeat("*", len(grant.Passphrase)),
"description": grant.Description,
"su": grant.Su,
}

View File

@@ -43,6 +43,7 @@ func (this *UpdateAction) RunGet(params struct {
"username": grant.Username,
"password": grant.Password,
"privateKey": grant.PrivateKey,
"passphrase": grant.Passphrase,
"description": grant.Description,
"su": grant.Su,
}
@@ -57,6 +58,7 @@ func (this *UpdateAction) RunPost(params struct {
Username string
Password string
PrivateKey string
Passphrase string
Description string
Must *actions.Must
@@ -93,6 +95,7 @@ func (this *UpdateAction) RunPost(params struct {
Username: params.Username,
Password: params.Password,
PrivateKey: params.PrivateKey,
Passphrase: params.Passphrase,
Description: params.Description,
NodeId: 0,
})

View File

@@ -43,6 +43,7 @@ func (this *UpdatePopupAction) RunGet(params struct {
"password": grant.Password,
"description": grant.Description,
"privateKey": grant.PrivateKey,
"passphrase": grant.Passphrase,
}
this.Show()
@@ -56,6 +57,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Username string
Password string
PrivateKey string
Passphrase string
Description string
Must *actions.Must
@@ -91,6 +93,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Username: params.Username,
Password: params.Password,
PrivateKey: params.PrivateKey,
Passphrase: params.Passphrase,
Description: params.Description,
NodeId: params.NodeId,
})

View File

@@ -26,7 +26,7 @@
<tr>
<td>SSH用户名 *</td>
<td>
<input type="text" name="username" maxlength="100"/>
<input type="text" name="username" maxlength="100" value="root"/>
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
@@ -42,17 +42,24 @@
<tr>
<td>SSH用户名 *</td>
<td>
<input type="text" name="username" maxlength="100"/>
<input type="text" name="username" maxlength="100" value="root"/>
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
<tr>
<td>RSA私钥 *</td>
<td>
<textarea name="privateKey"></textarea>
<textarea name="privateKey" spellcheck="false"></textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
<tr>
<td>私钥密码<br/><em>Passphrase</em></td>
<td>
<input type="password" name="passphrase" maxlength="200"/>
<p class="comment">为私钥设置了密码Passphrase后需要填写。</p>
</td>
</tr>
</tbody>
<tr>

View File

@@ -24,7 +24,7 @@
<tr>
<td>SSH用户名 *</td>
<td>
<input type="text" name="username" maxlength="100"/>
<input type="text" name="username" maxlength="100" value="root"/>
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
@@ -40,17 +40,24 @@
<tr>
<td>SSH用户名 *</td>
<td>
<input type="text" name="username" maxlength="100"/>
<input type="text" name="username" maxlength="100" value="root"/>
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
<tr>
<td>RSA私钥 *</td>
<td>
<textarea name="privateKey"></textarea>
<textarea name="privateKey" spellcheck="false"></textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
<tr>
<td>私钥密码<br/><em>Passphrase</em></td>
<td>
<input type="password" name="passphrase" maxlength="200"/>
<p class="comment">为私钥设置了密码Passphrase后需要填写。</p>
</td>
</tr>
</tbody>
<tr>

View File

@@ -26,11 +26,11 @@
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
<tr>
<td>SSH密码</td>
<td>{{grant.password}}
<p class="comment">SSH登录用户密码。</p> </td>
</tr>
<tr>
<td>SSH密码</td>
<td>{{grant.password}}
<p class="comment">SSH登录用户密码。</p> </td>
</tr>
</tbody>
<!-- 私钥 -->
@@ -48,6 +48,13 @@
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
<tr>
<td>私钥密码<br/><em>Passphrase</em></td>
<td>
<span v-if="grant.passphrase.length > 0">{{grant.passphrase}}</span>
<span v-else class="disabled">-</span>
</td>
</tr>
</tbody>
<tr>

View File

@@ -50,10 +50,17 @@
<tr>
<td>RSA私钥 *</td>
<td>
<textarea name="privateKey" v-model="grant.privateKey"></textarea>
<textarea name="privateKey" v-model="grant.privateKey" spellcheck="false"></textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
<tr>
<td>私钥密码<br/><em>Passphrase</em></td>
<td>
<input type="password" name="passphrase" maxlength="200" v-model="grant.passphrase"/>
<p class="comment">为私钥设置了密码Passphrase后需要填写。</p>
</td>
</tr>
</tbody>
<tr>

View File

@@ -49,10 +49,17 @@
<tr>
<td>RSA私钥 *</td>
<td>
<textarea name="privateKey" v-model="grant.privateKey"></textarea>
<textarea name="privateKey" v-model="grant.privateKey" spellcheck="false"></textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
<tr>
<td>私钥密码<br/><em>Passphrase</em></td>
<td>
<input type="password" name="passphrase" maxlength="200" v-model="grant.passphrase"/>
<p class="comment">为私钥设置了密码Passphrase后需要填写。</p>
</td>
</tr>
</tbody>
<tr>