sshkit 1.11.2 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 942b003ed89d1b23971fcc2a90f9df45ad13894f
4
- data.tar.gz: c3b93ab5ba8c4e3768229cd6fabc0121aaaf9a5e
3
+ metadata.gz: 55991102eb1f68ef187977bcafd1e2daa71885bc
4
+ data.tar.gz: 655886ef5681e121c8003ec8248b7f4606a327c6
5
5
  SHA512:
6
- metadata.gz: 230cd5e66474858207fccfe497d9e194e0e5fb3455350eb8c189766cd5e276b16309b3193ebfd33c69951fe4ca61258cace638dc55e3aae2f5610f1a57b1d0b2
7
- data.tar.gz: e4376a240351954bf3d26d4f9c22e435dd6079d4516fd92805d640f25ad71af1830b2a4f6ada9c2c2cb0e2c038be9e85b076442d002a8e492933a303a7e21ef3
6
+ metadata.gz: 51a9ab26eb4ac3359b6fe7a06a3ef93d35fc6ddef838256a7b9f699edc940decf2ed4b5a5fac85ff83c7a0e75cc62cc980be4e8341523b29c4726840012596bf
7
+ data.tar.gz: 7f7a17a8917f57034299298a8445ab20194db4404780653f251dc009b71347c3ea755ec10a4f569acc989d73590dcea510a935f9d040e7e72a5e259542016d65
data/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ appear at the top.
8
8
  * Add your entries below here, remember to credit yourself however you want
9
9
  to be credited!
10
10
 
11
+ ## [1.11.3][] (2016-09-16)
12
+
13
+ * Fix known_hosts caching to match on the entire hostlist
14
+ [PR #364](https://github.com/capistrano/sshkit/pull/364) @byroot
15
+
11
16
  ## [1.11.2][] (2016-07-29)
12
17
 
13
18
  ### Bug fixes
@@ -644,7 +649,8 @@ version `0.0.5`.
644
649
 
645
650
  First release.
646
651
 
647
- [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.11.2...HEAD
652
+ [Unreleased]: https://github.com/capistrano/sshkit/compare/v1.11.3...HEAD
653
+ [1.11.3]: https://github.com/capistrano/sshkit/compare/v1.11.2...v1.11.3
648
654
  [1.11.2]: https://github.com/capistrano/sshkit/compare/v1.11.1...v1.11.2
649
655
  [1.11.1]: https://github.com/capistrano/sshkit/compare/v1.11.0...v1.11.1
650
656
  [1.11.0]: https://github.com/capistrano/sshkit/compare/v1.10.0...v1.11.0
@@ -18,10 +18,12 @@ module SSHKit
18
18
  parse_file unless keys && hashes
19
19
  keys, hashes = hosts_keys, hosts_hashes
20
20
 
21
- hostlist.split(',').each do |host|
22
- key_list = keys[host]
23
- return key_list if key_list
21
+ host_names = hostlist.split(',')
24
22
 
23
+ keys_found = host_names.map { |h| keys[h] || [] }.compact.inject(:&)
24
+ return keys_found unless keys_found.empty?
25
+
26
+ host_names.each do |host|
25
27
  hashes.each do |(hmac, salt), hash_keys|
26
28
  if OpenSSL::HMAC.digest(sha1, salt, host) == hmac
27
29
  return hash_keys
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "1.11.2".freeze
2
+ VERSION = "1.11.3".freeze
3
3
  end
@@ -0,0 +1 @@
1
+ github.com,192.30.252.123 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
@@ -56,23 +56,28 @@ module SSHKit
56
56
 
57
57
  if Net::SSH::Version::CURRENT >= Net::SSH::Version[3, 1, 0]
58
58
  def test_known_hosts_for_when_all_hosts_are_recognized
59
- perform_known_hosts_test("github")
59
+ perform_known_hosts_test('github', 'github.com')
60
60
  end
61
61
 
62
62
  def test_known_hosts_for_when_an_host_hash_is_recognized
63
- perform_known_hosts_test("github_hash")
63
+ perform_known_hosts_test('github_hash', 'github.com')
64
+ end
65
+
66
+ def test_known_hosts_for_with_multiple_hosts
67
+ perform_known_hosts_test('github', '192.30.252.123,github.com', 0)
68
+ perform_known_hosts_test('github_ip', '192.30.252.123,github.com', 1)
64
69
  end
65
70
  end
66
71
 
67
72
  private
68
73
 
69
- def perform_known_hosts_test(hostfile)
74
+ def perform_known_hosts_test(hostfile, hostlist, keys_count = 1)
70
75
  source = File.join(File.dirname(__FILE__), '../../known_hosts', hostfile)
71
76
  kh = Netssh::KnownHosts.new
72
- keys = kh.search_for('github.com', user_known_hosts_file: source, global_known_hosts_file: Tempfile.new('sshkit-test').path)
77
+ keys = kh.search_for(hostlist, user_known_hosts_file: source, global_known_hosts_file: Tempfile.new('sshkit-test').path)
73
78
 
74
79
  assert_instance_of ::Net::SSH::HostKeys, keys
75
- assert_equal(1, keys.count)
80
+ assert_equal(keys_count, keys.count)
76
81
  keys.each do |key|
77
82
  assert_equal("ssh-rsa", key.ssh_type)
78
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Hambley
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-30 00:00:00.000000000 Z
12
+ date: 2016-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -178,6 +178,7 @@ files:
178
178
  - test/helper.rb
179
179
  - test/known_hosts/github
180
180
  - test/known_hosts/github_hash
181
+ - test/known_hosts/github_ip
181
182
  - test/support/vagrant_wrapper.rb
182
183
  - test/unit/backends/test_abstract.rb
183
184
  - test/unit/backends/test_connection_pool.rb
@@ -230,6 +231,7 @@ test_files:
230
231
  - test/helper.rb
231
232
  - test/known_hosts/github
232
233
  - test/known_hosts/github_hash
234
+ - test/known_hosts/github_ip
233
235
  - test/support/vagrant_wrapper.rb
234
236
  - test/unit/backends/test_abstract.rb
235
237
  - test/unit/backends/test_connection_pool.rb