Hello all,
I am trying to provision Karaf using Ansible (on localhost). All is good
until I first try to use the bin/client script to interact with the
local Karaf server. For some reason all interactions, no matter what I
try, end with the error "Closed". However, I can run the client script
successfully on the command line. I ran the client with full trace logs
(-v -l 4) with Ansible and on the command line and diffed the output.
Apart from session IDs, timestamps, and encrypted content on the wire
the logs look identical as far as I can see until we reach this line:
[main] DEBUG org.apache.sshd.client.session.ClientSessionImpl -
createExecChannel([ClientSessionImpl[karaf@localhost/127.0.0.1:8101],
ls, 0, null])[null] created id={} - PTY={}
After which the client continues to process the ls​ command if called on
the command line and immediately closes the connection when called via
Ansible:
525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
close(ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Closing
immediately
525 [Thread-2] DEBUG org.apache.sshd.client.channel.ChannelExec -
close(ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) prevent
sending EOF
525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
open(ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101]) Send
SSH_MSG_CHANNEL_OPEN - type=session
525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
Window[client/local](ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
525 [main] DEBUG org.apache.sshd.client.channel.ChannelExec -
writePacket(ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
Discarding output packet because channel state=Immediate
525 [Thread-2] DEBUG org.apache.sshd.common.channel.Window - Closing
Window[client/remote](ChannelExec[id=0,
recipient=-1]-ClientSessionImpl[karaf@localhost/127.0.0.1:8101])
[..]
All output is on level DEBUG or TRACE. No error is reported.
The Ansible task is as simple as they come:
- name: Use Karaf Client
shell: "./client -v -l 4 ls"
args:
chdir: "{{ karaf_install_symlink }}/bin"
The karaf server log shows the connection, and a while later logs an
authentication timeout, presumably because the client left the
conversation dangling.
2022-01-04T20:53:13,178 | INFO |
sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
| 43 - org.apache.sshd.osgi - 2.5.1 | Session
karaf@/127.0.0.1:33910 authenticated
2022-01-04T20:55:12,564 | INFO |
sshd-SshServer[315a8514](port=8101)-timer-thread-1 | ServerSessionImpl
| 43 - org.apache.sshd.osgi - 2.5.1 |
Disconnecting(ServerSessionImpl[null@/127.0.0.1:33908]):
SSH2_DISCONNECT_PROTOCOL_ERROR - Detected AuthTimeout after
120181/120000 ms.
2022-01-04T20:55:12,566 | WARN |
sshd-SshServer[315a8514](port=8101)-nio2-thread-2 | ServerSessionImpl
| 43 - org.apache.sshd.osgi - 2.5.1 |
disconnect(ServerSessionImpl[null@/127.0.0.1:33908]) operation failed
(IOException) for reason=SSH2_DISCONNECT_PROTOCOL_ERROR [Detected
AuthTimeout after 120181/120000 ms.]: Broken pipe
Where would I have to tweak the setup to make the karaf client work
through Ansible?
Thanks!
Ralf