WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:ethz.sshLocalPortForward
Description:
Id:ethz.sshLocalPortForward
Category:accessor
Identifier Syntax

ethz.sshLocalPortForward is an accessor using Active URI syntax with the following base identifiers:

Base
active:sshLocalPortForward

and the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
remote
Mandatory
Representation (java.lang.Object)ssh: URI of the remote server
forward
Mandatory
Representation (java.lang.Object)The local port forwarding identifier
credentials
Mandatory
Representation (java.lang.Object)The ssh credentials
Request Verbs

The following verbs are supported:

Verbs
EXISTSDELETENEW
Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use ethz.sshLocalPortForward accessor you must import the module urn:org:netkernel:client:ssh:

<import>
  <uri>urn:org:netkernel:client:ssh</uri>
</import>

active:sshLocalPortForward enables the persistant creation of local port forwarding over SSH.

remote

The remote argument must be an ssh: URI specifying the hostname of the remote ssh server. For example:

ssh://remote.server.com

credentials

The credentials argument are the ssh credentials required to connect to the remote host. See credentials section for details.

forward

The forward argument is the same form as the openssh -L port forward switch. It must be an identifier of the form

1070:localhost:1060

NEW

To initiate port forward a NEW request must be issued. The identifier of the NEW port forward resource is returned as the response.

EXISTS

To test the existence of a port forward an EXISTS request may be issued. An EXISTS request must be issued with same identifer as was used in the NEW request.

DELETE

To terminate the port forward and close the underlying ssh conection a DELETE request must be issued with same identifer as was used in the NEW request.

Example

To initiate the port forwarding of a remote servers port 1060 on its localhost adapter, to the client side's local port 1070 do this...

<request>
  <identifier>active:sshLocalPortForward</identifier>
  <argument name="remote">ssh://server.com</argument>
  <argument name="credentials">res:/resources/my-ssh-credentials-for-server.com</argument>
  <argument name="forward">1070:localhost:1060</argument>
  <verb>NEW</verb>
</request>

or in NKF form...

req=context.createRequest("active:sshLocalPortForward")
req.addArgument("remote", "ssh://server.com")
req.addArgument("credentials", "res:/resources/my-ssh-credentials-for-server.com")
req.addArgument("forward", "1070:localhost:1060")
req.setVerb(INKFRequestReadOnly.VERB_NEW)
context.issueRequest(req);

And to subsequently close the port forward...

<request>
  <identifier>active:sshLocalPortForward</identifier>
  <argument name="remote">ssh://server.com</argument>
  <argument name="credentials">res:/resources/my-ssh-credentials-for-server.com</argument>
  <argument name="forward">1070:localhost:1060</argument>
  <verb>DELETE</verb>
</request>

in NKF form...

req=context.createRequest("active:sshLocalPortForward")
req.addArgument("remote", "ssh://server.com")
req.addArgument("credentials", "res:/resources/my-ssh-credentials-for-server.com")
req.addArgument("forward", "1070:localhost:1060")
req.setVerb(INKFRequestReadOnly.VERB_DELETE)
context.issueRequest(req);

Lifecycle

An established port forward will remain active indefinitely or until explicitly closed with a DELETE request. All open forwarded ports are closed when the SSH module is decommissioned - for example prior to shutdown, or when recommissioning the ssh client module.