cucumber-sshd 2.0.0.pre3 → 2.0.0

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
- SHA1:
3
- metadata.gz: 283dafef9311f383a76902dfeb235ef5561781f1
4
- data.tar.gz: 91a6eeb9152402fa05f619ec2497443b2b81c48e
2
+ SHA256:
3
+ metadata.gz: 4d1490ecfcce254e9252d001b2d5230a4b9d5a80c8fc8d75cfc181552d1776be
4
+ data.tar.gz: 563447c5cc35e66a6a01d36e59f551af08cf6202b6a97f48372e7e154861609d
5
5
  SHA512:
6
- metadata.gz: d1d6bce79d3e7ce7a0a98d20707acbf3efe3e47029883ed04a0d1577eed998c99b2defff7d712899fab2653bcd36fe5e47a0d30017251c815813fd6373c67bb3
7
- data.tar.gz: 696c7aa307c4f663ce23d05f2137745c1bcf409496af73ac0893f7cfdad878f726a5f1ca9a0cfd2121eb3dc3534ed80a3ad82ab2e8c8abf082f4257fe54cd36a
6
+ metadata.gz: 03bec6dd3ece7de26b87dd1511c15311b4940366d1fe6e40dd56c9373e11e79e35f36490c0c060bee97b5a5c0a9219c17b4650dbb4e6b7b9ea318ec866d60389
7
+ data.tar.gz: ee7046516b62d961fb02490e58107f885c35e28d8b363143cae78449b427909e4b68b84233a2e6b482802219de67ec6759d32338e8089cbd9182a8c32cfacbac
@@ -3,12 +3,11 @@ require 'cucumber/sshd/server'
3
3
  Before '@sshd' do
4
4
  start_server = -> do
5
5
  Cucumber::SSHD::Server.start \
6
- home: ENV.fetch('CUCUMBER_SSHD_HOME', 'tmp/home'),
7
- addr: ENV.fetch('CUCUMBER_SSHD_LISTEN', '::1'),
8
- port: ENV.fetch('CUCUMBER_SSHD_PORT', 2222),
9
- debug: ENV.key?('CUCUMBER_SSHD_DEBUG'),
10
- persist: ENV.key?('CUCUMBER_SSHD_PERSIST'),
11
- wait_ready: ENV.key?('CUCUMBER_SSHD_WAIT_READY')
6
+ home: ENV.fetch('CUCUMBER_SSHD_HOME', 'tmp/home'),
7
+ addr: ENV.fetch('CUCUMBER_SSHD_LISTEN', '::1'),
8
+ port: ENV.fetch('CUCUMBER_SSHD_PORT', 2222),
9
+ debug: ENV.key?('CUCUMBER_SSHD_DEBUG'),
10
+ persist: ENV.key?('CUCUMBER_SSHD_PERSIST')
12
11
  end
13
12
 
14
13
  if !$_sshd && ENV.key?('CUCUMBER_SSHD_PERSIST')
@@ -1,27 +1,27 @@
1
1
  module Cucumber
2
2
  module SSHD
3
3
  class Server
4
- HOST = 'some_host.test'.freeze
5
- HOSTNAME = 'localhost'.freeze
6
- COMMAND = '/usr/sbin/sshd'.freeze
7
- COMMAND_ARGS = '-Deq'.freeze
8
- COMMAND_ARGS_DEBUG = '-De'.freeze
9
- KEY_PATH = 'etc/ssh_host_rsa_key'.freeze
10
- KEY_PUB_PATH = [KEY_PATH, '.pub'].join.freeze
11
- SSHD_CONFIG_PATH = 'etc/sshd_config'.freeze
12
- SSH_CONFIG_PATH = '.ssh/config'.freeze
13
- SSH_KNOWN_HOSTS_PATH = '.ssh/known_host'.freeze
14
- SFTP_SERVER_PATHS = %w[
4
+ HOST = 'some_host.test'.freeze
5
+ HOSTNAME = 'localhost'.freeze
6
+ COMMAND = '/usr/sbin/sshd'.freeze
7
+ COMMAND_ARGS = '-Deq'.freeze
8
+ COMMAND_ARGS_DEBUG = '-De'.freeze
9
+ KEY_PATH = 'etc/ssh_host_rsa_key'.freeze
10
+ KEY_PUB_PATH = [KEY_PATH, '.pub'].join.freeze
11
+ SSHD_CONFIG_PATH = 'etc/sshd_config'.freeze
12
+ SSH_CONFIG_PATH = '.ssh/config'.freeze
13
+ SSH_KNOWN_HOSTS_PATH = '.ssh/known_hosts'.freeze
14
+ SFTP_SERVER_PATHS = %w[
15
15
  /usr/libexec/sftp-server
16
16
  /usr/lib/openssh/sftp-server
17
17
  ].freeze
18
18
 
19
- KEY = <<-eoh.freeze
20
- -----BEGIN EC PRIVATE KEY-----
21
- MHcCAQEEIJbQy3yg9iU4xFvia9DWKWuhMzI5QGncR6OUldAOSIe7oAoGCCqGSM49
22
- AwEHoUQDQgAEJpS8Sknl2X6PNurToQCNu5lX/scaJLr3FkiufD+p67epbwIjiyzo
23
- qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
24
- -----END EC PRIVATE KEY-----
19
+ KEY = <<~eoh.freeze
20
+ -----BEGIN EC PRIVATE KEY-----
21
+ MHcCAQEEIJbQy3yg9iU4xFvia9DWKWuhMzI5QGncR6OUldAOSIe7oAoGCCqGSM49
22
+ AwEHoUQDQgAEJpS8Sknl2X6PNurToQCNu5lX/scaJLr3FkiufD+p67epbwIjiyzo
23
+ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
24
+ -----END EC PRIVATE KEY-----
25
25
  eoh
26
26
  KEY_PUB =
27
27
  'ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNT' \
@@ -29,8 +29,8 @@ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
29
29
  'XVYrc0D+yxIV2zVLlAMxDHwOqwA='
30
30
 
31
31
  class << self
32
- def start *args
33
- server = new args.shift, *args
32
+ def start options
33
+ server = new **options
34
34
  server.configure
35
35
  server.start
36
36
  server
@@ -40,14 +40,13 @@ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
40
40
  attr_reader :home
41
41
 
42
42
  def initialize(
43
- home:, addr:, port:, debug: false, persist: false, wait_ready: false
43
+ home:, addr:, port:, debug: false, persist: false
44
44
  )
45
- @home = home
46
- @addr = addr
47
- @port = port
48
- @debug = debug
49
- @persist = persist
50
- @wait_ready = wait_ready
45
+ @home = home
46
+ @addr = addr
47
+ @port = port
48
+ @debug = debug
49
+ @persist = persist
51
50
  end
52
51
 
53
52
  def configure
@@ -68,7 +67,7 @@ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
68
67
  end
69
68
  end
70
69
  print_server_info if debug?
71
- wait_ready! if wait_ready?
70
+ wait_ready
72
71
  end
73
72
 
74
73
  def stop
@@ -78,7 +77,7 @@ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
78
77
 
79
78
  private
80
79
 
81
- attr_reader :addr, :port, :debug, :persist, :wait_ready, :pid
80
+ attr_reader :addr, :port, :debug, :persist, :pid
82
81
 
83
82
  def command
84
83
  [
@@ -91,10 +90,10 @@ qnLMVQddVitzQP7LEhXbNUuUAzEMfA6rAA==
91
90
 
92
91
  def configure_client
93
92
  write_file_secure SSH_CONFIG_PATH, <<-eoh
94
- Host #{HOST}
95
- HostName #{HOSTNAME}
96
- Port #{port}
97
- UserKnownHostsFile #{File.expand_path home}/#{SSH_KNOWN_HOSTS_PATH}
93
+ Host #{HOST}
94
+ HostName #{HOSTNAME}
95
+ Port #{port}
96
+ UserKnownHostsFile #{File.expand_path home}/#{SSH_KNOWN_HOSTS_PATH}
98
97
  eoh
99
98
  write_file_secure SSH_KNOWN_HOSTS_PATH, "[#{HOSTNAME}]:2222 #{KEY_PUB}"
100
99
  end
@@ -108,7 +107,6 @@ ListenAddress #{addr}
108
107
  Protocol 2
109
108
  HostKey #{File.expand_path home}/#{KEY_PATH}
110
109
  PidFile /dev/null
111
- UsePrivilegeSeparation no
112
110
  Subsystem sftp #{sftp_server_path}
113
111
  ForceCommand HOME=#{File.expand_path home} sh -c "cd ~; [ -f .ssh/rc ] && . .ssh/rc; $SSH_ORIGINAL_COMMAND"
114
112
  eoh
@@ -132,7 +130,6 @@ CUCUMBER SSHD STARTING ---------------------------------------------------------
132
130
  HOME: #{home}
133
131
  LISTEN: #{addr}:#{port}
134
132
  PERSIST: #{persist}
135
- WAIT_READY: #{wait_ready}
136
133
  --------------------------------------------------------------------------------
137
134
  eoh
138
135
  end
@@ -141,17 +138,13 @@ WAIT_READY: #{wait_ready}
141
138
  SFTP_SERVER_PATHS.detect { |e| File.exist? e }
142
139
  end
143
140
 
144
- def wait_ready!
141
+ def wait_ready
145
142
  TCPSocket.new HOSTNAME, port
146
143
  rescue Errno::ECONNREFUSED
147
- sleep 0.05
144
+ sleep 0.005
148
145
  retry
149
146
  end
150
147
 
151
- def wait_ready?
152
- !!wait_ready
153
- end
154
-
155
148
  def write_file_secure path, content
156
149
  File.open File.join(home, path), ?w, 0600 do |file|
157
150
  file.write content
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-sshd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-20 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: childprocess
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: cucumber
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -75,12 +61,11 @@ files:
75
61
  - lib/cucumber/sshd.rb
76
62
  - lib/cucumber/sshd/cucumber.rb
77
63
  - lib/cucumber/sshd/server.rb
78
- - lib/cucumber/sshd/version.rb
79
64
  homepage: https://rubygems.org/gems/cucumber-sshd
80
65
  licenses:
81
66
  - BSD-3-Clause
82
67
  metadata: {}
83
- post_install_message:
68
+ post_install_message:
84
69
  rdoc_options: []
85
70
  require_paths:
86
71
  - lib
@@ -91,13 +76,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
76
  version: '0'
92
77
  required_rubygems_version: !ruby/object:Gem::Requirement
93
78
  requirements:
94
- - - ">"
79
+ - - ">="
95
80
  - !ruby/object:Gem::Version
96
- version: 1.3.1
81
+ version: '0'
97
82
  requirements: []
98
- rubyforge_project:
99
- rubygems_version: 2.6.14
100
- signing_key:
83
+ rubygems_version: 3.3.11
84
+ signing_key:
101
85
  specification_version: 4
102
86
  summary: Cucumber sshd helpers
103
87
  test_files: []
@@ -1,5 +0,0 @@
1
- module Cucumber
2
- module SSHD
3
- VERSION = '2.0.0.pre3'.freeze
4
- end
5
- end