我有使用JSCH通过sftp传输文件的代码。这段代码可以在我们的一个测试环境中工作,但不能在另一个环境中工作。它不工作的环境启用了FIPS模式,但我不确定这是否导致了问题。在这两种环境中,我都可以使用代码使用的私钥从命令行进行sftp。
JSch和ssh有一些相关的输出,但我不确定在这一点上还能做些什么。SSH密钥和已知主机文件似乎都已正确设置。
MESSAGE="path to private key: '~/.ssh/id_rsa_xxx'"
MESSAGE="Connecting to 111.11.11.11 port 22"
MESSAGE="Connection established"
MESSAGE="Remote version string: SSH-2.0-OpenSSH_5.3"
MESSAGE="Local version string: SSH-2.0-JSCH-0.1.54"
MESSAGE="CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256"
MESSAGE="CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521"
MESSAGE="CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521"
MESSAGE="SSH_MSG_KEXINIT sent"
MESSAGE="SSH_MSG_KEXINIT received"
MESSAGE="kex: server: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1"
MESSAGE="kex: server: ssh-rsa,ssh-dss"
MESSAGE="kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se"
MESSAGE="kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se"
MESSAGE="kex: server: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96"
MESSAGE="kex: server: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96"
MESSAGE="kex: server: none,zlib@openssh.com"
MESSAGE="kex: server: none,zlib@openssh.com"
MESSAGE="kex: server: "
MESSAGE="kex: server: "
MESSAGE="kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1"
MESSAGE="kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521"
MESSAGE="kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"
MESSAGE="kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"
MESSAGE="kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96"
MESSAGE="kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96"
MESSAGE="kex: client: none"
MESSAGE="kex: client: none"
MESSAGE="kex: client: "
MESSAGE="kex: client: "
MESSAGE="kex: server->client aes128-ctr hmac-md5 none"
MESSAGE="kex: client->server aes128-ctr hmac-md5 none"
MESSAGE="SSH_MSG_KEXDH_INIT sent"
MESSAGE="expecting SSH_MSG_KEXDH_REPLY"
MESSAGE="ssh_rsa_verify: signature true"
MESSAGE="Disconnecting from 111.11.11.11 port 22"
Exception: JSchException
Message: UnknownHostKey: 111.11.11.11. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
In Class: com.jcraft.jsch.Session
In Method: checkHost() : Session.java : 805
com.jcraft.jsch.JSchException: UnknownHostKey: 111.11.11.11. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
at com.jcraft.jsch.Session.checkHost(Session.java:805)
at com.jcraft.jsch.Session.connect(Session.java:345)
at com.jcraft.jsch.Session.connect(Session.java:183)
...
at java.lang.Thread.run(Thread.java:748)
$ ssh -vv -i ~/.ssh/id_rsa_transfer transfer@mail
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /xxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
FIPS mode initialized
debug2: ssh_connect: needpriv 0
debug1: Connecting to mail [111.11.11.11] port 22.
debug1: Connection established.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /xxx/.ssh/id_rsa_xxx type -1
debug1: identity file /xxx/.ssh/id_rsa_xxx-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: kex_parse_kexinit: hmac-sha1,hmac-sha2-256,hmac-sha2-512
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-sha1
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug2: mac_setup: found hmac-sha1
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 157/320
debug2: bits set: 1061/2048
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'mail' is known and matches the RSA host key.
debug1: Found key in /xxx/.ssh/known_hosts:4
debug2: bits set: 1013/2048
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /xxx/.ssh/id_rsa_xxx ((nil))
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /xxx/.ssh/id_rsa_xxx
debug1: read PEM private key done: type RSA
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Thu Apr 9 13:46:27 2020 from 111.11.11.11
结果我们的DevOps团队意外地覆盖了我们正在使用的已知主机属性的位置。JSch不会检查我为已知主机文件提供的路径(我假设私钥)是否有效。我留下这个问题,以防别人有这个问题。
好的,我得到UnknownHostKey异常。我不想像这篇文章com.jcraft.jsch.jschException:unknownHostKey那样使用strithostKeyChecking=no来解决问题。我希望JSCH使用系统ssh使用的已知主机文件。有可能吗?
我必须将LDAP与两个不同的服务集成:exoPlatform和Liferay。因此,我使用以下配置通过Docker映像设置LDAP服务器: 服务器名称:openldap 基本提供程序URL:ldap://openldap:389 基本dn:cn=用户,ou=平台,o=极致,dc=示例,dc=org 我的管理帐户只是:cn=admin null 我也支持一个公司代理,但我不记得为ExoPlatfor
我在一个Java RMI分布式系统上工作,我有两个虚拟机在我的本地机器上运行ubuntu(ubuntu-(主)IP=192.168.101.131和ubuntu-(从)IP=92.168.01.137)。我可以运行我的银行服务器吗。两个虚拟机上的jar(在tomcat中)。ubuntu-(主)数据库自动复制到ubuntu-(从)上。到现在为止,一直都还不错。服务器提到(葡萄牙语)在默认端口1099
问题内容: 我正在尝试通过android应用程序中的HTTP Post请求访问textalertapp.com。但是我收到了未知主机错误。谁能帮我解决这个问题。 代码是 问题答案: 我只是在清单文件中添加了这一行。问题解决了
----开始RSA私钥----- 私钥在这里 ----结束RSA私钥----- 如何使用privateKeyPEM字节对象?我想将它与jsch.addIdEntity()一起使用 但我真的不明白如何使用这个byte[]privateKeyPEM变量来设置标识? 这里是我的JSch部分的一个示例:
我在JMeter上运行测试脚本时遇到过这种错误? java.net.unknownHostException:h2ebiz-testat java.net.inet6addressimpl.lookupAllHostAddr(本机方法)位于java.net.inetAddress.2.lookupAllHostAddr(未知源)位于java.net.inetAddress.getAddress.g