This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from dev-sec/docker
use new docker images
- Loading branch information
Showing
9 changed files
with
170 additions
and
88 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 |
---|---|---|
@@ -1,13 +1,3 @@ | ||
README.pdf | ||
README.html | ||
shared_test_repo/ | ||
test/integration | ||
.kitchen | ||
coverage | ||
Vagrantfile.erb | ||
|
||
Gemfile.lock | ||
Berksfile.lock | ||
|
||
ansible.cfg | ||
hosts | ||
Gemfile.lock |
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 |
---|---|---|
@@ -1,21 +1,66 @@ | ||
--- | ||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ | ||
language: python | ||
python: "2.7" | ||
services: docker | ||
|
||
env: | ||
- ANSIBLE_VERSION=latest | ||
- distro: centos6 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: centos7 | ||
init: /usr/lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
version: latest | ||
|
||
- distro: oracle6 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: oracle7 | ||
init: /usr/lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
version: latest | ||
|
||
- distro: ubuntu1604 | ||
version: latest | ||
init: /lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
|
||
- distro: ubuntu1404 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: ubuntu1204 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: debian7 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: debian8 | ||
version: latest | ||
init: /sbin/init | ||
|
||
- distro: debian9 | ||
version: latest | ||
init: /lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
|
||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq python-apt python-pycurl | ||
install: | ||
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi | ||
- echo -e 'localhost ansible_connection=local' > spec/inventory | ||
- echo -e '[defaults]\nroles_path = ../\nhostfile = ./spec/inventory' > ansible.cfg | ||
# Pull container | ||
- 'docker pull rndmh3ro/docker-${distro}-ansible:${version}' | ||
|
||
script: | ||
- ansible-playbook --syntax-check spec/travis.yml | ||
- ansible-playbook --sudo -v --diff spec/travis.yml | ||
- ansible-playbook --sudo -v --diff spec/travis.yml --extra-vars "network_ipv6_enable=true ssh_allow_root_with_key=true ssh_client_password_login=true ssh_client_cbc_required=true ssh_server_weak_hmac=true ssh_client_weak_kex=true sftp_enabled=true" | ||
- container_id=$(mktemp) | ||
# Run container in detached state. | ||
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-ssh-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"' | ||
|
||
# Test role. | ||
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-ssh-hardening/default.yml' | ||
|
||
# Verify role | ||
- 'inspec exec https://github.com/dev-sec/ssh-baseline/ -t docker://$(cat ${container_id})' | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
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,14 @@ | ||
# config file for ansible -- http://ansible.com/ | ||
# ============================================== | ||
|
||
# nearly all parameters can be overridden in ansible-playbook | ||
# or with command line flags. ansible will read ANSIBLE_CONFIG, | ||
# ansible.cfg in the current working directory, .ansible.cfg in | ||
# the home directory or /etc/ansible/ansible.cfg, whichever it | ||
# finds first | ||
|
||
[defaults] | ||
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d by {uid} on {host} | ||
|
||
role_path = /vagrant | ||
scp_if_ssh = True |
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
--- | ||
|
||
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with custom settings | ||
hosts: localhost | ||
roles: | ||
- ansible-ssh-hardening | ||
vars: | ||
network_ipv6_enable: true | ||
ssh_allow_root_with_key: true | ||
ssh_client_password_login: true | ||
ssh_client_cbc_required: true | ||
ssh_server_weak_hmac: true | ||
ssh_client_weak_kex: true | ||
|
||
- name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings | ||
hosts: localhost | ||
pre_tasks: | ||
- package: name="{{item}}" state=installed | ||
with_items: | ||
- "openssh-clients" | ||
- "openssh-server" | ||
ignore_errors: true | ||
- apt: name="{{item}}" state=installed update_cache=true | ||
with_items: | ||
- "openssh-client" | ||
- "openssh-server" | ||
ignore_errors: true | ||
- file: path="/var/run/sshd" state=directory | ||
roles: | ||
- ansible-ssh-hardening |
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,15 @@ | ||
# This is a Vagrant block to allow proxy settings to be carried into Kitchen | ||
# You need this for all of yum/apt etc. to work! | ||
unless ENV['http_proxy'].empty? || Vagrant.has_plugin?("vagrant-proxyconf") | ||
raise "Missing required plugin 'vagrant-proxyconf' to support HTTP(S) proxies, run `vagrant plugin install vagrant-proxyconf`" | ||
end | ||
|
||
Vagrant.configure(2) do |config| | ||
config.proxy.http = "#{ENV['http_proxy']}" | ||
config.proxy.https = "#{ENV['https_proxy']}" | ||
config.proxy.no_proxy = "localhost,127.0.0.1" | ||
|
||
# You may have vagrant-vbguest plugin installed to keep your images up to date | ||
# - but will probably have VBoxAddition build issues with the foreign boxes listed in .kitchen.vagrant.yml | ||
config.vbguest.auto_update = false | ||
end |
This file was deleted.
Oops, something went wrong.