-
Notifications
You must be signed in to change notification settings - Fork 59
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 #57 from chef-cookbooks/chris-rock/example
test-kitchen example for Chef Compliance direct reporting
- Loading branch information
Showing
8 changed files
with
142 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
driver: | ||
name: vagrant | ||
|
||
provisioner: | ||
name: chef_zero | ||
|
||
verifier: | ||
name: inspec | ||
sudo: true | ||
|
||
platforms: | ||
- name: bento/centos-7.2 | ||
- name: bento/ubuntu-14.04 | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[os-hardening] | ||
- recipe[ssh-hardening] | ||
- recipe[audit::default] | ||
attributes: | ||
audit: | ||
server: <%= ENV['COMPLIANCE_API'] %> | ||
token: <%= ENV['COMPLIANCE_ACCESSTOKEN'] %> | ||
owner: admin | ||
profiles: | ||
base/linux: true | ||
brewinc/ssh-hardening: | ||
source: supermarket://hardening/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,25 @@ | ||
--- | ||
driver: | ||
name: vagrant | ||
|
||
provisioner: | ||
name: chef_zero | ||
|
||
verifier: | ||
name: inspec | ||
sudo: true | ||
|
||
platforms: | ||
- name: windows-2012r2 | ||
|
||
suites: | ||
- name: windows | ||
run_list: | ||
- recipe[audit::default] | ||
attributes: | ||
audit: | ||
server: <%= ENV['COMPLIANCE_API'] %> | ||
token: <%= ENV['COMPLIANCE_ACCESSTOKEN'] %> | ||
owner: admin | ||
profiles: | ||
base/windows: 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# encoding: utf-8 | ||
source 'https://supermarket.chef.io' | ||
|
||
cookbook 'os-hardening', git: 'https://github.com/dev-sec/chef-os-hardening.git' | ||
cookbook 'ssh-hardening', git: 'https://github.com/dev-sec/chef-ssh-hardening.git' | ||
cookbook 'audit', path: '../../' |
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,7 @@ | ||
# encoding: utf-8 | ||
source 'https://rubygems.org' | ||
|
||
gem 'berkshelf', '~> 3.3.0' | ||
gem 'test-kitchen', '~> 1.6' | ||
gem 'kitchen-vagrant' | ||
gem 'kitchen-inspec', '~> 0.9' |
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,59 @@ | ||
# Example: Test-Kitchen | ||
|
||
This example demonstrates the usage of the audit cookbook with test-kitchen. In order to use it, we expect to have `COMPLIANCE_API` and `COMPLIANCE_ACCESSTOKEN` available as environment variables. | ||
|
||
``` | ||
export COMPLIANCE_API='https://compliance.test/api/' | ||
export COMPLIANCE_ACCESSTOKEN='eyJh..GTA' | ||
``` | ||
|
||
## Converge Linux | ||
|
||
``` | ||
$ KITCHEN_YAML=.kitchen.linux.yml kitchen list | ||
Instance Driver Provisioner Verifier Transport Last Action | ||
default-bento-centos-72 Vagrant ChefZero Inspec Ssh <Not Created> | ||
default-bento-ubuntu-1404 Vagrant ChefZero Inspec Ssh <Not Created> | ||
$ KITCHEN_YAML=.kitchen.linux.yml kitchen converge | ||
-----> Starting Kitchen (v1.8.0) | ||
-----> Converging <default-bento-centos-72>... | ||
... | ||
-----> Converging <default-bento-ubuntu-1404> | ||
... | ||
-----> Kitchen is finished. (0m35.94s) | ||
# destroy the instances | ||
$ KITCHEN_YAML=.kitchen.linux.yml kitchen destroy | ||
``` | ||
|
||
## Converge Windows | ||
|
||
``` | ||
$ KITCHEN_YAML=.kitchen.win.yml kitchen list | ||
Instance Driver Provisioner Verifier Transport Last Action | ||
windows-windows-2012r2 Vagrant ChefZero Inspec Winrm <Not Created> | ||
$ KITCHEN_YAML=.kitchen.win.yml kitchen kitchen converge | ||
-----> Starting Kitchen (v1.8.0) | ||
-----> Converging <windows-2012r2> | ||
... | ||
-----> Kitchen is finished. (0m35.94s) | ||
# destroy the instances | ||
$ KITCHEN_YAML=.kitchen.win.yml kitchen destroy | ||
``` | ||
|
||
|
||
Now, the node reports are available in Chef Compliance: | ||
|
||
![Chef Compliance Reports](cc_report.png "Chef Compliance Reports") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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