SimpleGate makes it possible to use net/ssh/gateway's capabilities in a simple to use way.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit behind Narnach:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



SimpleGate makes it possible to use net/ssh/gateway's capabilities in a simple to use way. This makes it possible to write simple scripts that access servers that are located several hops inside a network.

The core gateway chaining logic was taken from Capistrano, but it has been rewritten to be useful in a more generic way than Capistrano allows.

SimpleGate's Router class makes it possible to automatically find a route through a maze of servers instead of having to manually define gateway chains. An added benefit is that a change to one server's connections no longer requires you to update all other servers if they relied on it as a gateway.

SimpleGate is simple, meaning it does not (yet) do fancy things such as using ~/.ssh. Because of this, you'll have to define ~/.servers.yml and add entries to configure your servers. To use the routing functionality used by the gate_cp and simple_gate executables, you have to define routes in ~/.servers.connections.yml

An example configuration for the servers 'foobar' and 'barfoo' would look be:

  address: ""
  username: "foo"
  password: "bar
  port: 22
  address: ""
  username: "bar"
  password: "foo
  port: 22

Example of a ~/.servers.connections.yml file:

- foo
- bar
- baz
- foobar
- foobaz
- barbaz

All keys are names of servers defined in ~/.servers.yml. The only special node is “local”, which is the starting point for all connections and not a real connection.

Recent changes

Version 0.5.4

  • Fixed gemspec: add missing spec files and added missing gem dependencies

  • Updated Rakefile with ruby 1.9 workaround and a missing file spotter

Version 0.5.3

  • Added yardoc documentation to all classes.

  • SimpleGate#through raises an error when no gates are chosen

  • SimpleGate#through uses local variables instead of instance variables

  • ServerDefinition#options is created on the fly

Version 0.5.2

  • Added -V verbose flag to gate_cp

  • Use STDERR for status messages. STDOUT is used to output SSH responses

  • Updated executables to support direct server connections

  • SimpleGate#through_to can connect directly to a server without gateways

Version 0.5.1

  • Updated readme and simple_gate documentation

  • Implemented infinite loop prevention code in Router#find

  • Cleaned up Router#find to be more readable

  • Added spec to show stack overflow occurs when a cyclical graph is used to find a route

  • Added specs for Router#find

  • Added a -V (verbose) flag option to simple_gate

  • Removed empty method definition

Version 0.5.0

  • Added syntax explanation to gate_cp

  • Added gate_cp, which copies one local file to a remote destination

Version 0.4.1

  • simple_gate is now executable

Version 0.4.0

  • Updated readme with version history for previous gem versions

  • Added simple_gate executable to use SimpleGate's new Router class to find a path to a server and execute a command there.

Version 0.3.0

  • Readme now has a project description and updated credits for a bit of Capistrano code

  • Added mutator and documentation for ServerDefinition.servers

  • Updated comment to make more sense

Version 0.2.0

  • Implemented SimpleGate#through_to, which establishes a real ssh session through a number of gateways

Version 0.1.0

  • Removed simple_gate executable

  • Imported SimpleGate and ServerDefinition

Version 0.0.1

  • Created project


From git

From the project root, use rake to install.

git clone
cd simple_gate
rake install

This will build the gem and install it for you.


simple_gate was created by Wes Oldenbeuving. It is licensed under the MIT license.

SimpleGate#through is based on GatewayConnectionFactory#initialize, which is part of Jamis Buck's Capistrano and is also licensed under the MIT license.