pod.epiccastle.bbssh.session

Creates and calls the various methods of a Session that exists on the pod heap.

connect

(connect session & [timeout])

Initiate the ssh connection with an optional timeout (in milliseconds).

connected?

(connected? session)

return true if session is currently connected

delete-port-forwarding-local

(delete-port-forwarding-local session options)

Cancels the specified local port forwarding

delete-port-forwarding-remote

(delete-port-forwarding-remote session options)

Cancels the specified remote port forwarding

disconnect

(disconnect session)

Disconnect the ssh connection

get-config

(get-config session key)

Get the current config setting key

get-port-forwarding-local

(get-port-forwarding-local session)

return a list of all the local port forwards. List elements are of the form “local-port:host:host-port”.

get-port-forwarding-remote

(get-port-forwarding-remote session)

return a list of all the remote port forwards. List elements are of the form “local-port:host:host-port”.

open-channel

(open-channel session type)

open a channel on the session and return it

set-config

(set-config session key value)

Set the config setting key to value

set-configs

(set-configs session hashmap)

Merge the config values from the passed in hashmap into the session config

set-host

(set-host session host)

Set the host to connect to

set-host-key-repository

(set-host-key-repository session host-key-repository)

sets the host-key-repository that will be used in the public key authentication

set-identity-repository

(set-identity-repository session identity-repository)

sets the identity-repository that will be used in the public key authentication

set-password

(set-password session password)

Set the password the session will use to authenticate to password

set-port

(set-port session port)

Set the port to connect to

set-port-forwarding-local

(set-port-forwarding-local session options)

Register the local port to forward all connection to the remote side, where they will connect to a remote host on a port.

options is a hashmap with one of the following forms

To port forward to a remote TCP/IP port

{
  :bind-address "127.0.0.1"              ;; the local interface to bind to. Use "*" or "0.0.0.0" for all interfaces.
  :local-port 2200                       ;; the local port to listen on
  :remote-host "jump-target.domain.com"  ;; the remote host to forward the connection to on the remote side
  :remote-port 22                        ;; the remote port to forward to
  :connect-timeout 30000                 ;; how long to try to connect for
}

To port forward to a remote unix domain socket

{
  :bind-address "127.0.0.1"              ;; the local interface to bind to. Use "*" or "0.0.0.0" for all interfaces.
  :local-port 2200                       ;; the local port to listen on
  :remote-unix-socket "/var/run/socket"  ;; the remote host to forward the connection to on the remote side
  :connect-timeout 30000                 ;; how long to try to connect for
}

set-port-forwarding-remote

(set-port-forwarding-remote session options)

Register the remote port to forward to the local machine and then connect out to a host on the local network.

options is a hashmap for the following form

{
  :bind-address "127.0.0.1"            ;; the remote interface to bind to. Use "*" or "0.0.0.0" for all interfaces.
  :remote-port 22                        ;; the remote port to bind to
  :local-host "host.localdomain"       ;; the local network host to forward the connection to on the local side
  :local-port 2200                       ;; the local port to connect to
  :connect-timeout 30000                 ;; how long to try to connect for
}

set-proxy

(set-proxy session {:keys [type], :as proxy})

sets the http/socks proxy to connect with the ssh server.

The provided arg must have at least :type (one of #{:http :socks4 :socks5}), :host, :port and optionally :username and :password for proxy authentication.

set-user-info

(set-user-info session user-info)

Set the user-info for the session. The session will use this user-info structure to ask for passwords and passphrases.