diff --git a/Tasks/SshV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/SshV0/Strings/resources.resjson/en-US/resources.resjson index 6931b80d55d0..0f29d8f43cca 100644 --- a/Tasks/SshV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/SshV0/Strings/resources.resjson/en-US/resources.resjson @@ -24,6 +24,8 @@ "loc.input.help.interactiveSession": "If this option is selected, interactive session will be started - if there's a password request, it will be filled by user's password. It could be useful to run commands like 'sudo'", "loc.input.label.readyTimeout": "SSH handshake timeout", "loc.input.help.readyTimeout": "How long (in milliseconds) to wait for the SSH handshake to complete.", + "loc.input.label.interactiveKeyboardAuthentication": "Use interactive-keyboard authentication", + "loc.input.help.interactiveKeyboardAuthentication": "Use this value if PasswordAuthentication is disabled on the target machine", "loc.messages.ConnectionFailed": "Failed to connect to remote machine. Verify the SSH service connection details. Error: %s.", "loc.messages.FailedToWriteScript": "Failed to write the script to disk: %s", "loc.messages.RemoteCmdExecutionErr": "Command failed with errors on remote machine.", diff --git a/Tasks/SshV0/ssh.ts b/Tasks/SshV0/ssh.ts index 40f7b072cd6f..ff81b90f569f 100644 --- a/Tasks/SshV0/ssh.ts +++ b/Tasks/SshV0/ssh.ts @@ -23,6 +23,7 @@ async function run() { //read SSH endpoint input const sshEndpoint = tl.getInput('sshEndpoint', true); + const tryKeyboard: boolean = tl.getBoolInput('interactiveKeyboardAuthentication', false); const username: string = tl.getEndpointAuthorizationParameter(sshEndpoint, 'username', false); const password: string = tl.getEndpointAuthorizationParameter(sshEndpoint, 'password', true); //passphrase is optional const privateKey: string = process.env['ENDPOINT_DATA_' + sshEndpoint + '_PRIVATEKEY']; //private key is optional, password can be used for connecting @@ -36,7 +37,8 @@ async function run() { host: hostname, port: port, username: username, - readyTimeout: readyTimeout + readyTimeout: readyTimeout, + tryKeyboard: tryKeyboard, }; if (privateKey) { diff --git a/Tasks/SshV0/ssh2helpers.ts b/Tasks/SshV0/ssh2helpers.ts index 7fda0a825e4d..c90f41e8aa3d 100644 --- a/Tasks/SshV0/ssh2helpers.ts +++ b/Tasks/SshV0/ssh2helpers.ts @@ -106,7 +106,8 @@ export function setupSshClientConnection(sshConfig: any): Q.Promise { defer.resolve(client); }).on('error', (err) => { defer.reject(err); - }).connect(sshConfig); + }).on('keyboard-interactive', (name, instructions, instructionsLang, prompts, finish) => { finish([sshConfig.password]); }) + .connect(sshConfig); return defer.promise; } diff --git a/Tasks/SshV0/task.json b/Tasks/SshV0/task.json index b3f43368e13d..f4400666fb92 100644 --- a/Tasks/SshV0/task.json +++ b/Tasks/SshV0/task.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 200, + "Minor": 207, "Patch": 0 }, "demands": [], @@ -135,6 +135,15 @@ "expression": "isMatch(value, '(^\\d*$)','Multiline')", "message": "Enter a valid value for timeout." } + }, + { + "name": "interactiveKeyboardAuthentication", + "type": "boolean", + "label": "Use interactive-keyboard authentication", + "defaultValue": false, + "required": false, + "groupName": "advanced", + "helpMarkDown": "Use this value if PasswordAuthentication is disabled on the target machine" } ], "execution": { diff --git a/Tasks/SshV0/task.loc.json b/Tasks/SshV0/task.loc.json index 402a61e65fb3..187ed3a72e04 100644 --- a/Tasks/SshV0/task.loc.json +++ b/Tasks/SshV0/task.loc.json @@ -17,7 +17,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 200, + "Minor": 207, "Patch": 0 }, "demands": [], @@ -135,6 +135,15 @@ "expression": "isMatch(value, '(^\\d*$)','Multiline')", "message": "Enter a valid value for timeout." } + }, + { + "name": "interactiveKeyboardAuthentication", + "type": "boolean", + "label": "ms-resource:loc.input.label.interactiveKeyboardAuthentication", + "defaultValue": false, + "required": false, + "groupName": "advanced", + "helpMarkDown": "ms-resource:loc.input.help.interactiveKeyboardAuthentication" } ], "execution": {