Allow Fingerprint to be defined in SSH Preset. Once defined, Sshwifty will use the fingerprint value to verify the public key fingerprint of the connecting SSH host
This commit is contained in:
@@ -253,6 +253,12 @@ Here is all the options of a configuration file:
|
||||
// Data for predefined Authentication field. Valid values is what
|
||||
// displayed on the page (Password, Private Key, None)
|
||||
"Authentication": "Password",
|
||||
|
||||
// Data for server public key fingerprint. You can acquire the value of
|
||||
// the fingerprint by manually connect to a new SSH host with Sshwifty,
|
||||
// the fingerprint will be displayed on the Fingerprint comformation
|
||||
// page.
|
||||
"Fingerprint": "SHA256:bgO...."
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
"User": "root",
|
||||
"Encoding": "utf-8",
|
||||
"Private Key": "-----BEGIN RSA PRIV...\nMIIE...\n-----END RSA PRI...\n",
|
||||
"Authentication": "Private Key"
|
||||
"Authentication": "Private Key",
|
||||
"Fingerprint": "SHA256:bgO...."
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ const presetItem = {
|
||||
title: "",
|
||||
type: "",
|
||||
host: "",
|
||||
meta: {}
|
||||
meta: {},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -153,6 +153,25 @@ export class Preset {
|
||||
return this.preset.meta[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the given meta of current preset, and if failed, return the given
|
||||
* default value
|
||||
*
|
||||
* @param {string} name name of the meta data
|
||||
* @param {string} defaultValue default value to be returned when the meta was
|
||||
* not found
|
||||
*
|
||||
* @returns {string}
|
||||
*
|
||||
*/
|
||||
metaDefault(name, defaultValue) {
|
||||
try {
|
||||
return this.meta(name);
|
||||
} catch (e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert new meta item
|
||||
*
|
||||
@@ -182,7 +201,7 @@ export function emptyPreset() {
|
||||
title: "Default",
|
||||
type: "Default",
|
||||
host: "",
|
||||
meta: {}
|
||||
meta: {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,9 @@ class Wizard {
|
||||
authentication: r.authentication,
|
||||
host: r.host,
|
||||
charset: r.encoding,
|
||||
fingerprint: "",
|
||||
fingerprint: self.preset
|
||||
? self.preset.metaDefault("Fingerprint", "")
|
||||
: "",
|
||||
},
|
||||
self.session
|
||||
);
|
||||
@@ -855,7 +857,7 @@ class Wizard {
|
||||
|
||||
default:
|
||||
throw new Exception(
|
||||
"Prompt is not support by auth method: " + config.auth
|
||||
'Auth method "' + config.auth + '" was unsupported'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user