jepsen.control.sshj

An sshj-backed control Remote. Experimental; I’m considering replacing jepsen.control’s use of clj-ssh with this instead.

agent-proxy

(agent-proxy)

auth!

(auth! c {:keys [username password private-key-path], :as conn-spec})

Tries a bunch of ways to authenticate an SSHClient. We start with the given key file, if provided, then fall back to general public keys, then fall back to username/password.

auth-methods

(auth-methods agent)

Returns a list of AuthMethods we can use for logging in via an AgentProxy.

concurrency-limit

OpenSSH has a standard limit of 10 concurrent channels per connection. However, commands run in quick succession with 10 concurrent also seem to blow out the channel limit–perhaps there’s an asynchronous channel teardown process. We set the limit a bit lower here. This is experimentally determined by running jepsen.control-test’s integration test…

handle-error

(handle-error conn context e)

Takes an connection, a context map, and an SSHJ exception. Throws if it was caused by an InterruptedException or InterruptedIOException. Otherwise, wraps it in a :ssh-failed exception map, and throws that.

remote

(remote)

Constructs an SSHJ remote.

send-eof!

(send-eof! client session)

There’s a bug in SSHJ where it doesn’t send an EOF when you close the session’s outputstream, which causes the remote command to hang indefinitely. To work around this, we send an EOF message ourselves. I’m not at all sure this is threadsafe; it might cause issues later.

with-errors

macro

(with-errors conn context & body)

Takes a conn spec, a context map, and a body. Evals body, remapping SSHJ exceptions to :type :jepsen.control/ssh-failed.