cucumber-sshd 1.0.1 → 1.1.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
2
  SHA1:
3
- metadata.gz: de014d741ac9657008dd20dc78819a6e2e3fc1d1
4
- data.tar.gz: 6de8ac4f78669f835b8e3047c4254d2f09f64c52
3
+ metadata.gz: f56e971d95f3760c3b7fc55e9dae3e329d7b4931
4
+ data.tar.gz: f0e4c1ad873b771f9c60a2663da310cafce911d5
5
5
  SHA512:
6
- metadata.gz: be64c575b41756ddac5f06518a58f365ad14f19f787cd198e4d2f1e262dc58f4917d40fba5f0d7e2ece78100d2cbc63c9603e05279ff4274256541e609c08a57
7
- data.tar.gz: af0db945ece516ebf8f50a5bec5de48ded86baf8b40566929077e50b4a153f9aadf62cf67241b2e6d1ff806289b75110c6ae8eb1c4caab89e0a051cab2bb87e1
6
+ metadata.gz: f91d36d8c6c61d9856dd8851f1736d2243371dfbb98981e108f9124a437e4857875d4df4363787de9bcad55494e88c0c2934261bb63bc3083d0baf4975dacf78
7
+ data.tar.gz: 160eb4ca89a9d7bf3c489f122c7794d7cad97d59b2a087820d85b69cdd7ac34efdcaa379f6564d2b66c73e2900b5f65c01b4abb0baa1ba6ccca2f8c2380fa059
@@ -0,0 +1,13 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.2
6
+ - ruby-head
7
+ - 2.1
8
+ before_script:
9
+ - ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
10
+ - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
11
+ - chmod 600 ~/.ssh/authorized_keys
12
+ - eval `ssh-agent -s`
13
+ - ssh-add ~/.ssh/id_rsa
@@ -0,0 +1,5 @@
1
+ require 'cucumber/rake/task'
2
+
3
+ task default: :features
4
+
5
+ Cucumber::Rake::Task.new(:features)
@@ -5,15 +5,19 @@ module Cucumber
5
5
  class Server
6
6
  include Aruba::Api
7
7
 
8
- HOST = 'some_host.test'
9
- PORT = 2222
10
- COMMAND = '/usr/sbin/sshd'
11
- COMMAND_ARGS = '-Deq'
12
- KEY_PATH = 'etc/ssh_host_rsa_key'
13
- KEY_PUB_PATH = KEY_PATH.dup << '.pub'
14
- SSHD_CONFIG_PATH = 'etc/sshd_config'
15
- SSH_CONFIG_PATH = '.ssh/config'
16
-
8
+ HOST = 'some_host.test'
9
+ PORT = 2222
10
+ COMMAND = '/usr/sbin/sshd'
11
+ COMMAND_ARGS = '-Deq'
12
+ KEY_PATH = 'etc/ssh_host_rsa_key'
13
+ KEY_PUB_PATH = KEY_PATH.dup << '.pub'
14
+ SSHD_CONFIG_PATH = 'etc/sshd_config'
15
+ SSH_CONFIG_PATH = '.ssh/config'
16
+ SSH_KNOWN_HOSTS_PATH = '.ssh/known_host'
17
+ SFTP_SERVER_PATHS = %w[
18
+ /usr/libexec/sftp-server
19
+ /usr/lib/openssh/sftp-server
20
+ ]
17
21
  class << self
18
22
  def start(*args)
19
23
  server = new(args.shift, *args)
@@ -65,9 +69,9 @@ module Cucumber
65
69
  end
66
70
 
67
71
  def make_env
68
- %w[etc .ssh].map { |e| create_dir e }
72
+ %w[etc .ssh].map { |e| create_dir_secure e }
69
73
 
70
- write_file KEY_PATH, <<-eoh
74
+ write_file_secure KEY_PATH, <<-eoh
71
75
  -----BEGIN RSA PRIVATE KEY-----
72
76
  MIIEpAIBAAKCAQEA7EVDKeM7NYCGGVJw0wWLGCoptMFSR7DobhbEx2bAQbWDLFBF
73
77
  7S9bXpW/ddebFA4GBkHVriNPwu/IGjIgO3tivVcy6iguNKdYRABlSfpeAs+OdCzK
@@ -97,11 +101,11 @@ iDjcFK8S1e5vnlZAh9xH1WMCEsaz1WNqWm7CZOayN2LFn6Ed9seYYg==
97
101
  -----END RSA PRIVATE KEY-----
98
102
  eoh
99
103
 
100
- write_file KEY_PUB_PATH, <<-eoh
104
+ write_file_secure KEY_PUB_PATH, <<-eoh
101
105
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsRUMp4zs1gIYZUnDTBYsYKim0wVJHsOhuFsTHZsBBtYMsUEXtL1telb9115sUDgYGQdWuI0/C78gaMiA7e2K9VzLqKC40p1hEAGVJ+l4Cz450LMqHIRaGYqcUxmzYyE+ImD8pR6naAVkugRyz2+STfv5wty5RWRdU5I9eVgK4eOCTBo32KP8q8Jws/i3Dzcfc/KHVaf9jiTX7edY3ZLdGBEcX1GMTHuebYWZdxmrXDKA97kbZtA29krKQv7CUogfAqIzgBalUKVzM6KWM2/0pE6EZZqchk00EgNOeKTEW9jQXKg/Wq9GsTwGWrE17Ib+9g2Zey/zGk7Qw4XrnPd3Z
102
106
  eoh
103
107
 
104
- write_file SSHD_CONFIG_PATH, <<-eoh
108
+ write_file_secure SSHD_CONFIG_PATH, <<-eoh
105
109
  Port #{port}
106
110
  ListenAddress ::1
107
111
 
@@ -109,16 +113,38 @@ Protocol 2
109
113
  HostKey #{File.expand_path base_path}/#{KEY_PATH}
110
114
  PidFile /dev/null
111
115
  UsePrivilegeSeparation no
112
- Subsystem sftp /usr/libexec/sftp-server
116
+ Subsystem sftp #{sftp_server_path}
113
117
  ForceCommand HOME=#{File.expand_path base_path} sh -c "cd ~; [ -f .ssh/rc ] && . .ssh/rc; $SSH_ORIGINAL_COMMAND"
114
118
  eoh
115
119
 
116
- write_file SSH_CONFIG_PATH, <<-eoh
117
- Host #{host}
118
- HostName localhost
119
- Port #{port}
120
+ write_file_secure SSH_CONFIG_PATH, <<-eoh
121
+ Host #{host}
122
+ HostName localhost
123
+ Port #{port}
124
+ UserKnownHostsFile #{File.expand_path base_path}/#{SSH_KNOWN_HOSTS_PATH}
125
+ eoh
126
+
127
+ write_file_secure SSH_KNOWN_HOSTS_PATH, <<-eoh
128
+ [localhost]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsRUMp4zs1gIYZUnDTBYsYKim0wVJHsOhuFsTHZsBBtYMsUEXtL1telb9115sUDgYGQdWuI0/C78gaMiA7e2K9VzLqKC40p1hEAGVJ+l4Cz450LMqHIRaGYqcUxmzYyE+ImD8pR6naAVkugRyz2+STfv5wty5RWRdU5I9eVgK4eOCTBo32KP8q8Jws/i3Dzcfc/KHVaf9jiTX7edY3ZLdGBEcX1GMTHuebYWZdxmrXDKA97kbZtA29krKQv7CUogfAqIzgBalUKVzM6KWM2/0pE6EZZqchk00EgNOeKTEW9jQXKg/Wq9GsTwGWrE17Ib+9g2Zey/zGk7Qw4XrnPd3Z
120
129
  eoh
121
130
  end
131
+
132
+
133
+ private
134
+
135
+ def write_file_secure(path, content)
136
+ write_file path, content
137
+ filesystem_permissions 0600, path
138
+ end
139
+
140
+ def create_dir_secure(path)
141
+ create_dir path
142
+ filesystem_permissions 0700, path
143
+ end
144
+
145
+ def sftp_server_path
146
+ SFTP_SERVER_PATHS.detect { |e| File.exist? e } or SFTP_SERVER_PATHS.first
147
+ end
122
148
  end
123
149
  end
124
150
  end
@@ -1,5 +1,5 @@
1
1
  module Cucumber
2
2
  module SSHD
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-sshd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
@@ -59,9 +59,11 @@ extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
61
  - ".gitignore"
62
+ - ".travis.yml"
62
63
  - Gemfile
63
64
  - LICENSE
64
65
  - README.md
66
+ - Rakefile
65
67
  - cucumber-sshd.gemspec
66
68
  - features/sshd_tag.feature
67
69
  - features/steps/output_steps.rb