add option to use ssh agent for authentication
This commit is contained in:
parent
bcbbda1eea
commit
16370ea112
3 changed files with 19 additions and 1 deletions
15
package.json
15
package.json
|
|
@ -162,6 +162,11 @@
|
|||
"type": "string",
|
||||
"description": "Absolute path to private key"
|
||||
},
|
||||
"useAgent": {
|
||||
"type": "boolean",
|
||||
"description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication",
|
||||
"default": false
|
||||
},
|
||||
"forwardX11": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the server will redirect x11 to the local host",
|
||||
|
|
@ -287,6 +292,11 @@
|
|||
"type": "string",
|
||||
"description": "Absolute path to private key"
|
||||
},
|
||||
"useAgent": {
|
||||
"type": "boolean",
|
||||
"description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication",
|
||||
"default": false
|
||||
},
|
||||
"forwardX11": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the server will redirect x11 to the local host",
|
||||
|
|
@ -547,6 +557,11 @@
|
|||
"type": "string",
|
||||
"description": "Absolute path to private key"
|
||||
},
|
||||
"useAgent": {
|
||||
"type": "boolean",
|
||||
"description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication",
|
||||
"default": false
|
||||
},
|
||||
"forwardX11": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the server will redirect x11 to the local host",
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export interface SSHArguments {
|
|||
host: string;
|
||||
keyfile: string;
|
||||
password: string;
|
||||
useAgent: boolean;
|
||||
cwd: string;
|
||||
port: number;
|
||||
user: string;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,9 @@ export class MI2 extends EventEmitter implements IBackend {
|
|||
username: args.user
|
||||
};
|
||||
|
||||
if (args.keyfile) {
|
||||
if (args.useAgent) {
|
||||
connectionArgs.agent = process.env.SSH_AUTH_SOCK;
|
||||
} else if (args.keyfile) {
|
||||
if (require("fs").existsSync(args.keyfile))
|
||||
connectionArgs.privateKey = require("fs").readFileSync(args.keyfile);
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue