inspec 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -108,4 +108,33 @@ if os.unix?
|
|
108
108
|
its('type') { should eq :directory }
|
109
109
|
end
|
110
110
|
|
111
|
+
# for server spec compatibility
|
112
|
+
# Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed
|
113
|
+
# in InSpec version 1
|
114
|
+
describe file('/mnt/iso-disk') do
|
115
|
+
it { should be_mounted }
|
116
|
+
it { should be_mounted.with( :type => 'iso9660' ) }
|
117
|
+
it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) }
|
118
|
+
it { should be_mounted.with( :type => 'iso9660', :device => '/root/alpine-3.3.0-x86_64.iso' ) }
|
119
|
+
it { should_not be_mounted.with( :type => 'ext4' ) }
|
120
|
+
it { should_not be_mounted.with( :type => 'xfs' ) }
|
121
|
+
end
|
122
|
+
|
123
|
+
# compare with exact match
|
124
|
+
# also see mount_spec.rb
|
125
|
+
describe file('/mnt/iso-disk') do
|
126
|
+
it { should be_mounted.only_with( {
|
127
|
+
:device=>"/root/alpine-3.3.0-x86_64.iso",
|
128
|
+
:type=>"iso9660",
|
129
|
+
:options=>{
|
130
|
+
:ro=>true}
|
131
|
+
})
|
132
|
+
}
|
133
|
+
end
|
134
|
+
|
135
|
+
elsif os.windows?
|
136
|
+
describe file('C:\\Windows') do
|
137
|
+
it { should exist }
|
138
|
+
it { should be_directory }
|
139
|
+
end
|
111
140
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
if os.unix?
|
4
|
+
filename = '/tmp/example.json'
|
5
|
+
else
|
6
|
+
filename = 'c:/windows/temp/example.json'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe json(filename) do
|
4
10
|
its(['cookbook_locks','omnibus','version']) { should eq('2.2.0') }
|
5
11
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# instead of `.with` or `.only_with` we recommend to use the `mount` resource
|
4
|
+
describe mount '/mnt/iso-disk' do
|
5
|
+
it { should be_mounted }
|
6
|
+
its('count') { should eq 1 }
|
7
|
+
its('device') { should eq '/root/alpine-3.3.0-x86_64.iso' }
|
8
|
+
its('type') { should eq 'iso9660' }
|
9
|
+
its('options') { should eq ['ro'] }
|
10
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
---
|
2
|
+
hostname: 127.0.0.1
|
3
|
+
port: '2205'
|
4
|
+
username: vagrant
|
5
|
+
ssh_key: "/Users/chartmann/Development/vulcano/vulcano-cli/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key"
|
6
|
+
last_action: verify
|
@@ -0,0 +1 @@
|
|
1
|
+
1449613760
|
@@ -0,0 +1 @@
|
|
1
|
+
501
|
@@ -0,0 +1 @@
|
|
1
|
+
0f519e32-868a-4bbb-be75-3e784c785917
|
@@ -0,0 +1 @@
|
|
1
|
+
f66024948ae34585a7b1d6c7e08ba4a1
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEowIBAAKCAQEA1KWrGcypqQFzz4ZFYjHBqk/d4QV9c6JYO9xV7mNWmLknpivT
|
3
|
+
ry976zBqeV923vUvZ2vndMtI+Z7tg5YpsaJCdbNuc078AyjzG+ahVPWrcMLa+hyk
|
4
|
+
VuzLgqyrlWLRc5PcB4JSVVDIVzamarMz9Xo7MOv2KjQBeBSRPQCAWXlrC0zcop5g
|
5
|
+
QGgokclPYF780JGBVTFt00y1AS6ZKUbin+YB9RzuQetixe8QIQfKCrljMJeQ9Ppt
|
6
|
+
bW2Fiyukfg0YAc3SLZnNyrLWtqgLgCkk86jICKr0cZeqeIeZ8Qojo9ERDi5igItg
|
7
|
+
0HP+W2P47k42NUXTZZ8tZ54HmJ/pWsnclJN5WwIDAQABAoIBADzEOujce384Uwfy
|
8
|
+
rtEottcci6NKFld9BQnWJRhCevSZtKLf01Y0k4zaARM+HJIKLsm3JCVUEj6DFAyO
|
9
|
+
VMvWOne4FtAMuieNBCvs9B17Nsq6ZCklFjFg6acmAMJnwsLsdewPacfHlfiWPWgw
|
10
|
+
XaDAlTmdtHLK+cB+4CI2incHI3fOsbfus/EhT9rNrUhw3Zn5/dq0TaEO5amp8QEN
|
11
|
+
/Tblo2LpqEjudqvPO3Yud5WZb1ByFjE1FvPglgrPAsXztInKSHYaURjQ8K6CFNhg
|
12
|
+
ITmqBF5Da9Ha8u9pCTPP6a4/FQkK0JcOuiTgy3EIWTa+Ioqz3VWhX4/qXWgQdyAH
|
13
|
+
74jWh4ECgYEA78k8s3ZtCKoVCgZWDVn6Y1cLiAJkl0bMS4sUMwDCHYaghDa5mXiz
|
14
|
+
CbkIw/3MGPooXMQhwewJxex0LXEFJhHDyvjIP1G2CE0qEOiScOhSTKeEney/50Xe
|
15
|
+
ZC/neay57IlQUNBRfJVokjMTUX40+xahpuS24FKWuv5IbtZcbgek8VkCgYEA4wam
|
16
|
+
FAW574ORmqyfi0FXCZarMmaNQnay3IEDk+NWtg67P+gbz7j6UAmYsqqaVOdaAfOs
|
17
|
+
DQlu/F/8uESaqlgpRdyH+LkKrIUDBJ6E90XoY21KgYhb6Dyq14iVaVyPt2GMP8+C
|
18
|
+
0JtYn2uEPShC4KvzIKw6ywqdCvTqrnRBeiGuVdMCgYBhSnZtnoxo6pG0ypNZwXtd
|
19
|
+
mTDdk5L66kf0Es80Tod0cW5plsbBpX6HYGNVGoIYVE/SK+ZCh6IDg4gz89qR8r1N
|
20
|
+
epnNTzsbrSt3RtY8J5dU8NdXOHs4vFmarvEtpk6d0a0bzRpzATA3ua+J7jpS8oDO
|
21
|
+
dZhZ9kigQJJlHmbMYh+jqQKBgAGEa9u6ZhG5uWFlQfO2ThScUyyVDuCg1nUuz41P
|
22
|
+
eabh1lKJBJaQz+t1BPY8uadTnIBi1oWHyJwbMB8zJi15RV1YKfh5lB6vDOQdAxp7
|
23
|
+
9x+i/Vp8RND6htHF8emwWq2JE1zh0CgAwcje+RVHjZrey1Muk34D5iTKmj7sO/vK
|
24
|
+
+dVNAoGBAIphTIYzt1D73qtagNdp5v4qAs87HviY6Us5PC3Hfewm1zqBofeY/DAw
|
25
|
+
l/6zjmUNPnTvvV6eiFDPvSgoXeKlO7fCY0Jbpr88Izm/jfClSSdRXPHD59ZS8w6Q
|
26
|
+
0xKjdXvfwmxo8xHKheB1tuiHSTPNlq/eSEFEDw7U51L8pcm2Mx7w
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Vagrant.configure("2") do |c|
|
2
|
+
c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf")
|
3
|
+
c.vm.box = "opscode-ubuntu-14.04"
|
4
|
+
c.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
|
5
|
+
c.vm.hostname = "default-ubuntu-1404"
|
6
|
+
c.vm.synced_folder ".", "/vagrant", disabled: true
|
7
|
+
c.vm.provider :virtualbox do |p|
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,3 @@
|
|
1
|
+
I, [2015-12-08T23:48:00.475985 #25801] INFO -- Kitchen: -----> Starting Kitchen (v1.4.2)
|
2
|
+
I, [2015-12-08T23:48:01.367571 #25801] INFO -- Kitchen: -----> Verifying <default-ubuntu-1404>...
|
3
|
+
I, [2015-12-08T23:48:01.990267 #25801] INFO -- Kitchen: -----> Kitchen is finished. (0m1.51s)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe command('find / -name \'.rhosts\' | wc -l ') do
|
6
|
+
its(:stdout) { should match(/^0/) }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe command('find / -name \'hosts.equiv\' | wc -l ') do
|
10
|
+
its(:stdout) { should match(/^0/) }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe file('/etc/shadow') do
|
14
|
+
it { should exist }
|
15
|
+
it { should be_file }
|
16
|
+
it { should be_owned_by 'root' }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe command('echo $PATH | grep -ci \'\.\'') do
|
20
|
+
its(:stdout) { should match(/^0/) }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe file('/etc/login.defs') do
|
24
|
+
its(:content) { should match(/^SU_NAME\s*su/) }
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
if ENV['STANDALONE_SPEC']
|
4
|
+
|
5
|
+
# require 'serverspec'
|
6
|
+
require 'pathname'
|
7
|
+
require 'net/ssh'
|
8
|
+
require 'highline/import'
|
9
|
+
|
10
|
+
set :backend, :ssh
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
|
14
|
+
if ENV['ASK_SUDO_PASSWORD']
|
15
|
+
c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false }
|
16
|
+
else
|
17
|
+
c.sudo_password = ENV['SUDO_PASSWORD']
|
18
|
+
end
|
19
|
+
|
20
|
+
options = {}
|
21
|
+
|
22
|
+
if ENV['ASK_LOGIN_PASSWORD']
|
23
|
+
options[:password] = ask("\nEnter login password: ") { |q| q.echo = false }
|
24
|
+
else
|
25
|
+
options[:password] = ENV['LOGIN_PASSWORD']
|
26
|
+
end
|
27
|
+
|
28
|
+
if ENV['ASK_LOGIN_USERNAME']
|
29
|
+
options[:user] = ask("\nEnter login username: ") { |q| q.echo = false }
|
30
|
+
else
|
31
|
+
options[:user] = ENV['LOGIN_USERNAME'] || ENV['user'] || Etc.getlogin
|
32
|
+
end
|
33
|
+
|
34
|
+
if options[:user].nil?
|
35
|
+
puts 'specify login user env LOGIN_USERNAME= or user='
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
c.host = ENV['TARGET_HOST']
|
40
|
+
c.ssh_options = options.merge(Net::SSH::Config.for(c.host))
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
else
|
45
|
+
# require 'serverspec'
|
46
|
+
#
|
47
|
+
set :backend, :exec
|
48
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
# do we support nested syntax
|
6
|
+
# describe 'IP V4 networking' do
|
7
|
+
|
8
|
+
context linux_kernel_parameter('net.ipv4.ip_forward') do
|
9
|
+
its(:value) { should eq 0 }
|
10
|
+
end
|
11
|
+
|
12
|
+
context linux_kernel_parameter('net.ipv4.conf.all.forwarding') do
|
13
|
+
its(:value) { should eq 0 }
|
14
|
+
end
|
15
|
+
|
16
|
+
# end
|
17
|
+
|
18
|
+
# describe 'ExecShield' do
|
19
|
+
|
20
|
+
# check if we find the nx flag
|
21
|
+
if command('cat /proc/cpuinfo').stdout =~ /^flags.*?:.*? nx( .*?)?$/
|
22
|
+
true
|
23
|
+
else
|
24
|
+
# if no nx flag is present, we require exec-shield
|
25
|
+
context 'No nx flag detected' do
|
26
|
+
it 'require kernel.exec-shield' do
|
27
|
+
context linux_kernel_parameter('kernel.exec-shield') do
|
28
|
+
its(:value) { should eq 1 }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context linux_kernel_parameter('kernel.randomize_va_space') do
|
35
|
+
its(:value) { should eq 2 }
|
36
|
+
end
|
37
|
+
# end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# author: Dominik Richter
|
3
|
+
# author: Christoph Hartmann
|
4
|
+
|
5
|
+
require 'helper'
|
6
|
+
require 'inspec/metadata'
|
7
|
+
|
8
|
+
describe 'metadata with supported operating systems' do
|
9
|
+
describe 'running on ubuntu 14.04' do
|
10
|
+
let (:backend) { MockLoader.new(:ubuntu1404).backend }
|
11
|
+
|
12
|
+
# Description of method
|
13
|
+
#
|
14
|
+
# @param [Type] params describe params
|
15
|
+
# @return [Type] description of returned object
|
16
|
+
def create_meta(params)
|
17
|
+
res = Inspec::Metadata.from_yaml('mock', "---", nil)
|
18
|
+
# manually inject supported parameters
|
19
|
+
res.params[:supports] = params
|
20
|
+
Inspec::Metadata.finalize(res, 'mock')
|
21
|
+
res
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'load a profile with empty supports clause' do
|
25
|
+
m = create_meta(nil)
|
26
|
+
m.supports_transport?(backend).must_equal true
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'loads a profile which supports os ubuntu' do
|
30
|
+
m = create_meta({ 'os' => 'ubuntu' })
|
31
|
+
m.supports_transport?(backend).must_equal true
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'loads a profile which supports os name ubuntu' do
|
35
|
+
m = create_meta({ 'os-name' => 'ubuntu' })
|
36
|
+
m.supports_transport?(backend).must_equal true
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'loads a profile which supports os family linux' do
|
40
|
+
m = create_meta({ 'os-family' => 'linux' })
|
41
|
+
m.supports_transport?(backend).must_equal true
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'loads a profile which supports release 14.04' do
|
45
|
+
m = create_meta({ 'release' => '14.04' })
|
46
|
+
m.supports_transport?(backend).must_equal true
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'rejects a profile which supports release 12.04' do
|
50
|
+
m = create_meta({ 'release' => '12.04' })
|
51
|
+
m.supports_transport?(backend).must_equal false
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'loads a profile which supports ubuntu 14.04' do
|
55
|
+
m = create_meta({ 'os-name' => 'ubuntu', 'release' => '14.04' })
|
56
|
+
m.supports_transport?(backend).must_equal true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'rejects a profile which supports ubuntu 12.04' do
|
60
|
+
m = create_meta({ 'os-name' => 'ubuntu', 'release' => '12.04' })
|
61
|
+
m.supports_transport?(backend).must_equal false
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'reject unsupported os' do
|
65
|
+
m = create_meta({ 'os-name' => 'windows' })
|
66
|
+
m.supports_transport?(backend).must_equal false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/dev/xvda1 on / type ext4 (rw,discard)
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# copyright: 2015, Chef Software, Inc
|
3
|
+
# license: All rights reserved
|
4
|
+
|
5
|
+
title 'Proc Filesystem Configuration'
|
6
|
+
|
7
|
+
control 'test01' do
|
8
|
+
impact 0.5
|
9
|
+
title 'Catchy title'
|
10
|
+
desc '
|
11
|
+
There should always be a /proc
|
12
|
+
'
|
13
|
+
describe file('/proc') do
|
14
|
+
it { should be_mounted }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
name: complete
|
2
|
+
title: complete example profile
|
3
|
+
maintainer: Chef Software, Inc.
|
4
|
+
copyright: Chef Software, Inc.
|
5
|
+
copyright_email: support@chef.io
|
6
|
+
license: Proprietary, All rights reserved
|
7
|
+
summary: Testing stub
|
8
|
+
version: 1.0.0
|
9
|
+
supports:
|
10
|
+
- os-family: linux
|
@@ -34,7 +34,7 @@ describe Inspec::ProfileContext do
|
|
34
34
|
load('describe true do; it { should_eq true }; end')
|
35
35
|
.must_output ''
|
36
36
|
profile.rules.keys.length.must_equal 1
|
37
|
-
profile.rules.keys[0].must_match
|
37
|
+
profile.rules.keys[0].must_match /^\(generated from unknown:1 [0-9a-f]+\)$/
|
38
38
|
profile.rules.values[0].must_be_kind_of Inspec::Rule
|
39
39
|
end
|
40
40
|
|
@@ -43,7 +43,7 @@ describe Inspec::ProfileContext do
|
|
43
43
|
.must_output ''
|
44
44
|
profile.rules.keys.length.must_equal 3
|
45
45
|
[0, 1, 2].each do |i|
|
46
|
-
profile.rules.keys[i].must_match
|
46
|
+
profile.rules.keys[i].must_match /^\(generated from unknown:2 [0-9a-f]+\)$/
|
47
47
|
profile.rules.values[i].must_be_kind_of Inspec::Rule
|
48
48
|
end
|
49
49
|
end
|
data/test/unit/profile_test.rb
CHANGED
@@ -4,11 +4,6 @@
|
|
4
4
|
|
5
5
|
require 'helper'
|
6
6
|
|
7
|
-
def load_profile(name)
|
8
|
-
pwd = File.dirname(__FILE__)
|
9
|
-
Inspec::Profile.from_path("#{pwd}/mock/profiles/#{name}")
|
10
|
-
end
|
11
|
-
|
12
7
|
describe Inspec::Profile do
|
13
8
|
before {
|
14
9
|
# mock up the profile runner
|
@@ -16,13 +11,20 @@ describe Inspec::Profile do
|
|
16
11
|
# currently it's stopped at test runner conflicts
|
17
12
|
class Inspec::Profile::Runner
|
18
13
|
def initialize(opts) end
|
19
|
-
def add_tests(tests) end
|
14
|
+
def add_tests(tests, options=nil) end
|
20
15
|
def rules
|
21
16
|
{}
|
22
17
|
end
|
23
18
|
end
|
24
19
|
}
|
25
20
|
|
21
|
+
let(:logger) { Minitest::Mock.new }
|
22
|
+
let(:home) { File.dirname(__FILE__) }
|
23
|
+
|
24
|
+
def load_profile(name, opts = {})
|
25
|
+
Inspec::Profile.from_path("#{home}/mock/profiles/#{name}", opts)
|
26
|
+
end
|
27
|
+
|
26
28
|
describe 'with empty profile' do
|
27
29
|
let(:profile) { load_profile('empty') }
|
28
30
|
|
@@ -46,4 +48,59 @@ describe Inspec::Profile do
|
|
46
48
|
profile.params[:rules].must_equal({})
|
47
49
|
end
|
48
50
|
end
|
51
|
+
|
52
|
+
describe 'when checking' do
|
53
|
+
describe 'an empty profile' do
|
54
|
+
let(:profile) { load_profile('empty', {logger: logger}) }
|
55
|
+
|
56
|
+
it 'prints loads of warnings' do
|
57
|
+
logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/empty"]
|
58
|
+
logger.expect :warn, nil, ['The use of `metadata.rb` is deprecated. Use `inspec.yml`.']
|
59
|
+
logger.expect :error, nil, ['Missing profile name in metadata.rb']
|
60
|
+
logger.expect :error, nil, ['Missing profile version in metadata.rb']
|
61
|
+
logger.expect :warn, nil, ['Missing profile title in metadata.rb']
|
62
|
+
logger.expect :warn, nil, ['Missing profile summary in metadata.rb']
|
63
|
+
logger.expect :warn, nil, ['Missing profile maintainer in metadata.rb']
|
64
|
+
logger.expect :warn, nil, ['Missing profile copyright in metadata.rb']
|
65
|
+
logger.expect :warn, nil, ['No controls or tests were defined.']
|
66
|
+
|
67
|
+
profile.check
|
68
|
+
logger.verify
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'a complete metadata profile' do
|
73
|
+
let(:profile) { load_profile('complete-meta', {logger: logger}) }
|
74
|
+
|
75
|
+
it 'prints ok messages' do
|
76
|
+
logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/complete-meta"]
|
77
|
+
logger.expect :warn, nil, ['The use of `metadata.rb` is deprecated. Use `inspec.yml`.']
|
78
|
+
logger.expect :info, nil, ['Metadata OK.']
|
79
|
+
logger.expect :warn, nil, ["Profile uses deprecated `test` directory, rename it to `controls`"]
|
80
|
+
logger.expect :warn, nil, ['No controls or tests were defined.']
|
81
|
+
|
82
|
+
profile.check
|
83
|
+
logger.verify
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'a complete metadata profile with controls' do
|
88
|
+
let(:profile) { load_profile('complete-profile', {logger: logger, ignore_supports: true}) }
|
89
|
+
|
90
|
+
it 'prints ok messages and counts the rules' do
|
91
|
+
logger.expect :info, nil, ["Checking profile in #{home}/mock/profiles/complete-profile"]
|
92
|
+
logger.expect :info, nil, ['Metadata OK.']
|
93
|
+
|
94
|
+
# TODO: cannot load rspec in unit tests, therefore we get a loading warn
|
95
|
+
# RSpec does not work with minitest tests
|
96
|
+
logger.expect :warn, nil, ['No controls or tests were defined.']
|
97
|
+
# we expect that this should work:
|
98
|
+
# logger.expect :info, nil, ['Found 1 rules.']
|
99
|
+
# logger.expect :info, nil, ['Rule definitions OK.']
|
100
|
+
|
101
|
+
profile.check
|
102
|
+
logger.verify
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
49
106
|
end
|