Verbose Troubleshooting %Net.SSH.Session
I was trying to see if we could connect to another Server, we use to execute external scripts using %Net.SSH.Session.
TESTCLIN>set sshSession = ##class(%Net.SSH.Session).%New()
TESTCLIN>set user = <omitted>
TESTCLIN>set host = <omitted>
TESTCLIN>set privateKey = "/nfs/data/ssh/<omitted>"
TESTCLIN>set publicKey = "/nfs/data/ssh/<omitted>.pub"
TESTCLIN>Set statusConnection = sshSession.Connect(host)
TESTCLIN>set statusAuth = sshSession.AuthenticateWithKeyPair(user,publicKey, privateKey,)
TESTCLIN>zwrite statusAuth
statusAuth="0 "_$lb($lb(7510,-19,"SSH Error [80101013]: Callback returned error [80101013] at Session.cpp:494,0",,,,,,,$lb(,"TESTCLIN",$lb("e^ssherror+4^%Net.SSH.Session.1^1","e^AuthenticateWithKeyPair+2^%Net.SSH.Session.1^1","e^^^0"))))/* ERROR #7510: SSH Error '-19': SSH Error [80101013]: Callback returned error [80101013] at Session.cpp:494,0 */How can I see what the SSH error was in the callback?
Comments
To troubleshoot and view detailed information about SSH errors in callbacks with %Net.SSH.Session, you can enable detailed debugging using the SetTraceMethod. This method allows you to collect trace information about your SSH connection and save it to a log file for analysis.
Here is an example of how to enable SSH debugging:
Set SSH = ##class(%Net.SSH.Session).%New()
Do SSH.SetTraceMask(511, "/tmp/ssh.log")
Set Status = SSH.Connect("<hostname>")
- In the example above,
511is the trace mask setting which collects comprehensive debugging information. If you need details about each bit of this setting, check the%Net.SSH.Sessionclass documentation. - The second argument specifies the path where the log file will be saved (e.g.,
/tmp/ssh.log).
If the problem is in authentication or other operations, execute those methods after setting up the trace. Once done, review the log file (/tmp/ssh.log in this case) to diagnose the issue.
This approach provides insights into errors reported in callbacks, such as invalid signatures or problems with public/private keys. If further assistance is required to interpret the log, the WRC (Worldwide Response Center) can offer support [1].
Sources:
I suggest to read the following post: