Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit 9fd2879

Browse files
authored
Merge pull request #71 from dev-sec/docker
add docker support
2 parents 86e10be + 1992ac7 commit 9fd2879

File tree

6 files changed

+125
-47
lines changed

6 files changed

+125
-47
lines changed

.kitchen.vagrant.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
driver:
3+
name: vagrant
4+
5+
provisioner:
6+
name: ansible_playbook
7+
test_repo_uri: https://github.com/hardening-io/tests-ssh-hardening.git
8+
hosts: all
9+
require_ansible_repo: false
10+
require_ansible_omnibus: true
11+
require_chef_for_busser: false
12+
require_ruby_for_busser: false
13+
ansible_verbose: true
14+
roles_path: ../ansible-ssh-hardening/
15+
playbook: default.yml
16+
17+
platforms:
18+
- name: ubuntu-12.04
19+
driver_config:
20+
box: opscode-ubuntu-12.04
21+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box
22+
- name: ubuntu-14.04
23+
driver_config:
24+
box: opscode-ubuntu-14.04
25+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
26+
- name: centos-6.4
27+
driver_config:
28+
box: opscode-centos-6.4
29+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
30+
- name: centos-6.5
31+
driver_config:
32+
box: opscode-centos-6.5
33+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
34+
- name: oracle-6.4
35+
driver_config:
36+
box: oracle-6.4
37+
box_url: https://storage.us2.oraclecloud.com/v1/istoilis-istoilis/vagrant/oel64-64.box
38+
- name: oracle-6.5
39+
driver_config:
40+
box: oracle-6.5
41+
box_url: https://storage.us2.oraclecloud.com/v1/istoilis-istoilis/vagrant/oel65-64.box
42+
- name: debian-6
43+
driver_config:
44+
box: debian-6
45+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-6.0.10_chef-provisionerless.box
46+
- name: debian-7
47+
driver_config:
48+
box: debian-7
49+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box
50+
- name: debian-8
51+
driver_config:
52+
box: debian-8
53+
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-8.1_chef-provisionerless.box
54+
55+
verifier:
56+
name: inspec
57+
sudo: true
58+
inspec_tests:
59+
- https://github.com/dev-sec/tests-ssh-hardening
60+
61+
suites:
62+
- name: ssh-ansible_1.9
63+
provisioner:
64+
ansible_version: 1.9.4
65+
- name: ssh-ansible_latest

.kitchen.yml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
driver:
3-
name: vagrant
3+
name: docker
4+
use_sudo: false
5+
provision_command:
6+
- "mkdir /var/run/sshd"
7+
8+
transport:
9+
max_ssh_sessions: 5
410

511
provisioner:
612
name: ansible_playbook
@@ -15,45 +21,39 @@ provisioner:
1521
roles_path: ../ansible-ssh-hardening/
1622
playbook: default.yml
1723

18-
verifier:
19-
name: inspec
20-
sudo: true
21-
inspec_tests:
22-
- https://github.com/dev-sec/tests-ssh-hardening
23-
2424
platforms:
2525
- name: ubuntu-12.04
26-
driver_config:
27-
box: opscode-ubuntu-12.04
28-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box
26+
driver:
27+
image: ubuntu:12.04
2928
- name: ubuntu-14.04
30-
driver_config:
31-
box: opscode-ubuntu-14.04
32-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
33-
- name: centos-6.4
34-
driver_config:
35-
box: opscode-centos-6.4
36-
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
37-
- name: centos-6.5
38-
driver_config:
39-
box: opscode-centos-6.5
40-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
41-
- name: oracle-6.4
42-
driver_config:
43-
box: oracle-6.4
44-
box_url: https://storage.us2.oraclecloud.com/v1/istoilis-istoilis/vagrant/oel64-64.box
45-
- name: oracle-6.5
46-
driver_config:
47-
box: oracle-6.5
48-
box_url: https://storage.us2.oraclecloud.com/v1/istoilis-istoilis/vagrant/oel65-64.box
29+
driver:
30+
image: ubuntu:14.04
31+
- name: ubuntu-16.04
32+
driver:
33+
image: ubuntu:16.04
34+
- name: centos-6.6
35+
driver:
36+
image: centos:6.6
37+
- name: centos-6.7
38+
driver:
39+
image: centos:6.7
40+
- name: centos-7
41+
driver:
42+
image: centos:7
43+
privileged: true
44+
run_command: /usr/sbin/init
4945
- name: debian-7
50-
driver_config:
51-
box: debian-7
52-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box
46+
driver:
47+
image: debian:7
5348
- name: debian-8
54-
driver_config:
55-
box: debian-8
56-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-8.1_chef-provisionerless.box
49+
driver:
50+
image: debian:8
51+
52+
verifier:
53+
name: inspec
54+
sudo: true
55+
inspec_tests:
56+
- https://github.com/dev-sec/tests-ssh-hardening
5757

5858
suites:
5959
- name: ssh-ansible_1.9

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ group :integration do
2323
gem 'kitchen-sharedtests', '~> 0.2.0'
2424
gem 'kitchen-sync'
2525
gem 'kitchen-transport-rsync'
26+
gem 'kitchen-docker'
2627
end
2728

2829
group :openstack do

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,20 @@ This role provides secure ssh-client and ssh-server configurations.
5151

5252
## Local Testing
5353

54-
For local testing you can use vagrant and Virtualbox of VMWare to run tests locally. You will have to install Virtualbox and Vagrant on your system. See [Vagrant Downloads](http://downloads.vagrantup.com/) for a vagrant package suitable for your system. For all our tests we use `test-kitchen`. If you are not familiar with `test-kitchen` please have a look at [their guide](http://kitchen.ci/docs/getting-started).
54+
The preferred way of locally testing the role is to use Docker. You will have to install Docker on your system. See [Get started](https://docs.docker.com/) for a Docker package suitable to for your system.
55+
56+
You can also use vagrant and Virtualbox or VMWare to run tests locally. You will have to install Virtualbox and Vagrant on your system. See [Vagrant Downloads](http://downloads.vagrantup.com/) for a vagrant package suitable for your system. For all our tests we use `test-kitchen`. If you are not familiar with `test-kitchen` please have a look at [their guide](http://kitchen.ci/docs/getting-started).
5557

5658
Next install test-kitchen:
5759

5860
```bash
5961
# Install dependencies
6062
gem install bundler
6163
bundle install
64+
```
6265

66+
### Testing with Docker
67+
```
6368
# fast test on one machine
6469
bundle exec kitchen test default-ubuntu-1204
6570
@@ -71,6 +76,18 @@ bundle exec kitchen create default-ubuntu-1204
7176
bundle exec kitchen converge default-ubuntu-1204
7277
```
7378

79+
### Testing with Virtualbox
80+
```
81+
# fast test on one machine
82+
KITCHEN_YAML=".kitchen.vagrant.yml" bundle exec kitchen test default-ubuntu-1204
83+
84+
# test on all machines
85+
KITCHEN_YAML=".kitchen.vagrant.yml" bundle exec kitchen test
86+
87+
# for development
88+
KITCHEN_YAML=".kitchen.vagrant.yml" bundle exec kitchen create default-ubuntu-1204
89+
KITCHEN_YAML=".kitchen.vagrant.yml" bundle exec kitchen converge default-ubuntu-1204
90+
```
7491
For more information see [test-kitchen](http://kitchen.ci/docs/getting-started)
7592

7693
## FAQ / Pitfalls

Thorfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

meta/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ galaxy_info:
99
- name: EL
1010
versions:
1111
- 6
12+
- 7
13+
- name: Oracle Linux
14+
versions:
15+
- 6
16+
- 7
1217
- name: Ubuntu
1318
versions:
1419
- precise
1520
- trusty
21+
- xenial
1622
- name: Debian
1723
versions:
18-
- squeeze
1924
- wheezy
2025
- jessie
2126
galaxy_tags:

0 commit comments

Comments
 (0)