inspec 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -2
- data/Gemfile +1 -0
- data/README.md +21 -2
- data/Rakefile +1 -1
- data/bin/inspec +25 -3
- data/bin/os +23 -0
- data/docs/dsl_resource.rst +90 -0
- data/docs/profiles.rst +167 -0
- data/docs/resources.rst +79 -0
- data/examples/README.md +1 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-centos-71.log +0 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +432 -0
- data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +10 -0
- data/examples/kitchen-ansible/Gemfile.lock +154 -0
- data/examples/kitchen-chef/.kitchen/default-centos-71.yml +6 -0
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +6 -0
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +6 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/kitchen.log +8 -0
- data/examples/kitchen-chef/Berksfile.lock +11 -0
- data/examples/kitchen-chef/Gemfile.lock +223 -0
- data/examples/kitchen-puppet/.bundle/config +2 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +0 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +0 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +306 -0
- data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +10 -0
- data/examples/kitchen-puppet/.librarian/puppet/config +2 -0
- data/examples/kitchen-puppet/Gemfile.lock +174 -0
- data/examples/kitchen-puppet/Puppetfile.lock +2 -0
- data/examples/profile/README.md +30 -0
- data/examples/profile/controls/example.rb +14 -0
- data/examples/profile/controls/gordon.rb +20 -0
- data/examples/profile/inspec.yml +10 -0
- data/examples/profile/libraries/.DS_Store +0 -0
- data/examples/profile/libraries/gordon_config.rb +17 -0
- data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/kitchen.log +5 -0
- data/examples/test-kitchen/Berksfile.lock +11 -0
- data/examples/test-kitchen/Gemfile.lock +233 -0
- data/inspec.gemspec +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/inspec/archive/tar.rb +29 -0
- data/lib/inspec/archive/zip.rb +19 -0
- data/lib/inspec/metadata.rb +110 -15
- data/lib/inspec/profile.rb +88 -19
- data/lib/inspec/profile_context.rb +10 -4
- data/lib/inspec/resource.rb +1 -0
- data/lib/inspec/runner.rb +21 -4
- data/lib/inspec/targets.rb +2 -1
- data/lib/inspec/targets/archive.rb +39 -0
- data/lib/inspec/targets/core.rb +2 -2
- data/lib/inspec/targets/dir.rb +18 -2
- data/lib/inspec/targets/file.rb +4 -0
- data/lib/inspec/targets/folder.rb +21 -11
- data/lib/inspec/targets/tar.rb +36 -5
- data/lib/inspec/targets/url.rb +45 -13
- data/lib/inspec/targets/zip.rb +22 -15
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +30 -0
- data/lib/resources/certificate.rb +0 -0
- data/lib/resources/etc_group.rb +1 -1
- data/lib/resources/file.rb +28 -3
- data/lib/resources/mount.rb +57 -0
- data/lib/resources/passwd.rb +1 -1
- data/lib/resources/private_key.rb +0 -0
- data/lib/resources/user.rb +3 -2
- data/lib/utils/hash.rb +29 -1
- data/lib/utils/parser.rb +34 -1
- data/lib/utils/simpleconfig.rb +1 -1
- data/test/chefdk/.gitignore +16 -0
- data/test/chefdk/.kitchen.yml +27 -0
- data/test/chefdk/Policyfile.rb +16 -0
- data/test/chefdk/README.md +4 -0
- data/test/chefdk/chefignore +100 -0
- data/test/chefdk/metadata.rb +7 -0
- data/test/chefdk/recipes/default.rb +5 -0
- data/test/chefdk/spec/spec_helper.rb +2 -0
- data/test/chefdk/spec/unit/recipes/default_spec.rb +20 -0
- data/test/chefdk/test/integration/default/serverspec/default_spec.rb +9 -0
- data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +8 -0
- data/test/helper.rb +3 -1
- data/test/integration/.DS_Store +0 -0
- data/test/integration/.kitchen.ec2.yml +67 -0
- data/test/integration/.kitchen.local.yml +68 -0
- data/test/integration/.kitchen/default-aws-linux.yml +4 -0
- data/test/integration/.kitchen/default-centos-511.yml +6 -0
- data/test/integration/.kitchen/default-centos-67.yml +6 -0
- data/test/integration/.kitchen/default-centos-7.yml +4 -0
- data/test/integration/.kitchen/default-centos-71.yml +6 -0
- data/test/integration/.kitchen/default-debian-6010.yml +6 -0
- data/test/integration/.kitchen/default-debian-78.yml +6 -0
- data/test/integration/.kitchen/default-debian-8.yml +4 -0
- data/test/integration/.kitchen/default-debian-81.yml +6 -0
- data/test/integration/.kitchen/default-fedora-21.yml +6 -0
- data/test/integration/.kitchen/default-fedora-22.yml +4 -0
- data/test/integration/.kitchen/default-freebsd-102.yml +6 -0
- data/test/integration/.kitchen/default-freebsd-93.yml +6 -0
- data/test/integration/.kitchen/default-opensuse-132-x86-64.yml +6 -0
- data/test/integration/.kitchen/default-redhat-65.yml +4 -0
- data/test/integration/.kitchen/default-redhat-71.yml +4 -0
- data/test/integration/.kitchen/default-suse-11sp3.yml +4 -0
- data/test/integration/.kitchen/default-suse-12.yml +4 -0
- data/test/integration/.kitchen/default-ubuntu-1004.yml +6 -0
- data/test/integration/.kitchen/default-ubuntu-1204.yml +4 -0
- data/test/integration/.kitchen/default-ubuntu-1404.yml +4 -0
- data/test/integration/.kitchen/default-ubuntu-1510.yml +4 -0
- data/test/integration/.kitchen/default-windows-2012.yml +5 -0
- data/test/integration/.kitchen/default-windows-2012r2.yml +6 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +9 -0
- data/test/integration/.kitchen/logs/default-aws-linux.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-511-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-511.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-67-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-67.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-71.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-6010-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-6010.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-78-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-78.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-81-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-81.log +0 -0
- data/test/integration/.kitchen/logs/default-fedora-21-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-fedora-21.log +0 -0
- data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/default-freebsd-102.log +0 -0
- data/test/integration/.kitchen/logs/default-freebsd-93.log +0 -0
- data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
- data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +0 -0
- data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
- data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
- data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
- data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1004.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1204.log +23 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
- data/test/integration/.kitchen/logs/kitchen.log +3 -0
- data/test/integration/.kitchen/logs/new-centos-511-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-511.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-67-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-67.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-71.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-6010-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-6010.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-78-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-78.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-81-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-81.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-21-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-21.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/new-freebsd-102.log +0 -0
- data/test/integration/.kitchen/logs/new-freebsd-93.log +0 -0
- data/test/integration/.kitchen/logs/new-opensuse-132-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-opensuse-132-x86-64.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1004-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1004.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1204-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1204.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1404-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1404.log +3 -0
- data/test/integration/.kitchen/logs/test-centos-511-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-511.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-67-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-67.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-71.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-6010-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-6010.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-78-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-78.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-81-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-81.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-21-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-21.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/test-freebsd-102.log +0 -0
- data/test/integration/.kitchen/logs/test-freebsd-93.log +0 -0
- data/test/integration/.kitchen/logs/test-opensuse-132-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-opensuse-132-x86-64.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1004-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1004.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1204-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1204.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1404-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1404.log +0 -0
- data/test/integration/.kitchen/new-ubuntu-1404.yml +1 -0
- data/test/integration/Berksfile.lock +11 -0
- data/test/integration/TODO.md +15 -0
- data/test/integration/cookbooks/os_prepare/recipes/default.rb +1 -0
- data/test/integration/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +13 -6
- data/test/integration/cookbooks/os_prepare/recipes/mount.rb +29 -0
- data/test/integration/test/.DS_Store +0 -0
- data/test/integration/test/integration/.DS_Store +0 -0
- data/test/integration/test/integration/default/.DS_Store +0 -0
- data/test/integration/test/integration/default/certificate_spec.rb +7 -0
- data/test/integration/test/integration/default/csv_spec.rb +7 -1
- data/test/integration/test/integration/default/file_spec.rb +29 -0
- data/test/integration/test/integration/default/ini_spec.rb +7 -1
- data/test/integration/test/integration/default/json_spec.rb +7 -1
- data/test/integration/test/integration/default/mount_spec.rb +10 -0
- data/test/integration/test/integration/default/yaml_spec.rb +7 -1
- data/test/serverspec/.kitchen.yml +18 -0
- data/test/serverspec/.kitchen/default-ubuntu-1404.yml +6 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +9 -0
- data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +2 -0
- data/test/serverspec/.kitchen/logs/kitchen.log +3 -0
- data/test/serverspec/Berksfile +3 -0
- data/test/serverspec/Berksfile.lock +5 -0
- data/test/serverspec/TODO.md +2 -0
- data/test/serverspec/test/integration/default/serverspec/os_spec.rb +25 -0
- data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +48 -0
- data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +37 -0
- data/test/unit/metadata_test.rb +69 -0
- data/test/unit/mock/cmd/mount +1 -0
- data/test/unit/mock/cmd/mount-multiple +2 -0
- data/test/unit/mock/profiles/complete-meta/metadata.rb +7 -0
- data/test/unit/mock/profiles/complete-meta/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/complete-profile/controls/filesystem_spec.rb +16 -0
- data/test/unit/mock/profiles/complete-profile/inspec.yml +10 -0
- data/test/unit/profile_context_test.rb +2 -2
- data/test/unit/profile_test.rb +63 -6
- data/test/unit/resources/file_test.rb +4 -0
- data/test/unit/resources/mount_test.rb +26 -0
- data/test/unit/utils/{content_parser_test.rb → passwd_parser_test.rb} +2 -2
- metadata +588 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05af717dedcf5fea001060356a73c799927a3ac5
|
|
4
|
+
data.tar.gz: 5fb4a23de7019a3f89d806737758e61ae8dace4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0da77acc1e683f4cef31cb497eecba9052e854555357f030e631e9749ad030bfdca6adf26ef5f1501b1d3789aae1377b6a416833ffc9c7c6baa2e074aae6ecf
|
|
7
|
+
data.tar.gz: 4523247eeb675b640da571394253bd47f7f396a1a500140a280b394fa44472ea7a1b60ef0abfd7a1cb66490bbf15596e1cc104bacbc56b5e433dcd2689251825
|
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## [0.9.
|
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.
|
|
3
|
+
## [0.9.8](https://github.com/chef/inspec/tree/0.9.8) (2016-01-11)
|
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.7...0.9.8)
|
|
5
|
+
|
|
6
|
+
**Implemented enhancements:**
|
|
7
|
+
|
|
8
|
+
- Control Numbers and Display in Compliance GUI [\#306](https://github.com/chef/inspec/issues/306)
|
|
9
|
+
- Support supports for resources [\#282](https://github.com/chef/inspec/issues/282)
|
|
10
|
+
- Unify metadata and collect it from target resolver [\#342](https://github.com/chef/inspec/pull/342) ([arlimus](https://github.com/arlimus))
|
|
11
|
+
- implement `mount` resource [\#341](https://github.com/chef/inspec/pull/341) ([chris-rock](https://github.com/chris-rock))
|
|
12
|
+
- Update Integration Tests [\#314](https://github.com/chef/inspec/pull/314) ([chris-rock](https://github.com/chris-rock))
|
|
13
|
+
- RFC: Compliance Profile Structure [\#252](https://github.com/chef/inspec/pull/252) ([chris-rock](https://github.com/chris-rock))
|
|
14
|
+
|
|
15
|
+
**Fixed bugs:**
|
|
16
|
+
|
|
17
|
+
- Inspec doesn't read controls [\#351](https://github.com/chef/inspec/issues/351)
|
|
18
|
+
- not working under windows, installed from gem [\#323](https://github.com/chef/inspec/issues/323)
|
|
19
|
+
- Resource 'file' missing 'be\_mounted.with' [\#310](https://github.com/chef/inspec/issues/310)
|
|
20
|
+
- `inspec check` on examples generates errors [\#215](https://github.com/chef/inspec/issues/215)
|
|
21
|
+
- bugfix: ignore supports when generating a profile's json representation [\#355](https://github.com/chef/inspec/pull/355) ([srenatus](https://github.com/srenatus))
|
|
22
|
+
- Support old "supports" field in metadata [\#347](https://github.com/chef/inspec/pull/347) ([srenatus](https://github.com/srenatus))
|
|
23
|
+
- Fix custom resource loading from `libraries` [\#337](https://github.com/chef/inspec/pull/337) ([arlimus](https://github.com/arlimus))
|
|
24
|
+
|
|
25
|
+
**Closed issues:**
|
|
26
|
+
|
|
27
|
+
- Create RFC on profile structure [\#296](https://github.com/chef/inspec/issues/296)
|
|
28
|
+
|
|
29
|
+
**Merged pull requests:**
|
|
30
|
+
|
|
31
|
+
- fix reading profiles bug [\#352](https://github.com/chef/inspec/pull/352) ([srenatus](https://github.com/srenatus))
|
|
32
|
+
- clarify how to bump version in rake [\#348](https://github.com/chef/inspec/pull/348) ([arlimus](https://github.com/arlimus))
|
|
33
|
+
- Add `supports` to metadata to specify supported systems [\#344](https://github.com/chef/inspec/pull/344) ([arlimus](https://github.com/arlimus))
|
|
34
|
+
- Update list of examples [\#340](https://github.com/chef/inspec/pull/340) ([chris-rock](https://github.com/chris-rock))
|
|
35
|
+
- add a description for custom resources [\#339](https://github.com/chef/inspec/pull/339) ([arlimus](https://github.com/arlimus))
|
|
36
|
+
- ignore auto-generated controls during verify check [\#332](https://github.com/chef/inspec/pull/332) ([arlimus](https://github.com/arlimus))
|
|
37
|
+
- Set exit status to return value of Inspec Runner [\#331](https://github.com/chef/inspec/pull/331) ([rbhitchcock](https://github.com/rbhitchcock))
|
|
38
|
+
- Verify profile metadata contents correctly [\#330](https://github.com/chef/inspec/pull/330) ([arlimus](https://github.com/arlimus))
|
|
39
|
+
|
|
40
|
+
## [v0.9.7](https://github.com/chef/inspec/tree/v0.9.7) (2015-12-21)
|
|
41
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.6...v0.9.7)
|
|
5
42
|
|
|
6
43
|
**Implemented enhancements:**
|
|
7
44
|
|
|
@@ -22,6 +59,7 @@
|
|
|
22
59
|
|
|
23
60
|
**Merged pull requests:**
|
|
24
61
|
|
|
62
|
+
- 0.9.7 [\#328](https://github.com/chef/inspec/pull/328) ([arlimus](https://github.com/arlimus))
|
|
25
63
|
- remove format default for `inspec exec` [\#326](https://github.com/chef/inspec/pull/326) ([srenatus](https://github.com/srenatus))
|
|
26
64
|
- teach `cmp` matcher octal tricks [\#324](https://github.com/chef/inspec/pull/324) ([srenatus](https://github.com/srenatus))
|
|
27
65
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -214,13 +214,32 @@ You will require:
|
|
|
214
214
|
* vagrant with virtualbox
|
|
215
215
|
* test-kitchen
|
|
216
216
|
|
|
217
|
-
Run `integration` tests with
|
|
217
|
+
**Run `integration` tests with vagrant:**
|
|
218
218
|
|
|
219
219
|
```bash
|
|
220
220
|
cd test/integration
|
|
221
|
-
bundle exec kitchen test
|
|
221
|
+
bundle exec kitchen test
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
+
**Run `integration` tests with AWS EC2:**
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
export AWS_ACCESS_KEY_ID=enteryouryourkey
|
|
228
|
+
export AWS_SECRET_ACCESS_KEY=enteryoursecreykey
|
|
229
|
+
export AWS_SSH_KEY_ID=enteryoursshkeyid
|
|
230
|
+
cd test/integration
|
|
231
|
+
KITCHEN_LOCAL_YAML=.kitchen.ec2.yml bundle exec kitchen test
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
In addition you may need to add your ssh key to `.kitchen.ec2.yml`
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
transport:
|
|
238
|
+
ssh_key: /Users/chartmann/aws/aws_chartmann.pem
|
|
239
|
+
username: ec2-user
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
|
|
224
243
|
### Chef Delivery Tests
|
|
225
244
|
|
|
226
245
|
It may be informative to look at what [tests Chef Delivery](https://github.com/chef/inspec/blob/master/.delivery/build-cookbook/recipes/unit.rb) is running for CI.
|
data/Rakefile
CHANGED
|
@@ -119,7 +119,7 @@ end
|
|
|
119
119
|
desc 'Bump the version of this gem'
|
|
120
120
|
task :bump_version, [:version] do |_, args|
|
|
121
121
|
v = args[:version] || ENV['to']
|
|
122
|
-
fail "You must specify a target version! rake
|
|
122
|
+
fail "You must specify a target version! rake bump_version to=1.2.3" if v.empty?
|
|
123
123
|
check_update_requirements
|
|
124
124
|
inspec_version(v)
|
|
125
125
|
Rake::Task['changelog'].invoke
|
data/bin/inspec
CHANGED
|
@@ -52,8 +52,10 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
|
|
|
52
52
|
def json(path)
|
|
53
53
|
diagnose
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
o = opts.dup
|
|
56
|
+
o[:ignore_supports] = true
|
|
57
|
+
profile = Inspec::Profile.from_path(path, o)
|
|
58
|
+
dst = o[:output].to_s
|
|
57
59
|
if dst.empty?
|
|
58
60
|
puts JSON.pretty_generate(profile.info)
|
|
59
61
|
else
|
|
@@ -73,10 +75,30 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
|
|
|
73
75
|
|
|
74
76
|
o = opts.dup
|
|
75
77
|
o[:logger] = Logger.new(STDOUT)
|
|
78
|
+
o[:ignore_supports] = true # we check for integrity only
|
|
76
79
|
profile = Inspec::Profile.from_path(path, o)
|
|
77
80
|
exit 1 unless profile.check
|
|
78
81
|
end
|
|
79
82
|
|
|
83
|
+
desc 'archive PATH', 'archive a profile to tar.gz (default) or zip'
|
|
84
|
+
option :zip, type: :boolean, default: false,
|
|
85
|
+
desc: 'Generates a zip archive.'
|
|
86
|
+
option :tar, type: :boolean, default: false,
|
|
87
|
+
desc: 'Generates a tar.gz archive.'
|
|
88
|
+
option :overwrite, type: :boolean, default: false,
|
|
89
|
+
desc: 'Overwrite existing archive.'
|
|
90
|
+
option :ignore_errors, type: :boolean, default: false,
|
|
91
|
+
desc: 'Ignore profile warnings.'
|
|
92
|
+
def archive(path)
|
|
93
|
+
diagnose
|
|
94
|
+
|
|
95
|
+
o = options.dup
|
|
96
|
+
o[:logger] = Logger.new(STDOUT)
|
|
97
|
+
profile = Inspec::Profile.from_path(path, o)
|
|
98
|
+
# generate archive
|
|
99
|
+
exit 1 unless profile.archive(opts)
|
|
100
|
+
end
|
|
101
|
+
|
|
80
102
|
desc 'exec PATHS', 'run all test files at the specified PATH.'
|
|
81
103
|
option :id, type: :string,
|
|
82
104
|
desc: 'Attach a profile ID to all test results'
|
|
@@ -87,7 +109,7 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
|
|
|
87
109
|
|
|
88
110
|
runner = Inspec::Runner.new(opts)
|
|
89
111
|
runner.add_tests(tests)
|
|
90
|
-
runner.run
|
|
112
|
+
exit runner.run
|
|
91
113
|
rescue RuntimeError => e
|
|
92
114
|
puts e.message
|
|
93
115
|
end
|
data/bin/os
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
require 'train'
|
|
5
|
+
|
|
6
|
+
train = Train.create('local')
|
|
7
|
+
|
|
8
|
+
# start or reuse a connection
|
|
9
|
+
conn = train.connection
|
|
10
|
+
os = conn.os
|
|
11
|
+
|
|
12
|
+
# get OS info
|
|
13
|
+
conf = {
|
|
14
|
+
name: os[:name],
|
|
15
|
+
family: os[:family],
|
|
16
|
+
release: os[:release],
|
|
17
|
+
arch: os[:arch],
|
|
18
|
+
}
|
|
19
|
+
puts JSON.dump(conf)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# close the connection
|
|
23
|
+
conn.close
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
=====================================================
|
|
2
|
+
Resource DSL
|
|
3
|
+
=====================================================
|
|
4
|
+
|
|
5
|
+
InSpec provides a mechanism for defining custom resources. These become available with their respective names and provide easy functionality to profiles.
|
|
6
|
+
|
|
7
|
+
Resource location
|
|
8
|
+
-----------------------------------------------------
|
|
9
|
+
|
|
10
|
+
Resources may be added to profiles in the `libraries` folder:
|
|
11
|
+
|
|
12
|
+
.. code-block:: bash
|
|
13
|
+
|
|
14
|
+
$ tree examples/profile
|
|
15
|
+
examples/profile
|
|
16
|
+
...
|
|
17
|
+
├── libraries
|
|
18
|
+
│ └── gordon_config.rb
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Resource structure
|
|
22
|
+
-----------------------------------------------------
|
|
23
|
+
|
|
24
|
+
The smallest possible resource takes this form:
|
|
25
|
+
|
|
26
|
+
.. code-block:: ruby
|
|
27
|
+
|
|
28
|
+
class Tiny < Inspec.resource(1)
|
|
29
|
+
name 'tiny'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Resources are written as a regular Ruby `class` which inherits from `Inspec.resource`. The number (`1`) specifies the version this resource plugin targets. As InSpec evolves, this interface may change and may require a higher version.
|
|
33
|
+
|
|
34
|
+
The following attributes can be configured:
|
|
35
|
+
|
|
36
|
+
* `name` - Identifier of the resource (required)
|
|
37
|
+
* `desc` - Description of the resource (optional)
|
|
38
|
+
* `example` - Example usage of the resource (optional)
|
|
39
|
+
|
|
40
|
+
The following methods are available to the resource:
|
|
41
|
+
|
|
42
|
+
* `inspec` - Contains a registry of all other resources to interact with the operating system or target in general.
|
|
43
|
+
* `skip_resource` - A resource may call this method to indicate, that requirements aren't met. All tests that use this resource will be marked as `skipped`.
|
|
44
|
+
|
|
45
|
+
The following example shows a full resource using attributes and methods to provide simple access to a configuration file:
|
|
46
|
+
|
|
47
|
+
.. code-block:: ruby
|
|
48
|
+
|
|
49
|
+
class GordonConfig < Inspec.resource(1)
|
|
50
|
+
name 'gordon_config'
|
|
51
|
+
|
|
52
|
+
desc '
|
|
53
|
+
Resource description ...
|
|
54
|
+
'
|
|
55
|
+
|
|
56
|
+
example '
|
|
57
|
+
describe gordon_config do
|
|
58
|
+
its("signal") { should eq "on" }
|
|
59
|
+
end
|
|
60
|
+
'
|
|
61
|
+
|
|
62
|
+
# Load the configuration file on initialization
|
|
63
|
+
def initialiaze(path = nil)
|
|
64
|
+
@path = path || '/etc/gordon.conf'
|
|
65
|
+
@params = SimpleConfig.new( read_content )
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Expose all parameters of the configuration file.
|
|
69
|
+
def method_missing(name)
|
|
70
|
+
@params[name]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
def read_content
|
|
76
|
+
f = inspec.file(@path)
|
|
77
|
+
# Test if the path exist and that it's a file
|
|
78
|
+
if f.file?
|
|
79
|
+
# Retrieve the file's contents
|
|
80
|
+
f.content
|
|
81
|
+
else
|
|
82
|
+
# If the file doesn't exist, skip all tests that use gordon_config
|
|
83
|
+
skip_resource "Can't read config from #{@path}."
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
For a full example, see our `example resource`_.
|
|
89
|
+
|
|
90
|
+
.. _example resource: ../examples/profile
|
data/docs/profiles.rst
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
=====================================================
|
|
2
|
+
InSpec Profiles
|
|
3
|
+
=====================================================
|
|
4
|
+
|
|
5
|
+
InSpec supports the creation of complex test and compliance profiles, which organize controls to support dependency management and code re-use. These profiles are standalone structures with their own distribution and execution flow.
|
|
6
|
+
|
|
7
|
+
InSpec profile structure
|
|
8
|
+
-----------------------------------------------------
|
|
9
|
+
|
|
10
|
+
To create a new profile just place the files according to the following structure:
|
|
11
|
+
|
|
12
|
+
.. code-block:: bash
|
|
13
|
+
|
|
14
|
+
$ tree examples/profile
|
|
15
|
+
examples/profile
|
|
16
|
+
├── README.md
|
|
17
|
+
├── controls
|
|
18
|
+
│ ├── example.rb
|
|
19
|
+
│ └── gordon.rb
|
|
20
|
+
├── libraries
|
|
21
|
+
│ └── gordon_config.rb
|
|
22
|
+
└── inspec.yml
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* `inspec.yml` - includes the profile description (required)
|
|
26
|
+
* `controls` - a folder which contains all tests (required)
|
|
27
|
+
* `libraries` - a folder which contains InSpec resource extensions (optional)
|
|
28
|
+
* `README.md` - a best-practice readme to each explain the profile and its scope
|
|
29
|
+
|
|
30
|
+
For a full example, see our `example profile`_.
|
|
31
|
+
|
|
32
|
+
.. _example profile: ../examples/profile
|
|
33
|
+
|
|
34
|
+
InSpec profile manifest
|
|
35
|
+
-----------------------------------------------------
|
|
36
|
+
|
|
37
|
+
Each profile has a manifest file `inspec.yml`. It looks as follows
|
|
38
|
+
|
|
39
|
+
.. code-block:: yaml
|
|
40
|
+
|
|
41
|
+
name: ssh
|
|
42
|
+
title: Basic SSH
|
|
43
|
+
maintainer: Chef Software, Inc.
|
|
44
|
+
copyright: Chef Software, Inc.
|
|
45
|
+
copyright_email: support@chef.io
|
|
46
|
+
license: Proprietary, All rights reserved
|
|
47
|
+
summary: Verify that SSH Server and SSH Client are configured securely
|
|
48
|
+
version: 1.0.0
|
|
49
|
+
supports:
|
|
50
|
+
- os-family: linux
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
A manifest description may contain the following values:
|
|
54
|
+
|
|
55
|
+
* `name` - Identifier of the profile (required)
|
|
56
|
+
* `title` - Human-readable name of the profile (optional)
|
|
57
|
+
* `maintainer` - Name of the profile maintainer (optional)
|
|
58
|
+
* `copyright` - Copyright holder (optional)
|
|
59
|
+
* `copyright_email` - Support contact for profile (optional)
|
|
60
|
+
* `license` - License of the profile (optional)
|
|
61
|
+
* `summary` - One-line summary of the profile (optional)
|
|
62
|
+
* `description` - Description of the profile (optional)
|
|
63
|
+
* `version` - Version of the profile (optional)
|
|
64
|
+
* `supports` - A list of supported targets (optional)
|
|
65
|
+
|
|
66
|
+
Supported targets
|
|
67
|
+
-----------------------------------------------------
|
|
68
|
+
|
|
69
|
+
The manifest contains the `supports` flag, which specifies operating systems or even cloud systems that the profile is targeting.
|
|
70
|
+
|
|
71
|
+
This list can contain simple names, names and versions, or detailed flags for the targeted system. These can freely be combined:
|
|
72
|
+
|
|
73
|
+
.. code-block:: yaml
|
|
74
|
+
|
|
75
|
+
name: ssh
|
|
76
|
+
supports:
|
|
77
|
+
// Runs on any version of Debian Linux
|
|
78
|
+
- os-name: debian
|
|
79
|
+
|
|
80
|
+
// Only runs on Ubuntu 14.04
|
|
81
|
+
- os-name: ubuntu
|
|
82
|
+
release: 14.04
|
|
83
|
+
|
|
84
|
+
// Targets RedHat, CentOS, Oracle Linux ...
|
|
85
|
+
- os-family: redhat
|
|
86
|
+
|
|
87
|
+
// Or even broader
|
|
88
|
+
- platform: aws
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
InSpec profile verification
|
|
92
|
+
-----------------------------------------------------
|
|
93
|
+
|
|
94
|
+
InSpec ships with a verification command that verifies the implementation of a profile
|
|
95
|
+
|
|
96
|
+
$ inspec check examples/profile
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
InSpec profile archive
|
|
100
|
+
-----------------------------------------------------
|
|
101
|
+
|
|
102
|
+
Profiles are composed of multiple files. This hinders easy distribution of a profile. InSpec solves the problem by offering to collect all files in one archive.
|
|
103
|
+
|
|
104
|
+
The InSpec profile archive format aims for flexibility and reuse of standard and common technologies:
|
|
105
|
+
|
|
106
|
+
* tar and gzip (default)
|
|
107
|
+
* zip
|
|
108
|
+
* HTTP
|
|
109
|
+
|
|
110
|
+
This should enable third-parties to easily build InSpec profile archives:
|
|
111
|
+
|
|
112
|
+
* InSpec archives MUST be named with the stanard suffix
|
|
113
|
+
* InSpec archives MUST be a tar.gz or zip formatted file
|
|
114
|
+
* InSpec archives MUST have no duplicate entries
|
|
115
|
+
* InSpec archives MAY be compressed with gzip, bzip2, or xz.
|
|
116
|
+
|
|
117
|
+
InSpec is able to create profile archive for you. By default it generates a tar-file on Unix and zip on Windows or Mac.
|
|
118
|
+
|
|
119
|
+
.. code-block:: bash
|
|
120
|
+
|
|
121
|
+
# will generate a example-profile.tar.gz
|
|
122
|
+
$ inspec archive examples/profile
|
|
123
|
+
|
|
124
|
+
# will generate a example-profile.zip
|
|
125
|
+
$ inspec archive examples/profile --zip
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Profile inheritance
|
|
129
|
+
-----------------------------------------------------
|
|
130
|
+
|
|
131
|
+
**Include controls of existing profile**
|
|
132
|
+
|
|
133
|
+
The `include_controls` keyword allows you to import all rules from an existing profile. This can be easily extended with additional rules.
|
|
134
|
+
|
|
135
|
+
.. code-block:: bash
|
|
136
|
+
|
|
137
|
+
include_controls 'cis-level-1' do
|
|
138
|
+
|
|
139
|
+
control "cis-fs-2.7" do
|
|
140
|
+
impact 1.0
|
|
141
|
+
...
|
|
142
|
+
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
**Inherit from a profile, but skip some rules**
|
|
146
|
+
|
|
147
|
+
Sometimes, not all requirements can be fullfiled for a legacy application. To manage the derivation, you can skip certain controls with `skip_control`.
|
|
148
|
+
|
|
149
|
+
.. code-block:: bash
|
|
150
|
+
|
|
151
|
+
include_controls 'cis-level-1' do
|
|
152
|
+
|
|
153
|
+
skip_control "cis-fs-2.1"
|
|
154
|
+
skip_control "cis-fs-2.2"
|
|
155
|
+
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
**Load specific controls from another profile**
|
|
159
|
+
|
|
160
|
+
.. code-block:: bash
|
|
161
|
+
|
|
162
|
+
require_controls 'cis-level-1' do
|
|
163
|
+
|
|
164
|
+
control "cis-fs-2.1"
|
|
165
|
+
control "cis-fs-2.2"
|
|
166
|
+
|
|
167
|
+
end
|