net-ssh 3.1.0.rc1 → 3.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +0 -1
- data/lib/net/ssh/known_hosts.rb +5 -12
- data/lib/net/ssh/version.rb +1 -1
- data/net-ssh.gemspec +3 -3
- data/test/test_known_hosts.rb +49 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a803f1874f561b9d207f4be53484bb84e2f5a8
|
4
|
+
data.tar.gz: 27ac3df6351aa4c23a2f25dfdac85300d59da4a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2282ad0af5f98206969aaa9b441cd1c653e275ffbbb2066ac3bb4cd7becc280d663812169d8d79b51da31ecb07273b93f5149f84bbc9ba30bc1346d81b7a6b65
|
7
|
+
data.tar.gz: f7ab245b518a969d6fe1634a32538daa504b930803d93b31607a343256a807547118856a6173946ae9c7b1935ea8727275d71063b66ba6cff11f816a73d6ffc0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/lib/net/ssh/known_hosts.rb
CHANGED
@@ -5,29 +5,22 @@ require 'net/ssh/buffer'
|
|
5
5
|
|
6
6
|
module Net; module SSH
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# Represents the result of a search in known hosts
|
9
|
+
# see search_for
|
10
|
+
class HostKeys < Array
|
10
11
|
attr_reader :host
|
11
12
|
|
12
13
|
def initialize(host_keys, host, known_hosts, options = {})
|
13
|
-
|
14
|
+
super(host_keys)
|
14
15
|
@host = host
|
15
16
|
@known_hosts = known_hosts
|
16
17
|
@options = options
|
17
18
|
end
|
18
19
|
|
19
20
|
def add_host_key(key)
|
20
|
-
@known_hosts.add(@host, key, options)
|
21
|
+
@known_hosts.add(@host, key, @options)
|
21
22
|
push(key)
|
22
23
|
end
|
23
|
-
|
24
|
-
def each(&block)
|
25
|
-
@host_keys.each(&block)
|
26
|
-
end
|
27
|
-
|
28
|
-
def empty?
|
29
|
-
@host_keys.empty?
|
30
|
-
end
|
31
24
|
end
|
32
25
|
|
33
26
|
# Searches an OpenSSH-style known-host file for a given host, and returns all
|
data/lib/net/ssh/version.rb
CHANGED
@@ -55,7 +55,7 @@ module Net; module SSH
|
|
55
55
|
|
56
56
|
# The prerelease component of this version of the Net::SSH library
|
57
57
|
# nil allowed
|
58
|
-
PRE = "
|
58
|
+
PRE = "rc2"
|
59
59
|
|
60
60
|
# The current version of the Net::SSH library as a Version instance
|
61
61
|
CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
|
data/net-ssh.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: net-ssh 3.1.0.
|
5
|
+
# stub: net-ssh 3.1.0.rc2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "net-ssh"
|
9
|
-
s.version = "3.1.0.
|
9
|
+
s.version = "3.1.0.rc2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
|
14
14
|
s.cert_chain = ["net-ssh-public_cert.pem"]
|
15
|
-
s.date = "2016-03-
|
15
|
+
s.date = "2016-03-15"
|
16
16
|
s.description = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2."
|
17
17
|
s.email = "net-ssh@solutious.com"
|
18
18
|
s.extra_rdoc_files = [
|
data/test/test_known_hosts.rb
CHANGED
@@ -2,8 +2,7 @@ require 'common'
|
|
2
2
|
|
3
3
|
class TestKnownHosts < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def perform_test(
|
6
|
-
source = File.join(File.dirname(__FILE__), hostfile)
|
5
|
+
def perform_test(source)
|
7
6
|
kh = Net::SSH::KnownHosts.new(source)
|
8
7
|
keys = kh.keys_for("github.com")
|
9
8
|
assert_equal(1, keys.count)
|
@@ -11,11 +10,57 @@ class TestKnownHosts < Test::Unit::TestCase
|
|
11
10
|
end
|
12
11
|
|
13
12
|
def test_key_for_when_all_hosts_are_recognized
|
14
|
-
perform_test("known_hosts/github")
|
13
|
+
perform_test(path("known_hosts/github"))
|
15
14
|
end
|
16
15
|
|
17
16
|
def test_key_for_when_an_host_hash_is_recognized
|
18
|
-
perform_test("known_hosts/github_hash")
|
17
|
+
perform_test(path("known_hosts/github_hash"))
|
19
18
|
end
|
20
19
|
|
20
|
+
def test_missing_then_add
|
21
|
+
Tempfile.open('github') do |f|
|
22
|
+
f.write(File.read(path("known_hosts/github")))
|
23
|
+
kh = Net::SSH::KnownHosts.new(f.path)
|
24
|
+
keys = kh.keys_for("github2.com")
|
25
|
+
assert_equal(0, keys.count)
|
26
|
+
assert_equal([], keys.to_a)
|
27
|
+
|
28
|
+
kh.add('github2.com',rsa_key)
|
29
|
+
keys2 = kh.keys_for("github2.com")
|
30
|
+
assert_equal([rsa_key.to_blob], keys2.to_a.map(&:to_blob))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_search_for
|
35
|
+
options = {user_known_hosts_file: path("known_hosts/github")}
|
36
|
+
keys = Net::SSH::KnownHosts.search_for('github.com',options)
|
37
|
+
assert_equal(["ssh-rsa"], keys.map(&:ssh_type))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_search_for_then_add
|
41
|
+
Tempfile.open('github') do |f|
|
42
|
+
f.write(File.read(path("known_hosts/github")))
|
43
|
+
options = {user_known_hosts_file: f.path}
|
44
|
+
keys = Net::SSH::KnownHosts.search_for('github2.com',options)
|
45
|
+
assert_equal(0, keys.count)
|
46
|
+
|
47
|
+
keys.add_host_key(rsa_key)
|
48
|
+
|
49
|
+
assert_equal([rsa_key.to_blob], keys.map(&:to_blob))
|
50
|
+
keys = Net::SSH::KnownHosts.search_for('github2.com',options)
|
51
|
+
assert_equal([rsa_key.to_blob], keys.map(&:to_blob))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def path(relative_path)
|
57
|
+
File.join(File.dirname(__FILE__), "known_hosts/github")
|
58
|
+
end
|
59
|
+
|
60
|
+
def rsa_key
|
61
|
+
key = OpenSSL::PKey::RSA.new
|
62
|
+
key.e = 0xffeeddccbbaa9988
|
63
|
+
key.n = 0x7766554433221100
|
64
|
+
key
|
65
|
+
end
|
21
66
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
s/ZUKye79ELwFYKJOhjW5g725OL3hy+llhEleytwKRwgXFQBPTC4f5UkdxZVVWGH
|
32
32
|
e2C9M1m/2odPZo8h
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-03-
|
34
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: test-unit
|
metadata.gz.sig
CHANGED
Binary file
|