|
57 | 57 | 'PASSBOLT_PLUGINS_JWT_AUTHENTICATION_ENABLED=true' |
58 | 58 | ], |
59 | 59 | 'Image' => @image.id, |
60 | | - 'Binds' => $binds |
| 60 | + 'HostConfig' => { |
| 61 | + 'Binds' => $binds |
| 62 | + } |
61 | 63 | ) |
62 | 64 |
|
63 | 65 | @container.start |
|
74 | 76 |
|
75 | 77 | let(:passbolt_host) { @container.json['NetworkSettings']['IPAddress'] } |
76 | 78 | let(:uri) { '/healthcheck/status.json' } |
77 | | - let(:curl) { "curl -sk -o /dev/null -w '%{http_code}' -H 'Host: passbolt.local' https://#{passbolt_host}:#{$https_port}/#{uri}" } |
| 79 | + let(:curl) { "curl -sLk -o /dev/null -w '%{http_code}' -H 'Host: passbolt.local' https://#{passbolt_host}:#{$https_port}#{uri}" } |
78 | 80 | let(:jwt_conf) { "#{PASSBOLT_CONFIG_PATH + '/jwt'}" } |
79 | 81 | let(:jwt_key_pair) { ["#{jwt_conf}/jwt.key", "#{jwt_conf}/jwt.pem"] } |
80 | 82 |
|
|
160 | 162 | end |
161 | 163 |
|
162 | 164 | describe 'hide information' do |
163 | | - let(:curl) { "curl -Isk -H 'Host: passbolt.local' https://#{passbolt_host}:#{$https_port}/" } |
| 165 | + let(:curl) { "curl -skL -D - -H 'Host: passbolt.local' https://#{passbolt_host}:#{$https_port}#{uri} -o /dev/null" } |
164 | 166 | it 'hides php version' do |
165 | 167 | expect(command("#{curl} | grep 'X-Powered-By: PHP'").stdout).to be_empty |
166 | 168 | end |
167 | 169 |
|
| 170 | + it 'returns 200' do |
| 171 | + expect(command(curl).stdout).to contain 'HTTP/2 200' |
| 172 | + end |
| 173 | + |
168 | 174 | it 'hides nginx version' do |
169 | 175 | expect(command("#{curl} | grep 'server:'").stdout.strip).to match(/^server:\s+nginx.*$/) |
170 | 176 | end |
|
177 | 183 | let(:gnupghome) { '/var/lib/passbolt/.gnupg' } |
178 | 184 |
|
179 | 185 | let(:list_keys_cmd) do |
180 | | - if ENV['ROOTLESS'] == 'true' |
181 | | - ['gpg', '--homedir', gnupghome, '--list-keys', '--with-colons'] |
182 | | - else |
183 | | - ['su', '-s', '/bin/bash', '-c', "gpg --homedir #{gnupghome} --list-keys --with-colons", 'www-data'] |
184 | | - end |
185 | | - end |
186 | | - |
187 | | - let(:healthcheck_cmd) do |
188 | | - if ENV['ROOTLESS'] == 'true' |
189 | | - ['bash', '-c', 'source /etc/environment && /usr/share/php/passbolt/bin/cake passbolt healthcheck --gpg'] |
190 | | - else |
191 | | - ['su', '-s', '/bin/bash', '-c', 'source /etc/environment && /usr/share/php/passbolt/bin/cake passbolt healthcheck --gpg', 'www-data'] |
192 | | - end |
193 | | - end |
| 186 | + if ENV['ROOTLESS'] == 'true' |
| 187 | + ['gpg', '--homedir', gnupghome, '--list-keys', '--with-colons'] |
| 188 | + else |
| 189 | + ['su', '-s', '/bin/bash', '-c', "gpg --homedir #{gnupghome} --list-keys --with-colons", 'www-data'] |
| 190 | + end |
| 191 | + end |
| 192 | + |
| 193 | + let(:healthcheck_cmd) do |
| 194 | + if ENV['ROOTLESS'] == 'true' |
| 195 | + ['bash', '-c', 'source /etc/environment && /usr/share/php/passbolt/bin/cake passbolt healthcheck --gpg'] |
| 196 | + else |
| 197 | + ['su', '-s', '/bin/bash', '-c', |
| 198 | + 'source /etc/environment && /usr/share/php/passbolt/bin/cake passbolt healthcheck --gpg', 'www-data'] |
| 199 | + end |
| 200 | + end |
194 | 201 |
|
195 | 202 | describe 'generated keys' do |
196 | 203 | it 'should have created private key file' do |
|
220 | 227 | expect(usage_flags).to include('s') |
221 | 228 | expect(usage_flags).to include('c') |
222 | 229 | expect(usage_flags).not_to include('e') |
223 | | - |
224 | 230 | end |
225 | 231 |
|
226 | | - |
227 | 232 | it 'should have correct key usage for subkey' do |
228 | 233 | output = @container.exec(list_keys_cmd)[0].join |
229 | 234 | sub_line = output.lines.find { |line| line.start_with?('sub:') } |
|
238 | 243 | end |
239 | 244 | end |
240 | 245 |
|
241 | | - it 'should pass all GPG checks' do |
242 | | - output = @container.exec(healthcheck_cmd)[0].join |
| 246 | + it 'should pass all GPG checks' do |
| 247 | + output = @container.exec(healthcheck_cmd)[0].join |
243 | 248 |
|
244 | | - expect(output).to include('[PASS] PHP GPG Module is installed and loaded') |
245 | | - expect(output).to include('[PASS] The environment variable GNUPGHOME is set') |
246 | | - expect(output).to include('[PASS] The server OpenPGP key is not the default one') |
247 | | - expect(output).to include('[PASS] The public key file is defined') |
248 | | - expect(output).to include('[PASS] The private key file is defined') |
| 249 | + expect(output).to include('[PASS] PHP GPG Module is installed and loaded') |
| 250 | + expect(output).to include('[PASS] The environment variable GNUPGHOME is set') |
| 251 | + expect(output).to include('[PASS] The server OpenPGP key is not the default one') |
| 252 | + expect(output).to include('[PASS] The public key file is defined') |
| 253 | + expect(output).to include('[PASS] The private key file is defined') |
249 | 254 |
|
250 | | - pass_count = output.scan(/\[PASS\]/).count |
251 | | - fail_count = output.scan(/\[FAIL\]/).count |
| 255 | + pass_count = output.scan(/\[PASS\]/).count |
| 256 | + fail_count = output.scan(/\[FAIL\]/).count |
252 | 257 |
|
253 | | - expect(pass_count).to be >= 10 |
254 | | - expect(fail_count).to eq(0) |
| 258 | + expect(pass_count).to be >= 10 |
| 259 | + expect(fail_count).to eq(0) |
255 | 260 |
|
256 | | - expect(output).to include('[PASS] No error found') |
257 | | - end |
| 261 | + expect(output).to include('[PASS] No error found') |
| 262 | + end |
258 | 263 | end |
259 | 264 |
|
260 | | - |
261 | 265 | describe 'jwt configuration' do |
262 | 266 | it 'should have the correct permissions' do |
263 | 267 | expect(file(jwt_conf)).to be_a_directory |
|
0 commit comments