aws_ssh 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/aws_ssh.rb +1 -0
- data/lib/aws_ssh/ec2.rb +3 -0
- data/lib/aws_ssh/runner.rb +2 -0
- data/lib/aws_ssh/ssh.rb +39 -0
- data/lib/aws_ssh/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97208487d2c251e27a81c10301c979da01928ea2
|
4
|
+
data.tar.gz: 57e6395a053378cf986101bd2df3bb684a0c9782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba46265e16998b3d7f6b81d222df06fe28a7293566197f8d7b926c818bc8e95009824f151b478348396f4b06ca0f952dcb04dd0ab5e60ad8ccf17d30d2ae67e2
|
7
|
+
data.tar.gz: 046b002281cbf84fb4db793006bf53ada5e8eb451af88e3bb2fb1104df94f951c40ecced47eddea8fc9f6219af51b8235af99ca2cc384b470777bb5188da5331
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ It does assume that you are using SSH key based authentication to access the ser
|
|
8
8
|
|
9
9
|
Ruby, version 2.0 onwards, is required along with the standard bundler gem.
|
10
10
|
|
11
|
-
At the moment, this code is only tested with bash based shells.
|
11
|
+
At the moment, this code is only tested with bash based shells whose ssh config is setup around their user (non root, local, not global ssh config etc).
|
12
12
|
|
13
13
|
## AWS Configuration ##
|
14
14
|
|
data/lib/aws_ssh.rb
CHANGED
data/lib/aws_ssh/ec2.rb
CHANGED
@@ -8,6 +8,7 @@ module AWS_SSH
|
|
8
8
|
attr_accessor :StrictHostKeyChecking
|
9
9
|
attr_accessor :UserKnownHostsFile
|
10
10
|
attr_accessor :LogLevel
|
11
|
+
attr_accessor :ProxyCommand
|
11
12
|
### class values
|
12
13
|
# aws api object
|
13
14
|
attr_accessor :api
|
@@ -34,6 +35,7 @@ module AWS_SSH
|
|
34
35
|
@StrictHostKeyChecking = "no"
|
35
36
|
@UserKnownHostsFile = "/dev/null"
|
36
37
|
@LogLevel = "quiet"
|
38
|
+
@ProxyCommand = AWS_SSH::SSH.proxy
|
37
39
|
|
38
40
|
@seperator = "."
|
39
41
|
@ssh_key_suffixes = [".pem", ""]
|
@@ -107,6 +109,7 @@ module AWS_SSH
|
|
107
109
|
config += " StrictHostKeyChecking #{@StrictHostKeyChecking}\n"
|
108
110
|
config += " UserKnownHostsFile #{@UserKnownHostsFile}\n"
|
109
111
|
config += " LogLevel #{@LogLevel}\n"
|
112
|
+
config += if ! @ProxyCommand.nil? then " ProxyCommand #{@ProxyCommand}\n" else "" end
|
110
113
|
config += "\n\n"
|
111
114
|
end
|
112
115
|
# write to file
|
data/lib/aws_ssh/runner.rb
CHANGED
data/lib/aws_ssh/ssh.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module AWS_SSH
|
2
|
+
|
3
|
+
class SSH
|
4
|
+
|
5
|
+
def self.proxy
|
6
|
+
if AWS_SSH::SSH.ssh_proxy_per_host? && (cmd = AWS_SSH::SSH.existing_proxy_command) && ! cmd.nil?
|
7
|
+
return cmd
|
8
|
+
else
|
9
|
+
return nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# scan original ssh config file for a proxy command, offer to use that
|
14
|
+
def self.existing_proxy_command
|
15
|
+
cmd = nil
|
16
|
+
found = ""
|
17
|
+
filename = ENV['HOME']+"/.ssh/"+AWS_SSH::BASE_HOSTS_FILE
|
18
|
+
if File.exists?(filename)
|
19
|
+
content = File.open(filename, "r"){ |f| f.read}
|
20
|
+
found = content[/ProxyCommand.*/i,0].gsub!("ProxyCommand", "").to_s.strip
|
21
|
+
end
|
22
|
+
extras = if found.length > 0 then "(Found '#{found}', enter y to use, fill in your own or leave blank for no)" else "" end
|
23
|
+
puts "Do you want to use a ProxyCommand? #{extras}: ".colorize(:yellow)
|
24
|
+
newcmd = gets.chomp
|
25
|
+
cmd = if newcmd.length > 0 && newcmd == "y" && ! found.nil? then found elsif newcmd.length >0 then newcmd else "" end
|
26
|
+
return cmd
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.ssh_version
|
30
|
+
return `ssh -V 2>&1`[/[0-9]\.[0-9]/i, 0].to_f
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.ssh_proxy_per_host?
|
34
|
+
no_proxy_version = 6.6
|
35
|
+
return AWS_SSH::SSH.ssh_version < no_proxy_version
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/lib/aws_ssh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/aws_ssh/files.rb
|
93
93
|
- lib/aws_ssh/runner.rb
|
94
94
|
- lib/aws_ssh/setup.rb
|
95
|
+
- lib/aws_ssh/ssh.rb
|
95
96
|
- lib/aws_ssh/teardown.rb
|
96
97
|
- lib/aws_ssh/terminal_formats.rb
|
97
98
|
- lib/aws_ssh/version.rb
|