Closed asarkisian closed 2 years ago
@asarkisian Can you please try latest release... we are doing error handling in string instead of buffer... https://www.npmjs.com/package/ssh2-promise/v/1.0.3
Hi Sanket,
Thank you. Also, is there any way we can run an exec() command without returning a promise? In other words, having an async as well as a sync version of this so that sometimes we don't want to wait until the command finishes.
Thanks!
On Sat, Jun 18, 2022 at 6:30 PM Sanket Bajoria @.***> wrote:
@asarkisian https://github.com/asarkisian Can you please try latest release... we are doing error handling in string instead of buffer... https://www.npmjs.com/package/ssh2-promise/v/1.0.3
— Reply to this email directly, view it on GitHub https://github.com/sanketbajoria/ssh2-promise/issues/80#issuecomment-1159594858, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETCUNEGUFTBFR42IQSLB3DVPZZ37ANCNFSM5Y5PZH5A . You are receiving this because you were mentioned.Message ID: @.***>
@asarkisian promises are by default async... so if you don't want to handle any error and also don't want to wait... then you can use.. in below manner
ssh.exec('dummy req'). catch((e) => {//don't do anything})
or you can capture 'unhandledRejection' at process level
process.on('unhandledRejection', callback)
Currently ssh2-promise doesn't support silent execution of command.
That worked! Final question to you, when I try to connect to a Solaris 10 machine, everything works perfectly.. I can login with no issues. When I connect to Solaris 11 however, it throws an authentication error. I know that Solaris 11 has beefier security when it comes to ciphers/kex. When attempting to login into Sol11, I get the error "Error: All configured authentication methods failed".
Have you seen this before? How can I add additional switches so that I can perhaps alter the ciphers or kex? Or also, how can I add verbose mode so that I can see what settings/security settings I currently have right now. Kindly advise.
Thank you
ERROR:
Error: All configured authentication methods failed
at doNextAuth
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/client.js:803:21)
at tryNextAuth
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/client.js:993:7)
at USERAUTH_FAILURE
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/client.js:373:11)
at 51
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/protocol/handlers.misc.js:337:16)
at Protocol.onPayload
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/protocol/Protocol.js:2025:10)
at AESGCMDecipherBinding.decrypt
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/protocol/crypto.js:1086:26)
at Protocol.parsePacket [as _parse]
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/protocol/Protocol.js:1994:25)
at Protocol.parse
(/Users/armonds/Development/JPL/qa-automation-wdio-js/node_modules/ssh2/lib/protocol/Protocol.js:293:16)
at Channel.
On Mon, Jun 20, 2022 at 6:37 PM Sanket Bajoria @.***> wrote:
@asarkisian https://github.com/asarkisian promises are by default async... so if you don't want to handle any error and also don't want to wait... then you can use.. in below manner
ssh.exec('dummy req'). catch((e) => {//don't do anything})
— Reply to this email directly, view it on GitHub https://github.com/sanketbajoria/ssh2-promise/issues/80#issuecomment-1161062002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETCUNHGVF5B3WXPB7IBJQ3VQEMGDANCNFSM5Y5PZH5A . You are receiving this because you were mentioned.Message ID: @.***>
@asarkisian we do hve option to send cipher in configuration. Please check the algorithms section in readme
@asarkisian feel free to close this issue.. if it is resolved
Thank you!
On Fri, Jul 1, 2022 at 8:49 PM Sanket Bajoria @.***> wrote:
@asarkisian https://github.com/asarkisian feel free to close this issue.. if it is resolved
— Reply to this email directly, view it on GitHub https://github.com/sanketbajoria/ssh2-promise/issues/80#issuecomment-1172827004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETCUNC7CADWMU77G2CT7C3VR633LANCNFSM5Y5PZH5A . You are receiving this because you were mentioned.Message ID: @.***>
Hi Sanket,
To add ciphers, kex and hmac's, does this look correct? When I add these and try to connect to a SOL11 machine, I get an error: "Error: All configured authentication methods failed"
There might be something I am missing where you can point out. Thanks for all your help!
const sshConfig = { host: host, port: port, username: username, password: password, algorithm: { kex: ['diffie-hellman-group1-sha1' , 'diffie-hellman-group14-sha1' , 'diffie-hellman-group14-sha256' , 'diffie-hellman-group16-sha512' , 'diffie-hellman-group18-sha512' , 'diffie-hellman-group-exchange-sha1' , 'diffie-hellman-group-exchange-sha256' , 'ecdh-sha2-nistp256' , 'ecdh-sha2-nistp384' , 'ecdh-sha2-nistp521' , 'curve25519-sha256' , ' @.', @.'], cipher: ['3des-cbc' ,'aes128-cbc' ,'aes192-cbc' ,'aes256-cbc' ,' @.' ,'aes128-ctr' ,'aes192-ctr' ,'aes256-ctr' ,' @.' @.',' @.'], serverHostKey: [], hmac: ['hmac-sha1' , 'hmac-sha1-96' , 'hmac-sha2-256' , 'hmac-sha2-512' , ' @.' , @.' , @.' , @.' , @.' , ' @.' , @.' , ' @.'], compress: [], } };
// establish ssh connection
SSHPromise.conn = new SSH2Promise(sshConfig);
// enable x11 forwarding
try{ await SSHPromise.conn.x11('xeyes'); } catch(err){ }
await SSHPromise.conn.connect().then(() => {
console.log(Connected
);
}).catch((e) => {
console.log(Failed ${e}
);
throw e;
})
On Mon, Jun 20, 2022 at 6:37 PM Sanket Bajoria @.***> wrote:
@asarkisian https://github.com/asarkisian promises are by default async... so if you don't want to handle any error and also don't want to wait... then you can use.. in below manner
ssh.exec('dummy req'). catch((e) => {//don't do anything})
— Reply to this email directly, view it on GitHub https://github.com/sanketbajoria/ssh2-promise/issues/80#issuecomment-1161062002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETCUNHGVF5B3WXPB7IBJQ3VQEMGDANCNFSM5Y5PZH5A . You are receiving this because you were mentioned.Message ID: @.***>
I am running mocha/webdriverio and running some tests on a remote ssh server. I can connect successfully and execute commands successfully; however, if I try to execute a command that returns a failure such as "rm data.dat" (assuming it doesn't exist), it will literally fail the test case and throw the following error:
Error: the buffer [ 97 98 115 100 102 115 58 32 67 111 109 109 97 110 100 32 110 111 116 32 102 111 117 110 100 46 10 ] was thrown, throw an Error :)
This is not ideal.. Is there a way error handling can be turned off? All I want it to do is simply output the error without having it throw an exception internally and thus fail my test case.. Yes, I can put this in a try/catch block and ignore the error however it won't continue printing the rest of the output.. it will stop at the error. So in essence, the try/catch block still doesn't allow me to reach my goals of printing the full output.