net-ssh 3.3.0.beta1 → 4.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.travis.yml +2 -1
  5. data/CHANGES.txt +3 -16
  6. data/Gemfile +17 -0
  7. data/README.rdoc +1 -1
  8. data/Rakefile +16 -9
  9. data/lib/net/ssh.rb +1 -5
  10. data/lib/net/ssh/authentication/agent/java_pageant.rb +1 -1
  11. data/lib/net/ssh/authentication/agent/socket.rb +5 -5
  12. data/lib/net/ssh/authentication/ed25519.rb +140 -0
  13. data/lib/net/ssh/authentication/key_manager.rb +2 -2
  14. data/lib/net/ssh/authentication/pageant.rb +1 -1
  15. data/lib/net/ssh/buffer.rb +5 -23
  16. data/lib/net/ssh/connection/session.rb +3 -20
  17. data/lib/net/ssh/key_factory.rb +14 -4
  18. data/lib/net/ssh/proxy/http.rb +2 -2
  19. data/lib/net/ssh/service/forward.rb +1 -1
  20. data/lib/net/ssh/test/socket.rb +1 -1
  21. data/lib/net/ssh/transport/algorithms.rb +2 -16
  22. data/lib/net/ssh/transport/cipher_factory.rb +16 -22
  23. data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +1 -1
  24. data/lib/net/ssh/transport/key_expander.rb +1 -0
  25. data/lib/net/ssh/transport/openssl.rb +1 -1
  26. data/lib/net/ssh/transport/session.rb +0 -1
  27. data/lib/net/ssh/version.rb +3 -3
  28. data/net-ssh.gemspec +28 -9
  29. data/test/authentication/test_agent.rb +1 -9
  30. data/test/authentication/test_ed25519.rb +77 -0
  31. data/test/common.rb +0 -16
  32. data/test/connection/test_channel.rb +3 -3
  33. data/test/connection/test_session.rb +0 -1
  34. data/test/integration/{README.txt → README.md} +2 -1
  35. data/test/integration/common.rb +8 -6
  36. data/test/integration/playbook.yml +8 -7
  37. data/test/integration/test_ed25519_pkeys.rb +70 -0
  38. data/test/integration/test_forward.rb +15 -120
  39. data/test/integration/test_id_rsa_keys.rb +11 -11
  40. data/test/integration/test_proxy.rb +2 -2
  41. data/test/test_buffer.rb +1 -29
  42. data/test/transport/kex/test_ecdh_sha2_nistp384.rb +1 -1
  43. data/test/transport/test_algorithms.rb +6 -6
  44. data/test/transport/test_cipher_factory.rb +0 -119
  45. data/test/transport/test_packet_stream.rb +0 -576
  46. data/test/transport/test_session.rb +1 -1
  47. metadata +79 -6
  48. metadata.gz.sig +0 -0
  49. data/test/integration/test_encoding.rb +0 -23
@@ -15,18 +15,6 @@ require 'ostruct'
15
15
  $original_config_default_files = Net::SSH::Config.default_files.dup
16
16
  Net::SSH::Config.default_files.clear
17
17
 
18
- def with_restored_default_files(&block)
19
- act_default_files = Net::SSH::Config.default_files.dup
20
- begin
21
- Net::SSH::Config.default_files.clear
22
- Net::SSH::Config.default_files.concat($_original_config_default_files) # rubocop:disable Style/GlobalVars
23
- yield
24
- ensure
25
- Net::SSH::Config.default_files.clear
26
- Net::SSH::Config.default_files.concat(act_default_files)
27
- end
28
- end
29
-
30
18
  def P(*args)
31
19
  Net::SSH::Packet.new(Net::SSH::Buffer.from(*args))
32
20
  end
@@ -83,10 +71,6 @@ class MockTransport < Net::SSH::Transport::Session
83
71
  end
84
72
  end
85
73
 
86
- def closed?
87
- false
88
- end
89
-
90
74
  def poll_message
91
75
  @queue.shift
92
76
  end
@@ -429,14 +429,14 @@ module Connection
429
429
 
430
430
  def test_data_should_precede_eof
431
431
  channel.do_open_confirmation(0, 1000, 1000)
432
- connection.expect do |t,p|
432
+ connection.expect do |_t,p|
433
433
  assert_equal CHANNEL_DATA, p.type
434
- connection.expect { |t,p| assert_equal CHANNEL_EOF, p.type }
434
+ connection.expect { |_t,p2| assert_equal CHANNEL_EOF, p2.type }
435
435
  end
436
436
  channel.send_data "foo"
437
437
  channel.eof!
438
438
  channel.process
439
- end
439
+ end
440
440
 
441
441
  private
442
442
 
@@ -182,7 +182,6 @@ module Connection
182
182
  end
183
183
 
184
184
  def test_global_request_handler_returning_other_value_should_raise_error
185
- transport.expects(:closed?).at_least_once.returns(false)
186
185
  session.on_global_request("testing") { "bug" }
187
186
  transport.return(GLOBAL_REQUEST, :string, "testing", :bool, true)
188
187
  assert_raises(RuntimeError) { process_times(2) }
@@ -9,7 +9,8 @@ Setup:
9
9
 
10
10
  ansible-galaxy install rvm_io.rvm1-ruby
11
11
  vagrant up ; vagrant ssh
12
- rake test
12
+ rvm all do bundle
13
+ rvm all do rake test
13
14
 
14
15
  # TODO
15
16
 
@@ -7,8 +7,9 @@ require 'pty'
7
7
  require 'expect'
8
8
 
9
9
  module IntegrationTestHelpers
10
+ VERBOSE = false
10
11
  def sh command
11
- puts "$ #{command}"
12
+ puts "$ #{command}" if VERBOSE
12
13
  res = system(command)
13
14
  status = $?
14
15
  raise "Command: #{command} failed:#{status.exitstatus}" unless res
@@ -28,18 +29,18 @@ module IntegrationTestHelpers
28
29
  end
29
30
 
30
31
  def with_agent(&block)
31
- puts "/usr/bin/ssh-agent -c"
32
+ puts "/usr/bin/ssh-agent -c" if VERBOSE
32
33
  agent_out = `/usr/bin/ssh-agent -c`
33
34
  agent_out.split("\n").each do |line|
34
35
  if line =~ /setenv (\S+) (\S+);/
35
36
  ENV[$1] = $2
36
- puts "ENV[#{$1}]=#{$2}"
37
+ puts "ENV[#{$1}]=#{$2}" if VERBOSE
37
38
  end
38
39
  end
39
40
  begin
40
41
  yield
41
42
  ensure
42
- sh "/usr/bin/ssh-agent -k"
43
+ sh "/usr/bin/ssh-agent -k > /dev/null"
43
44
  end
44
45
  end
45
46
 
@@ -51,9 +52,10 @@ module IntegrationTestHelpers
51
52
  reader.expect(/Enter passphrase for .*:/) { |data| puts data }
52
53
  writer.puts(password)
53
54
  until reader.eof? do
54
- puts reader.readline
55
+ line = reader.readline
56
+ puts line if VERBOSE
55
57
  end
56
- rescue Errno::EIO => e
58
+ rescue Errno::EIO => _e
57
59
  end
58
60
  pid, status = Process.wait2 pid
59
61
  end
@@ -3,6 +3,9 @@
3
3
  sudo: yes
4
4
  vars:
5
5
  ruby_version: '2.0.0-p598'
6
+ ruby_versions:
7
+ - '2.0.0-p598'
8
+ - '2.3.0'
6
9
  rvm_install_path: '/usr/local/rvm'
7
10
  foopwd: "$6$mhOzf/yapZwS$3RwDl4GfWZ5VcfcsHrK9xNNTxyzLOJBsmMttDNaegIbXxMahV86.v/5HsNtit16MEl0EFf5CSW8Dz2yXV.8GB0"
8
11
  foo2pwd: "$6$JiB7y7.M0yI$Abt.ZGIc4DwkRWeI6nKxzzPUZcux7hLRXSdpoKoZvswJz1SZyg5GRQWn9pGID0dgC6e4wFglfW6ev/qZoTqGk/"
@@ -42,13 +45,11 @@
42
45
  - apt: name="{{item}}" state=present
43
46
  with_items:
44
47
  - pv
45
- - gem: name="{{item}}" state=present executable=/usr/local/rvm/rubies/ruby-{{ruby_version}}/bin/gem
46
- with_items:
47
- - byebug
48
- - jeweler
49
- - mocha
50
- - rbnacl
51
- - rbnacl-libsodium
48
+ - libgmp3-dev
49
+ - gem: name="{{ item[1] }}" state=present user_install=no executable=/usr/local/rvm/wrappers/ruby-{{ item[0] }}/gem
50
+ with_nested:
51
+ - "{{ruby_versions}}"
52
+ - [ 'byebug', 'jeweler', 'mocha', 'rbnacl', 'rbnacl-libsodium' ]
52
53
  - copy: content='echo "cd /net-ssh ; rake integration-test"' dest=/etc/update-motd.d/99-net-ssh-tests mode=0755
53
54
  handlers:
54
55
  - name: restart sshd
@@ -0,0 +1,70 @@
1
+ require_relative 'common'
2
+ require 'fileutils'
3
+ require 'tmpdir'
4
+
5
+ require 'net/ssh'
6
+
7
+ # see Vagrantfile,playbook for env.
8
+ # we're running as net_ssh_1 user password foo
9
+ # and usually connecting to net_ssh_2 user password foo2pwd
10
+ class TestED25519PKeys < Test::Unit::TestCase
11
+ include IntegrationTestHelpers
12
+
13
+ def test_in_file_no_password
14
+ Dir.mktmpdir do |dir|
15
+ sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
16
+ sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N ''"
17
+ set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
18
+
19
+ # TODO: fix bug in net ssh which reads public key even if private key is there
20
+ sh "mv #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519.pub.hidden"
21
+
22
+ #sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
23
+ #sh "ssh -i #{dir}/id_rsa_ed25519 #{sshopts} net_ssh_1@localhost echo 'hello'"
24
+
25
+ ret = Net::SSH.start("localhost", "net_ssh_1", {keys: "#{dir}/id_rsa_ed25519"}) do |ssh|
26
+ ssh.exec! 'echo "hello from:$USER"'
27
+ end
28
+ assert_equal "hello from:net_ssh_1\n", ret
29
+ end
30
+ end
31
+
32
+
33
+ def test_ssh_agent
34
+ Dir.mktmpdir do |dir|
35
+ with_agent do
36
+ sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
37
+ sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N 'pwd'"
38
+ set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
39
+ ssh_add("#{dir}/id_rsa_ed25519","pwd")
40
+
41
+ # TODO: fix bug in net ssh which reads public key even if private key is there
42
+ sh "mv #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519.pub.hidden"
43
+
44
+ ret = Net::SSH.start("localhost", "net_ssh_1") do |ssh|
45
+ ssh.exec! 'echo "hello from:$USER"'
46
+ end
47
+ assert_equal "hello from:net_ssh_1\n", ret
48
+ end
49
+ end
50
+ end
51
+
52
+ def test_in_file_with_password
53
+ Dir.mktmpdir do |dir|
54
+ sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
55
+ sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N 'pwd'"
56
+ set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
57
+
58
+ # TODO: fix bug in net ssh which reads public key even if private key is there
59
+ sh "mv #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519.pub.hidden"
60
+
61
+ #sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
62
+ #sh "ssh -i #{dir}/id_rsa_ed25519 #{sshopts} net_ssh_1@localhost echo 'hello'"
63
+
64
+ ret = Net::SSH.start("localhost", "net_ssh_1", {keys: "#{dir}/id_rsa_ed25519", passphrase:'pwd'}) do |ssh|
65
+ ssh.exec! 'echo "hello from:$USER"'
66
+ end
67
+ assert_equal "hello from:net_ssh_1\n", ret
68
+ end
69
+ end
70
+ end
@@ -17,7 +17,6 @@
17
17
  require_relative './common'
18
18
  require 'net/ssh/buffer'
19
19
  require 'net/ssh'
20
- require 'net/ssh/proxy/command'
21
20
  require 'timeout'
22
21
  require 'tempfile'
23
22
 
@@ -32,15 +31,15 @@ class TestForward < Test::Unit::TestCase
32
31
  'net_ssh_1'
33
32
  end
34
33
 
35
- def ssh_start_params(options = {})
36
- [localhost ,user , {:keys => @key_id_rsa}.merge(options)]
34
+ def ssh_start_params
35
+ [localhost ,user , {:keys => @key_id_rsa}]
37
36
  end
38
37
 
39
38
  def setup_ssh_env(&block)
40
39
  tmpdir do |dir|
41
40
  @key_id_rsa = "#{dir}/id_rsa"
42
41
  sh "rm -rf #{@key_id_rsa} #{@key_id_rsa}.pub"
43
- sh "ssh-keygen -f #{@key_id_rsa} -t rsa -N ''"
42
+ sh "ssh-keygen -q -f #{@key_id_rsa} -t rsa -N ''"
44
43
  set_authorized_key(user,"#{@key_id_rsa}.pub")
45
44
  yield
46
45
  end
@@ -332,117 +331,13 @@ class TestForward < Test::Unit::TestCase
332
331
  client_done << $!
333
332
  end
334
333
  end
335
- timeout(5) do
334
+ Timeout.timeout(5) do
336
335
  session.loop(0.1) { server_done.empty? }
337
336
  assert_equal message, server_done.pop
338
337
  end
339
338
  end
340
339
  end
341
340
 
342
- class TCPProxy
343
- def initialize()
344
- @sockets = []
345
- end
346
- attr_reader :sockets
347
-
348
- def open(host, port, connection_options = nil)
349
- socket = TCPSocket.new(host,port)
350
- @sockets << socket
351
- socket
352
- end
353
-
354
- def close_all
355
- sockets.each do |socket|
356
- socket.close
357
- end
358
- end
359
- end
360
-
361
- def test_transport_close_should_closes_channels_with_tcps
362
- setup_ssh_env do
363
- server = start_server do |client|
364
- client.puts "Hello"
365
- sleep(100)
366
- client.puts "Hallo"
367
- end
368
- proxy = TCPProxy.new()
369
- session = Net::SSH.start(*ssh_start_params(proxy: proxy))
370
- remote_port = server.addr[1]
371
- local_port = session.forward.local(0, localhost, remote_port)
372
-
373
- # read on forwarded port
374
- client_done = Queue.new
375
- Thread.start do
376
- begin
377
- client = TCPSocket.new(localhost, local_port)
378
- client.read(6)
379
- proxy.close_all
380
- client.read(7)
381
- client.close
382
- client_done << true
383
- rescue
384
- client_done << $!
385
- end
386
- end
387
- Timeout.timeout(5) do
388
- begin
389
- session.loop(0.1) { true }
390
- rescue EOFError, IOError
391
- #puts "Error: #{$!} #{$!.backtrace.join("\n")}"
392
- end
393
- end
394
- begin
395
- Timeout.timeout(5) do
396
- assert_equal true, client_done.pop
397
- end
398
- rescue
399
- puts "Server error: #{server_error.class} #{server_error} bt:#{server_error.backtrace.join("\n")}"
400
- raise
401
- end
402
- end
403
- end
404
-
405
- def todo_test_transport_close_should_closes_channels_with_proxy
406
- setup_ssh_env do
407
- server = start_server do |client|
408
- client.puts "Hello"
409
- sleep(100)
410
- client.puts "Hallo"
411
- end
412
- proxy = Net::SSH::Proxy::Command.new("/bin/nc localhost 22")
413
- session = Net::SSH.start(*ssh_start_params(proxy: proxy))
414
- remote_port = server.addr[1]
415
- local_port = session.forward.local(0, localhost, remote_port)
416
-
417
- # read on forwarded port
418
- client_done = Queue.new
419
- Thread.start do
420
- begin
421
- client = TCPSocket.new(localhost, local_port)
422
- client.read(6)
423
- system("killall /bin/nc")
424
- client.read(7)
425
- client.close
426
- client_done << true
427
- rescue
428
- client_done << $!
429
- end
430
- end
431
- Timeout.timeout(5) do
432
- begin
433
- session.loop(0.1) { true }
434
- rescue EOFError
435
- begin
436
- session.close
437
- rescue
438
- end
439
- #puts "Error: #{$!} #{$!.backtrace.join("\n")}"
440
- end
441
- assert_equal true, client_done.pop
442
- end
443
- end
444
- end
445
-
446
341
  def test_client_close_should_be_handled
447
342
  setup_ssh_env do
448
343
  message = "This is a small message!"*1000
@@ -470,7 +365,7 @@ class TestForward < Test::Unit::TestCase
470
365
  client_done << $!
471
366
  end
472
367
  end
473
- timeout(5) do
368
+ Timeout.timeout(5) do
474
369
  session.loop(0.1) { server_done.empty? }
475
370
  assert_equal message, server_done.pop
476
371
  end
@@ -503,7 +398,7 @@ class TestForward < Test::Unit::TestCase
503
398
  client_done << $!
504
399
  end
505
400
  end
506
- timeout(5) do
401
+ Timeout.timeout(5) do
507
402
  session.loop(0.1) { client_done.empty? }
508
403
  assert_equal message, client_done.pop
509
404
  end
@@ -531,7 +426,7 @@ class TestForward < Test::Unit::TestCase
531
426
  client_done << $!
532
427
  end
533
428
  end
534
- timeout(5) do
429
+ Timeout.timeout(5) do
535
430
  session.loop(0.1) { client_done.empty? }
536
431
  assert_equal message, client_done.pop
537
432
  end
@@ -555,7 +450,7 @@ class TestForward < Test::Unit::TestCase
555
450
  setup_ssh_env do
556
451
  session = Net::SSH.start(*ssh_start_params)
557
452
  server = start_server do |client|
558
- data = client.write "hello"
453
+ _data = client.write "hello"
559
454
  client.close
560
455
  end
561
456
  # Forward to a non existing port
@@ -564,7 +459,7 @@ class TestForward < Test::Unit::TestCase
564
459
  # should return connection refused
565
460
  client_done = Queue.new
566
461
  _run_reading_client(client_done, local_port)
567
- timeout(5) do
462
+ Timeout.timeout(5) do
568
463
  session.loop(0.1) { client_done.empty? }
569
464
  end
570
465
  assert_equal nil, client_done.pop
@@ -573,7 +468,7 @@ class TestForward < Test::Unit::TestCase
573
468
  remote_port = server.addr[1]
574
469
  local_port = session.forward.local(0, localhost, remote_port)
575
470
  _run_reading_client(client_done, local_port)
576
- timeout(5) do
471
+ Timeout.timeout(5) do
577
472
  session.loop(0.1) { client_done.empty? }
578
473
  end
579
474
  assert_equal "hello", client_done.pop
@@ -592,7 +487,7 @@ class TestForward < Test::Unit::TestCase
592
487
  # should return connection refused
593
488
  client_done = Queue.new
594
489
  _run_reading_client(client_done, local_port)
595
- timeout(5) do
490
+ Timeout.timeout(5) do
596
491
  session.loop(0.1) { client_done.empty? }
597
492
  end
598
493
  assert_equal nil, client_done.pop
@@ -600,11 +495,11 @@ class TestForward < Test::Unit::TestCase
600
495
  # start server
601
496
  server = TCPServer.open(remote_port)
602
497
  server = start_server(server) do |client|
603
- data = client.write "hello"
498
+ _data = client.write "hello"
604
499
  client.close
605
500
  end
606
501
  _run_reading_client(client_done, local_port)
607
- timeout(5) do
502
+ Timeout.timeout(5) do
608
503
  session.loop(0.1) { client_done.empty? }
609
504
  end
610
505
  assert_equal "hello", client_done.pop
@@ -616,7 +511,7 @@ class TestForward < Test::Unit::TestCase
616
511
  setup_ssh_env do
617
512
  session = Net::SSH.start(*ssh_start_params)
618
513
  server = start_server(server) do |client|
619
- data = client.write "hello"
514
+ _data = client.write "hello"
620
515
  client.close
621
516
  end
622
517
  remote_port = server.addr[1]
@@ -624,7 +519,7 @@ class TestForward < Test::Unit::TestCase
624
519
  # run client
625
520
  client_done = Queue.new
626
521
  _run_reading_client(client_done, local_port)
627
- timeout(5) do
522
+ Timeout.timeout(5) do
628
523
  session.loop(0.1) { client_done.empty? }
629
524
  end
630
525
  assert_equal "hello", client_done.pop
@@ -13,10 +13,10 @@ class TestIDRSAPKeys < Test::Unit::TestCase
13
13
  def test_in_file_no_password
14
14
  tmpdir do |dir|
15
15
  sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
16
- sh "ssh-keygen -f #{dir}/id_rsa -t rsa -N ''"
16
+ sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N ''"
17
17
  set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
18
18
 
19
- sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
19
+ #sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
20
20
  #sh "ssh -i #{dir}/id_rsa #{sshopts} net_ssh_1@localhost echo 'hello'"
21
21
 
22
22
  ret = Net::SSH.start("localhost", "net_ssh_1", {keys: "#{dir}/id_rsa"}) do |ssh|
@@ -31,11 +31,11 @@ class TestIDRSAPKeys < Test::Unit::TestCase
31
31
  tmpdir do |dir|
32
32
  with_agent do
33
33
  sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
34
- sh "ssh-keygen -f #{dir}/id_rsa -t rsa -N 'pwd123'"
34
+ sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd123'"
35
35
  set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
36
36
  ssh_add("#{dir}/id_rsa","pwd123")
37
37
 
38
- ret = Net::SSH.start("localhost", "net_ssh_1",verbose: :debug) do |ssh|
38
+ ret = Net::SSH.start("localhost", "net_ssh_1") do |ssh|
39
39
  ssh.exec! 'echo "hello from:$USER"'
40
40
  end
41
41
  assert_equal "hello from:net_ssh_1\n", ret
@@ -47,11 +47,11 @@ class TestIDRSAPKeys < Test::Unit::TestCase
47
47
  tmpdir do |dir|
48
48
  with_agent do
49
49
  sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
50
- sh "ssh-keygen -f #{dir}/id_rsa -t rsa -N 'pwd123'"
50
+ sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd123'"
51
51
  set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
52
52
  ssh_add("#{dir}/id_rsa","pwd123")
53
53
 
54
- ret = Net::SSH.start("localhost", "net_ssh_1",verbose: :debug, keys: ["#{dir}/id_rsa"]) do |ssh|
54
+ ret = Net::SSH.start("localhost", "net_ssh_1", keys: ["#{dir}/id_rsa"]) do |ssh|
55
55
  ssh.exec! 'echo "hello from:$USER"'
56
56
  end
57
57
  assert_equal "hello from:net_ssh_1\n", ret
@@ -62,14 +62,14 @@ class TestIDRSAPKeys < Test::Unit::TestCase
62
62
  def test_in_file_with_password
63
63
  tmpdir do |dir|
64
64
  sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
65
- sh "ssh-keygen -f #{dir}/id_rsa -t rsa -N 'pwd12'"
65
+ sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd12'"
66
66
  set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
67
67
 
68
- sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
68
+ #sshopts = '-vvvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
69
69
  #sh "ssh -i #{dir}/id_rsa #{sshopts} net_ssh_1@localhost echo 'hello'"
70
70
 
71
71
  ret = Net::SSH.start("localhost", "net_ssh_1", {keys: "#{dir}/id_rsa",
72
- passphrase: 'pwd12', verbose: :debug}) do |ssh|
72
+ passphrase: 'pwd12'}) do |ssh|
73
73
  ssh.exec! 'echo "hello from:$USER"'
74
74
  end
75
75
  assert_equal "hello from:net_ssh_1\n", ret
@@ -79,13 +79,13 @@ class TestIDRSAPKeys < Test::Unit::TestCase
79
79
  def test_asks_for_passwords_when_read_from_memory
80
80
  tmpdir do |dir|
81
81
  sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
82
- sh "ssh-keygen -f #{dir}/id_rsa -t rsa -N 'pwd12'"
82
+ sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd12'"
83
83
  set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
84
84
  private_key = File.read("#{dir}/id_rsa")
85
85
 
86
86
  options = {keys: [], key_data: [private_key]}
87
87
 
88
- key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)
88
+ #key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)
89
89
 
90
90
  Net::SSH::KeyFactory.expects(:prompt).with('Enter passphrase for :', false).returns('pwd12')
91
91
  Net::SSH.start("localhost", "net_ssh_1", options) do |ssh|