fssh 0.0.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ === 1.0.0
2
+
3
+ * Add ftunnel (SSH tunnel) support.
4
+
1
5
  === 0.0.2
2
6
 
3
7
  * Fix AWS gem require.
@@ -0,0 +1,59 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # encoding: UTF-8
4
+
5
+ # Copyright 2012 Forrager
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ require 'rubygems' unless ENV["NO_RUBYGEMS"]
9
+ require 'fssh'
10
+
11
+ if ARGV.size >= 2
12
+ cli = FSSH::CLI.new(ARGV[0])
13
+ else
14
+ puts "ftunnel must be given the name of the server to connect to as well as a remote and local port, eg: ftunnel my_awesome_server 4444:22"
15
+ puts "USAGE: ftunnel ec2_instance_name local_port:remote_port"
16
+ exit 1
17
+ end
18
+
19
+ local_port, remote_port = ARGV[1].include?(":") ? ARGV[1].split(":") : [ARGV[1], ARGV[1]]
20
+ use_sudo = ARGV[2] == "--sudo"
21
+
22
+ unless cli.private_key_exists?
23
+ puts "Could not find #{cli.config.local_private_key_file}"
24
+ exit 1
25
+ end
26
+
27
+ puts " * Finding instances ..."
28
+ cli.find_instances
29
+
30
+ if cli.find_gateway
31
+ puts " * Found gateway"
32
+ end
33
+
34
+ if cli.find_server
35
+ puts " * Found #{cli.server_name}"
36
+ else
37
+ puts " * Couldn't find server with name #{cli.server_name}"
38
+ exit 1
39
+ end
40
+
41
+ hops = cli.hops
42
+
43
+ if hops.size <= 1
44
+ puts " * Unable to establish tunnel without two hosts."
45
+ elsif hops.size > 2
46
+ puts " * Tunneling through more than one host is not currently supported."
47
+ else
48
+ command = "#{use_sudo ? "sudo " : ""}ssh -i #{cli.config.local_private_key_file} -N -f -L#{local_port}:#{hops.last.dns_name}:#{remote_port} -l #{cli.config.username} #{hops.first.dns_name}"
49
+ end
50
+
51
+ puts " * Executing: #{command}"
52
+ system command
53
+
54
+ if $?.exitstatus == 0
55
+ puts " * Tunnel started."
56
+ else
57
+ puts " * Tunnel failed."
58
+ puts " * Are you trying to forward a privileged port? Try using the --sudo option."
59
+ end
@@ -26,4 +26,5 @@ Gem::Specification.new do |s|
26
26
  s.files = Dir["{lib}/**/*", "Gemfile", "History.txt", "LICENSE", "README.md", "Rakefile", "fssh.gemspec"]
27
27
  s.executables << "fssh"
28
28
  s.executables << "fscp"
29
+ s.executables << "ftunnel"
29
30
  end
@@ -4,5 +4,5 @@
4
4
  # http://www.apache.org/licenses/LICENSE-2.0
5
5
 
6
6
  module FSSH
7
- VERSION = "0.0.3"
7
+ VERSION = "1.0.0"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amazon-ec2
@@ -33,6 +33,7 @@ email:
33
33
  executables:
34
34
  - fssh
35
35
  - fscp
36
+ - ftunnel
36
37
  extensions: []
37
38
  extra_rdoc_files: []
38
39
  files:
@@ -51,6 +52,7 @@ files:
51
52
  - fssh.gemspec
52
53
  - bin/fssh
53
54
  - bin/fscp
55
+ - bin/ftunnel
54
56
  homepage: http://forrager.com
55
57
  licenses: []
56
58
  post_install_message: