citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
459 stars 136 forks source link

ssh client hangs #682

Open mlybarger opened 5 years ago

mlybarger commented 5 years ago

our citrus suite is failing. it seems to be be hung on ssh client execution.

My test suite has:

<citrus-ssh:client id="sshClient" port="${test.ssh.port}"
    user="${test.ssh.username}" password="${test.ssh.password}" private-key-path="classpath:citrus_id_rsa"
    strict-host-checking="false" host="${test.hostname}" />

        <send endpoint="sshClient">
            <message>
                <payload>
                    <ssh-request xmlns="http://www.citrusframework.org/schema/ssh/message">
                        <command>ls -l</command>
                        <stdin></stdin>
                    </ssh-request>
                </payload>
            </message>
        </send>
        <receive endpoint="sshClient">
            <message>
                <payload>
                    <ssh-response xmlns="http://www.citrusframework.org/schema/ssh/message">
                        <stdout></stdout>
                        <stderr></stderr>
                        <exit></exit>
                    </ssh-response>
                </payload>
            </message>
        </receive>
        <echo>
            <message>After Ssh: ${now}</message>
        </echo>

My output is:

14:43:29,381 DEBUG port.LoggingReporter| TEST STEP 4/6: send 14:43:29,381 DEBUG ltCorrelationManager| Saving correlation key for 'citrus_message_correlator_sshClient' 14:43:29,381 DEBUG context.TestContext| Setting variable: citrus_message_correlator_sshClient with value: 'citrus_message_id = '0ae24bc4-f835-4f5e-a98c-11496e3f9985'' Build was aborted Aborted by mark

Any help is most appreciated.

mlybarger commented 5 years ago

Also note that when running on my windows machine, I get prompted for kerberos username/password:

16:53:09,831 DEBUG citrus.Citrus| TEST STEP 4/5: send 16:53:09,831 DEBUG ltCorrelationManager| Saving correlation key for 'citrus_message_correlator_sshClientT' 16:53:09,831 DEBUG context.TestContext| Setting variable: citrus_message_correlator_sshClientT with value: 'citrus_message_id = '99fdec70-ca0f-4165-9c28-b23bc949bdbd'' Kerberos username [markl]: Kerberos password for markl: 16:53:15,621 INFO citrus.Citrus|

I came across this info for jsch where it says to restrict the auth mechanisms.

https://stackoverflow.com/questions/10881981/sftp-connection-through-java-asking-for-weird-authentication

nagendra-m commented 5 years ago

Hi Mark,

I got below solution as temporary fix.

Jsch is using Kerberos authentication prompt which need to be stopped by using below system property during execution of citrus test cases.

   -Djava.security.auth.login.config=.\config

Above property has path to config file. config file content as below:-

com.sun.security.jgss.krb5.initiate {

doNotPrompt=true

};

This will use only the user name and password provided in ssh-client bean's properties.