-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
296 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ Gemfile.lock | |
Rakefile | ||
*.md | ||
*.yml | ||
scripts | ||
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ FROM php:7.2-fpm | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
ARG PASSBOLT_VERSION="2.7.1" | ||
ARG PASSBOLT_VERSION="2.8.1" | ||
ARG PASSBOLT_URL="https://github.com/passbolt/passbolt_api/archive/v${PASSBOLT_VERSION}.tar.gz" | ||
|
||
ARG PHP_EXTENSIONS="gd \ | ||
|
@@ -78,6 +78,7 @@ RUN apt-get update \ | |
COPY conf/passbolt.conf /etc/nginx/conf.d/default.conf | ||
COPY conf/supervisor/*.conf /etc/supervisor/conf.d/ | ||
COPY bin/docker-entrypoint.sh /docker-entrypoint.sh | ||
COPY scripts/wait-for.sh /usr/bin/wait-for.sh | ||
|
||
EXPOSE 80 443 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
require 'spec_helper' | ||
|
||
describe 'passbolt_api service' do | ||
|
||
before(:all) do | ||
@mysql_image = Docker::Image.create('fromImage' => 'mariadb:latest') | ||
@mysql = Docker::Container.create( | ||
'Env' => [ | ||
'MYSQL_ROOT_PASSWORD=test', | ||
'MYSQL_DATABASE=passbolt', | ||
'MYSQL_USER=passbolt', | ||
'MYSQL_PASSWORD=±!@#$%^&*()_+=-}{|:;<>?' | ||
], | ||
"Healthcheck" => { | ||
"Test": [ | ||
"CMD-SHELL", | ||
"mysqladmin ping --silent" | ||
] | ||
}, | ||
'Image' => @mysql_image.id) | ||
@mysql.start | ||
|
||
while @mysql.json['State']['Health']['Status'] != 'healthy' | ||
sleep 1 | ||
end | ||
|
||
@image = Docker::Image.build_from_dir(ROOT_DOCKERFILES) | ||
|
||
@container = Docker::Container.create( | ||
'Env' => [ | ||
"DATASOURCES_DEFAULT_HOST=#{@mysql.json['NetworkSettings']['IPAddress']}", | ||
], | ||
'Binds' => [ "#{FIXTURES_PATH + '/passbolt.php'}:/var/www/passbolt/config/passbolt.php" ], | ||
'Image' => @image.id) | ||
|
||
@container.start | ||
@container.logs(stdout: true) | ||
|
||
set :docker_container, @container.id | ||
sleep 17 | ||
end | ||
|
||
after(:all) do | ||
@mysql.kill | ||
@container.kill | ||
end | ||
|
||
let(:passbolt_host) { @container.json['NetworkSettings']['IPAddress'] } | ||
let(:uri) { "/healthcheck/status.json" } | ||
let(:curl) { "curl -sk -o /dev/null -w '%{http_code}' -H 'Host: passbolt.local' https://#{passbolt_host}/#{uri}" } | ||
|
||
describe 'php service' do | ||
it 'is running supervised' do | ||
expect(service('php-fpm')).to be_running.under('supervisor') | ||
end | ||
|
||
it 'has its port open' do | ||
expect(@container.json['Config']['ExposedPorts']).to have_key('9000/tcp') | ||
end | ||
end | ||
|
||
describe 'email cron' do | ||
it 'is running supervised' do | ||
expect(service('cron')).to be_running.under('supervisor') | ||
end | ||
end | ||
|
||
describe 'web service' do | ||
it 'is running supervised' do | ||
expect(service('nginx')).to be_running.under('supervisor') | ||
end | ||
|
||
it 'is listening on port 80' do | ||
expect(@container.json['Config']['ExposedPorts']).to have_key('80/tcp') | ||
end | ||
|
||
it 'is listening on port 443' do | ||
expect(@container.json['Config']['ExposedPorts']).to have_key('443/tcp') | ||
end | ||
end | ||
|
||
describe 'passbolt status' do | ||
it 'returns 200' do | ||
expect(command(curl).stdout).to eq '200' | ||
end | ||
end | ||
|
||
describe 'passbolt serverkey unaccessible' do | ||
let(:uri) { '/config/gpg/serverkey.asc' } | ||
it "returns 404" do | ||
expect(command(curl).stdout).to eq '404' | ||
end | ||
end | ||
|
||
describe 'passbolt serverkey private unaccessible' do | ||
let(:uri) { '/config/gpg/serverkey_private.asc' } | ||
it 'returns 404' do | ||
expect(command(curl).stdout).to eq '404' | ||
end | ||
end | ||
|
||
describe 'passbolt conf unaccessible' do | ||
let(:uri) { '/config/app.php' } | ||
it 'returns 404' do | ||
expect(command(curl).stdout).to eq '404' | ||
end | ||
end | ||
describe 'passbolt tmp folder is unaccessible' do | ||
let(:uri) { '/tmp/cache/database/empty' } | ||
it 'returns 404' do | ||
expect(command(curl).stdout).to eq '404' | ||
end | ||
end | ||
|
||
describe 'hide information' do | ||
let(:curl) { "curl -Isk -H 'Host: passbolt.local' https://#{passbolt_host}/" } | ||
it 'hides php version' do | ||
expect(command("#{curl} | grep 'X-Powered-By: PHP'").stdout).to be_empty | ||
end | ||
|
||
it 'hides nginx version' do | ||
expect(command("#{curl} | grep 'Server:'").stdout.strip).to match(/^Server:\s+nginx$/) | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.