0

For several hours I am trying to deploy a .jar file with maven-ssh. Without success. Here are my config files:

<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>

and in settings.xml

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

I think I am mixing an old and a new way. Why would I have to specify the url twice (in the plugin config and in distributionManagement? Also I want to deploy from Windows using jsch internally and not Putty's pscp.

The current error message is

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

Could somebody please direct me to a working and recent example?

I also tried specifying <privateKey> in settings.xml with my putty .ppk file. PPK probably is the wrong key format. Can I convert it?

I switched on debugging on sshd and this is the output:

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
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
ropo
  • 1,466
  • 2
  • 18
  • 29
  • Did you go through this link http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html? You don't need to configured `wagon-maven-plugin`, just use the `wagon-ssh-external` extension. – Tunaki Oct 24 '16 at 14:41
  • Yes, I know this page. This is an example for wagon-ssh-external. I would like to run it without external programs. wagon-ssh, not wagon-ssh-external – ropo Oct 24 '16 at 15:59
  • I tried to follow this approach: http://stackoverflow.com/questions/5819775/is-there-any-way-of-having-maven-scp-wagon-work-consistently-on-linux-mac-window but I get there errors: When I try this with wagon-ssh 2.3-2.5, I get this exception: com.jcraft.jsch.JSchException: Algorithm negotiation fail With version 2.6-2.10 I get this: com.jcraft.jsch.JSchException: reject HostKey: hostname – ropo Oct 25 '16 at 06:43

1 Answers1

1

The plugin wagon-maven-plugin is not needed at all. Removed it.

I made some progress:

ssh-keyscan -t rsa server_ip_address_or_hostname

and add the output to ~/.ssh/known_hosts

The next error I got was "permission denied" when it tried to create directories starting from the root folder. As a workaround I created a folder /repository with write access and set <url>scp://172.16.11.122/repository</url>

ropo
  • 1,466
  • 2
  • 18
  • 29