0

几个小时以来,我一直在尝试使用 maven-ssh 部署一个 .jar 文件。没有成功。这是我的配置文件:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <id>upload-jar</id>
            <phase>deploy</phase>
            <goals>
                <goal>upload</goal>
            </goals>
            <configuration>
                <fromFile>target/${project.build.finalName}.jar</fromFile> 
                <url>scp://172.16.11.122/foobar</url>
                <toDir>.</toDir>
            </configuration>
        </execution>
    </executions>
</plugin>

<extensions>
    <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>2.10</version>
    </extension>
</extensions>

<distributionManagement>        
    <repository>
        <id>lei.intra</id>
        <url>scp://172.16.11.122/foo</url>
    </repository>
</distributionManagement>

并在 settings.xml

 <server>
    <id>lei.intra</id>
    <username>xxx</username>
    <password>yyy</password>
    <filePermissions>775</filePermissions>
    <directoryPermissions>775</directoryPermissions>
</server>

我想我正在混合一种旧的和一种新的方式。为什么我必须指定 url 两次(在插件配置和 distributionManagement 中?我还想在内部使用 jsch 而不是 Putty 的 pscp 从 Windows 部署。

当前的错误信息是

com.jcraft.jsch.JSchException: reject HostKey: 172.16.11.122

有人可以指导我看一个工作的和最近的例子吗?

我还尝试<privateKey>使用我的 putty .ppk 文件在 settings.xml 中指定。PPK 可能是错误的密钥格式。我可以转换它吗?

我在 sshd 上打开了调试,这是输出:

debug3: fd 5 is not O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug3: send_rexec_state: entering fd = 8 config len 736
debug3: ssh_msg_send: type 0
debug3: send_rexec_state: done
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 172.16.11.1 port 22952 on 172.16.11.122 port 22
debug1: Client protocol version 2.0; client software version JSCH-0.1.50
debug1: no match: JSCH-0.1.50
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug2: fd 3 setting O_NONBLOCK
debug2: Network child is on pid 16885
debug3: preauth child monitor started
debug3: privsep user:group 110:65534 [preauth]
debug1: permanently_set_uid: 110/65534 [preauth]
debug3: list_hostkey_types: ssh-dss key not permitted by HostkeyAlgorithms [preauth]
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug3: send packet: type 20 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug3: receive packet: type 20 [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug2: local server KEXINIT proposal [preauth]
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 [preauth]
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth]
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com [preauth]
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
debug2: compression ctos: none,zlib@openssh.com [preauth]
debug2: compression stoc: none,zlib@openssh.com [preauth]
debug2: languages ctos:  [preauth]
debug2: languages stoc:  [preauth]
debug2: first_kex_follows 0  [preauth]
debug2: reserved 0  [preauth]
debug2: peer client KEXINIT proposal [preauth]
debug2: KEX algorithms: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 [preauth]
debug2: host key algorithms: ssh-rsa,ssh-dss [preauth]
debug2: ciphers ctos: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc [preauth]
debug2: ciphers stoc: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc [preauth]
debug2: MACs ctos: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 [preauth]
debug2: MACs stoc: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 [preauth]
debug2: compression ctos: none [preauth]
debug2: compression stoc: none [preauth]
debug2: languages ctos:  [preauth]
debug2: languages stoc:  [preauth]
debug2: first_kex_follows 0  [preauth]
debug2: reserved 0  [preauth]
debug1: kex: algorithm: diffie-hellman-group14-sha1 [preauth]
debug1: kex: host key algorithm: ssh-rsa [preauth]
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none [preauth]
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none [preauth]
debug2: bits set: 1036/2048 [preauth]
debug1: expecting SSH2_MSG_KEXDH_INIT [preauth]
debug3: receive packet: type 30 [preauth]
debug2: bits set: 1020/2048 [preauth]
debug3: mm_key_sign entering [preauth]
debug3: mm_request_send entering: type 6 [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 6
debug3: mm_answer_sign
debug3: mm_answer_sign: hostkey proof signature 0x56370529ae80(271)
debug3: mm_request_send entering: type 7
debug2: monitor_read: 6 used once, disabling now
debug3: mm_key_sign: waiting for MONITOR_ANS_SIGN [preauth]
debug3: mm_request_receive_expect entering: type 7 [preauth]
debug3: mm_request_receive entering [preauth]
debug3: send packet: type 31 [preauth]
debug3: send packet: type 21 [preauth]
debug2: set_newkeys: mode 1 [preauth]
debug1: rekey after 4294967296 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug3: receive packet: type 1 [preauth]
Received disconnect from 172.16.11.1 port 22952:3: com.jcraft.jsch.JSchException: reject HostKey: lei.intra [preauth]
Disconnected from 172.16.11.1 port 22952 [preauth]
debug1: do_cleanup [preauth]
debug3: PAM: sshpam_thread_cleanup entering [preauth]
debug1: monitor_read_log: child log fd closed
debug3: mm_request_receive entering
debug1: do_cleanup
debug3: PAM: sshpam_thread_cleanup entering
debug1: Killing privsep child 16885
debug1: audit_event: unhandled event 12
4

1 回答 1

0

插件 wagon-maven-plugin 根本不需要。删除它。

我取得了一些进展:

ssh-keyscan -t rsa server_ip_address_or_hostname

并将输出添加到 ~/.ssh/known_hosts

当它尝试从根文件夹开始创建目录时,我得到的下一个错误是“权限被拒绝”。作为一种解决方法,我创建了一个具有写访问权限的文件夹 /repository 并设置<url>scp://172.16.11.122/repository</url>

于 2016-10-25T10:22:37.630 回答