Skip to main content

7.1 – Reverse Agent: Getting started

With Spark Gateway, you can connect to a computer from anywhere, but some computers cannot be reached because they are buried deep within another private/internal network. To solve this problem, a reverse tunnel can be created between the gateway and the target computer, allowing you to connect to any computer/device.

Getting started

  1. Reverse connection is disabled on the gateway by default. Please set reverse.enabled = true in gateway.conf to enable it.
  2. Restart SparkView
  3. Make sure you have the SparkGateway Agent installed, if not please download and install it from the links below:

Start the agent - examples

Notes in advance:

The Agent creates a server on the gateway which is disabled by default. The administrator must review and enable it before it can be connected. You can set reverse.review = false in gateway.conf to override this default behaviour.

The agent will output an HTTP link when it successfully connects to the gateway, and you can use this link to connect to your local computer from anywhere.

Examples:

💡
All commands must be entered from the command line.

Information and help on the agent.

sg_agent reverse --help

Create a reverse tunnel between localhost on port 3389 and the SparkView gateway (https://yourgateway). The default protocol for the tunnel is RDP.

sg_agent reverse --host localhost --port 3389 --remote https://yourgateway

Create a reverse tunnel between another local machine (192.168.0.8) on port 5900 and the gateway (https://yourgateway), protocol: vnc (or rfb), allow self-signed or expired certificate on the gateway (-k).

sg_agent reverse --host 192.168.0.8 --port 5900 --remote https://yourgateway --protocol vnc -k

Configuration options

The options for the agent can be transferred in two ways:

  1. directly via the command with the help of inline parameters
  2. via a configuration file

Inline parameters:

These are appended directly to the command, e.g.

sg_agent reverse --host localhost --port 3389 --remote https://yourgateway

The following parameters are currently supported:

ParameterAction
-h, --helpHelp and information
--hostHost name of the local computer
--portPort of the local computer
--remoteAddress of the SparkView server to be reached
--protocolProtocol to be used. At the moment rdp, ssh, vnc and rfb are supported.
-kAllow invalid certificates on the server (e.g. self-signed, expired, etc.)
--debugOutput debug log

Configuration file:

After the agent has been started for the first time, it automatically creates a configuration file in the following locations:

  • Windows: C:\Users\username\.sg_agent\sg_agent.conf
  • macOS: Y
  • Linux: /home/user/.sg_agent/sg_agent.conf

This can then be changed and applies to future starts of the agent. An example of a configuration file looks like this:

local.port=3389
local.hostname=localhost
local.protocol=rdp
local.id=localclient1
remote.url=https://yourgateway
remote.allow_invalid_certs=true

The agent then only needs to be called up using the short command and loads the information from the configuration file:

sg_agent reverse