Skip to content

Commit

Permalink
Edit description of the SSH "Private Key" field, and stop verify key …
Browse files Browse the repository at this point in the history
…content when the private key is not a RSA key.
  • Loading branch information
NI committed Aug 31, 2019
1 parent d16423e commit 9aa2c4b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions ui/commands/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,17 @@ const initialFieldDef = {
"Private Key": {
name: "Private Key",
description:
"Like the one inside ~/.ssh/id_rsa, can&apos;t be encrypted<br /><br />" +
"To decrypt the Private Key, use command: <i>" +
"openssl rsa -in /path/to/encrypted_private_key -out " +
"/path/to/decrypted_private_key</i>",
'Like the one inside <i style="color: #fff; font-style: normal;">' +
"~/.ssh/id_rsa</i>, can&apos;t be encrypted<br /><br />" +
'To decrypt the Private Key, use command: <i style="color: #fff;' +
' font-style: normal;">ssh-keygen -f /path/to/private_key -p</i><br />' +
"<br />" +
"It is strongly recommanded to use one Private Key per SSH server if " +
"the Private Key will be submitted to Sshwifty. To generate a new SSH " +
'key pair, use command <i style="color: #fff; font-style: normal;">' +
"ssh-keygen -o -f /path/to/my_server_key</i> and then deploy the " +
'generated <i style="color: #fff; font-style: normal;">' +
"/path/to/my_server_key.pub</i> file onto the target SSH server",
type: "textfile",
value: "",
example: "",
Expand All @@ -342,10 +349,17 @@ const initialFieldDef = {
);
}

let lines = d.split("\n");
const lines = d.trim().split("\n");
let firstLineReaded = false;

for (let i in lines) {
if (lines[i].indexOf("-") === 0) {
if (!firstLineReaded && lines[i].indexOf("-") === 0) {
firstLineReaded = true;

if (lines[i].indexOf("RSA") < 0) {
break;
}

continue;
}

Expand Down

0 comments on commit 9aa2c4b

Please sign in to comment.