sshkeyauth 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ssh/key/helper.rb +8 -1
- data/lib/ssh/key/verifier.rb +1 -1
- metadata +3 -3
data/lib/ssh/key/helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require "net/ssh"
|
2
2
|
|
3
|
+
module SSH; module Key; class KeyNotFound < StandardError
|
4
|
+
end; end; end
|
5
|
+
|
3
6
|
module SSH; module Key; module Helper
|
4
7
|
# Add a private key to this signer.
|
5
8
|
def add_key_file(path, passphrase=nil)
|
@@ -9,7 +12,11 @@ module SSH; module Key; module Helper
|
|
9
12
|
|
10
13
|
# Add a public key from your known_hosts file
|
11
14
|
def add_key_from_host(hostname)
|
12
|
-
hostkey = %x{ssh-keygen -F #{
|
15
|
+
hostkey = %x{ssh-keygen -F "#{hostname}"}.split("\n")[1].chomp.split(" ",2)[-1] rescue nil
|
16
|
+
if hostkey == nil
|
17
|
+
raise SSH::Key::KeyNotFound.new("Could not find host key '#{hostname}' " \
|
18
|
+
"in known_hosts (using ssh-keygen -F)")
|
19
|
+
end
|
13
20
|
@keys << Net::SSH::KeyFactory.load_data_public_key(hostkey)
|
14
21
|
end
|
15
22
|
|
data/lib/ssh/key/verifier.rb
CHANGED
@@ -163,7 +163,7 @@ module SSH; module Key; class Verifier
|
|
163
163
|
end
|
164
164
|
|
165
165
|
# If relative path, use the homedir.
|
166
|
-
if authorized_keys_file
|
166
|
+
if authorized_keys_file.start_with?("/")
|
167
167
|
if account_info == nil
|
168
168
|
@logger.warn("No homedirectory for #{@account} and authorized_keys path is relative, skipping authorized_keys")
|
169
169
|
return nil
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jordan Sissel
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-11 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|