fssh 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/bin/ftunnel +59 -0
- data/fssh.gemspec +1 -0
- data/lib/fssh/version.rb +1 -1
- metadata +4 -2
data/History.txt
CHANGED
data/bin/ftunnel
ADDED
@@ -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
|
data/fssh.gemspec
CHANGED
data/lib/fssh/version.rb
CHANGED
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
|
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-
|
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:
|