Skip to content

Instantly share code, notes, and snippets.

@Tolsi
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tolsi/980cc71fdbf53d4657dd to your computer and use it in GitHub Desktop.
Save Tolsi/980cc71fdbf53d4657dd to your computer and use it in GitHub Desktop.
scala-ssh connection fail
name := "ammonite-test"
version := "1.0"
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"org.bouncycastle" % "bcprov-jdk16" % "1.46",
"com.jcraft" % "jzlib" % "1.1.3",
"com.decodified" %% "scala-ssh" % "0.7.0",
"ch.qos.logback" % "logback-classic" % "1.1.2",
"jline" % "jline" % "2.12.1"
)
17:25:25.893 [run-main-0] DEBUG n.schmizz.sshj.common.SecurityUtils - Trying to register BouncyCastle as a JCE provider
17:25:26.247 [run-main-0] INFO n.schmizz.sshj.common.SecurityUtils - BouncyCastle registration succeeded
17:25:26.319 [run-main-0] WARN net.schmizz.sshj.DefaultConfig - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
17:25:26.349 [run-main-0] INFO com.decodified.scalassh.SshClient - Connecting to host:22 ...
17:25:26.433 [run-main-0] INFO n.s.sshj.transport.TransportImpl - Client identity string: SSH-2.0-SSHJ_0_9_2
17:25:26.609 [run-main-0] INFO n.s.sshj.transport.TransportImpl - Server identity string: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.3ppa2
17:25:26.609 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Setting <<kex done>> to `null`
17:25:26.609 [run-main-0] DEBUG n.s.sshj.transport.KeyExchanger - Sending SSH_MSG_KEXINIT
17:25:26.614 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Setting <<kexinit sent>> to `SOME`
17:25:26.614 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Awaiting <<kex done>>
17:25:26.676 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Received SSH_MSG_KEXINIT
17:25:26.679 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Negotiated algorithms: [ kex=diffie-hellman-group14-sha1; sig=ecdsa-sha2-nistp256; c2sCipher=aes128-ctr; s2cCipher=aes128-ctr; c2sMAC=hmac-sha1; s2cMAC=hmac-sha1; c2sComp=none; s2cComp=none ]
17:25:26.724 [reader] DEBUG net.schmizz.sshj.transport.kex.DHG14 - Sending SSH_MSG_KEXDH_INIT
17:25:26.781 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Received kex followup data
17:25:26.781 [reader] DEBUG net.schmizz.sshj.transport.kex.DHG14 - Received SSH_MSG_KEXDH_REPLY
17:25:26.783 [reader] DEBUG net.schmizz.sshj.common.KeyType$3 - Key algo: ecdsa-sha2-nistp256, Key curve: nistp256, Key Len: 65, 0x04: 4
x: [20, -113, 27, -54, 47, -43, -49, 96, 1, 30, 0, -110, 12, -201, -103, -36, -46, 122, -117, -106, 107, -69, -59, 42, 5, 122, -91, 65, -11, 56, -85, 64]
y: [71, -107, 21, -112, -67, 87, -39, 21, -104, 12, 51, -15, 64, 113, 15, 16, -114, -43, 66, -72, -19, -82, -114, -5, -47, -9, 3, -93, -10, 82, -106, -14]
17:25:26.999 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Trying to verify host key with com.decodified.scalassh.HostKeyVerifiers$$anon$5@6f48fa29
17:25:27.000 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Sending SSH_MSG_NEWKEYS
17:25:27.000 [reader] DEBUG n.s.sshj.transport.KeyExchanger - Received SSH_MSG_NEWKEYS
17:25:27.005 [reader] DEBUG net.schmizz.concurrent.Promise - Setting <<kexinit sent>> to `null`
17:25:27.005 [reader] DEBUG net.schmizz.concurrent.Promise - Setting <<kex done>> to `SOME`
17:25:27.005 [run-main-0] DEBUG net.schmizz.sshj.SSHClient - Key exchange took 0.396 seconds
17:25:27.006 [run-main-0] INFO com.decodified.scalassh.SshClient - Authenticating to host:22 using user ...
17:25:27.023 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Setting <<service accept>> to `null`
17:25:27.023 [run-main-0] DEBUG n.s.sshj.transport.TransportImpl - Sending SSH_MSG_SERVICE_REQUEST for ssh-userauth
17:25:27.024 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Awaiting <<service accept>>
17:25:27.160 [reader] DEBUG net.schmizz.concurrent.Promise - Setting <<service accept>> to `SOME`
17:25:27.160 [run-main-0] DEBUG n.s.sshj.transport.TransportImpl - Setting active service to ssh-userauth
17:25:27.161 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Setting <<authenticated>> to `null`
17:25:27.161 [run-main-0] DEBUG n.schmizz.sshj.userauth.UserAuthImpl - Trying `publickey` auth...
17:25:27.161 [run-main-0] DEBUG n.s.s.userauth.method.AuthPublickey - Attempting authentication using PKCS8KeyFile{resource=[PrivateKeyStringResource]}
17:25:27.170 [run-main-0] INFO com.decodified.scalassh.SshClient - Closing connection to host:22 ...
17:25:27.170 [run-main-0] INFO n.s.sshj.transport.TransportImpl - Disconnected - BY_APPLICATION
17:25:27.171 [run-main-0] DEBUG n.schmizz.sshj.userauth.UserAuthImpl - Notified of net.schmizz.sshj.transport.TransportException: [BY_APPLICATION] Disconnected
17:25:27.171 [run-main-0] DEBUG n.s.sshj.transport.TransportImpl - Sending SSH_MSG_DISCONNECT: reason=[BY_APPLICATION], msg=[]
17:25:27.171 [run-main-0] DEBUG net.schmizz.concurrent.Promise - Setting <<transport close>> to `SOME`
17:25:27.172 [reader] DEBUG net.schmizz.sshj.transport.Reader - Stopping
Left(Could not authenticate (with keyfile) to host:22 due to java.lang.SecurityException: class "org.bouncycastle.openssl.PEMParser"'s signer information does not match signer information of other classes in the same package)
login-type = keyfile
username = user
fingerprint = any
keyfile = ~/.ssh/id_rsa
package test
import com.decodified.scalassh._
object TestSSH {
def main(args: Array[String]) {
val res = SSH("host") { client =>
client.exec("ls -a").right.map { result =>
println("Result:\n" + result.stdOutAsString())
}
}
println(res)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment