inspec 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -2
- data/Gemfile +6 -0
- data/bin/inspec +5 -1
- data/docs/dsl_inspec.rst +1 -1
- data/docs/resources.rst +39 -2
- data/examples/resource/controls/tiny.rb +3 -0
- data/examples/resource/inspec.yml +10 -0
- data/examples/resource/libraries/tiny.rb +3 -0
- data/lib/bundles/inspec-compliance/cli.rb +1 -1
- data/lib/bundles/inspec-supermarket/README.md +0 -19
- data/lib/bundles/inspec-supermarket/api.rb +46 -22
- data/lib/bundles/inspec-supermarket/cli.rb +13 -18
- data/lib/bundles/inspec-supermarket/target.rb +6 -23
- data/lib/inspec/plugins.rb +4 -4
- data/lib/inspec/plugins/cli.rb +4 -4
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/apache_conf.rb +8 -0
- data/lib/resources/auditd_rules.rb +163 -14
- data/lib/resources/registry_key.rb +5 -5
- data/lib/resources/script.rb +7 -9
- data/lib/utils/filter_array.rb +28 -0
- data/test/helper.rb +5 -2
- data/test/integration/cookbooks/os_prepare/metadata.rb +2 -0
- data/test/integration/cookbooks/os_prepare/recipes/auditctl.rb +8 -0
- data/test/integration/cookbooks/os_prepare/recipes/default.rb +13 -3
- data/test/integration/test/integration/default/apache_conf_spec.rb +15 -0
- data/test/integration/test/integration/default/auditd_rules_spec.rb +32 -0
- data/test/unit/mock/cmd/auditctl +3 -7
- data/test/unit/mock/cmd/auditctl-legacy +7 -0
- data/test/unit/mock/cmd/auditctl-s +8 -0
- data/test/unit/mock/profiles/resource-tiny/inspec.yml +10 -0
- data/test/unit/mock/profiles/resource-tiny/libraries/resource.rb +3 -0
- data/test/unit/plugin_test.rb +5 -6
- data/test/unit/resources/auditd_rules_test.rb +80 -10
- data/test/unit/resources/script_test.rb +5 -1
- data/test/unit/utils/filter_array_test.rb +59 -0
- data/test/unit/{simpleconfig_test.rb → utils/simpleconfig_test.rb} +0 -0
- metadata +25 -542
- data/bin/os +0 -23
- data/examples/kitchen-ansible/.kitchen/default-ubuntu-1404.yml +0 -6
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/Vagrantfile +0 -9
- 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 +0 -395
- data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +0 -3
- data/examples/kitchen-ansible/Gemfile.lock +0 -158
- data/examples/kitchen-ansible/test/.DS_Store +0 -0
- data/examples/kitchen-ansible/test/integration/.DS_Store +0 -0
- data/examples/kitchen-azure/.kitchen.yml +0 -30
- data/examples/kitchen-azure/.kitchen/default-debian-80-20151022-x86-64.yml +0 -1
- data/examples/kitchen-azure/.kitchen/default-ubuntu-1204.yml +0 -9
- data/examples/kitchen-azure/.kitchen/logs/default-debian-80-20151022-x86-64.log +0 -59
- data/examples/kitchen-azure/.kitchen/logs/default-ubuntu-1204.log +0 -27
- data/examples/kitchen-azure/.kitchen/logs/default-windows2012-r2.log +0 -0
- data/examples/kitchen-azure/.kitchen/logs/kitchen.log +0 -29
- data/examples/kitchen-azure/Berksfile +0 -3
- data/examples/kitchen-azure/Gemfile +0 -20
- data/examples/kitchen-azure/Gemfile.lock +0 -273
- data/examples/kitchen-azure/README.md +0 -14
- data/examples/kitchen-azure/credentials.sh +0 -0
- data/examples/kitchen-azure/metadata.rb +0 -7
- data/examples/kitchen-azure/recipes/default.rb +0 -6
- data/examples/kitchen-azure/recipes/nginx.rb +0 -30
- data/examples/kitchen-azure/test/integration/default/web_spec.rb +0 -28
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +0 -6
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +0 -9
- data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +0 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +0 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +0 -3
- data/examples/kitchen-chef/.kitchen/logs/kitchen.log +0 -3
- data/examples/kitchen-chef/Berksfile.lock +0 -11
- data/examples/kitchen-chef/Gemfile.lock +0 -226
- data/examples/kitchen-chef/test/integration/.DS_Store +0 -0
- data/examples/kitchen-puppet/.bundle/config +0 -2
- data/examples/kitchen-puppet/.kitchen/default-ubuntu-1404.yml +0 -6
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/examples/kitchen-puppet/.kitchen/kitchen-vagrant/kitchen-kitchen-puppet-default-ubuntu-1404/Vagrantfile +0 -9
- 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 +0 -305
- data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +0 -6
- data/examples/kitchen-puppet/.librarian/puppet/config +0 -2
- data/examples/kitchen-puppet/Gemfile.lock +0 -175
- data/examples/kitchen-puppet/Puppetfile.lock +0 -2
- data/examples/kitchen-puppet/test/integration/.DS_Store +0 -0
- data/examples/kitchen-puppet/test/integration/default/.DS_Store +0 -0
- data/examples/profile/libraries/.DS_Store +0 -0
- data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +0 -5
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +0 -5
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +0 -5
- data/examples/test-kitchen/.kitchen/logs/kitchen.log +0 -5
- data/examples/test-kitchen/Berksfile.lock +0 -11
- data/examples/test-kitchen/Gemfile.lock +0 -233
- data/lib/.DS_Store +0 -0
- data/lib/bundles/inspec-compliance/TODO.md +0 -4
- data/lib/bundles/inspec-supermarket.rb +0 -14
- data/lib/bundles/inspec-supermarket/TODO.md +0 -5
- data/lib/bundles/inspec-supermarket/cache.rb +0 -30
- data/test/chefdk/.gitignore +0 -16
- data/test/chefdk/.kitchen.yml +0 -27
- data/test/chefdk/Policyfile.rb +0 -16
- data/test/chefdk/README.md +0 -4
- data/test/chefdk/chefignore +0 -100
- data/test/chefdk/metadata.rb +0 -7
- data/test/chefdk/recipes/default.rb +0 -5
- data/test/chefdk/spec/spec_helper.rb +0 -2
- data/test/chefdk/spec/unit/recipes/default_spec.rb +0 -20
- data/test/chefdk/test/integration/default/serverspec/default_spec.rb +0 -9
- data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +0 -8
- data/test/integration/.kitchen.chef.yml +0 -29
- data/test/integration/.kitchen.shell.yml +0 -19
- data/test/integration/.kitchen/default-aws-linux.yml +0 -4
- data/test/integration/.kitchen/default-centos-7.yml +0 -4
- data/test/integration/.kitchen/default-chef-solaris-1011.yml +0 -6
- data/test/integration/.kitchen/default-chef-solaris-113.yml +0 -6
- data/test/integration/.kitchen/default-chef-windows-server-2008r2-standard.yml +0 -7
- data/test/integration/.kitchen/default-chris-rock-omnios-r151014.yml +0 -6
- data/test/integration/.kitchen/default-debian-8.yml +0 -4
- data/test/integration/.kitchen/default-debian-81.yml +0 -6
- data/test/integration/.kitchen/default-fedora-22.yml +0 -4
- data/test/integration/.kitchen/default-omniti-omnios-r151014.yml +0 -1
- data/test/integration/.kitchen/default-redhat-65.yml +0 -4
- data/test/integration/.kitchen/default-redhat-71.yml +0 -4
- data/test/integration/.kitchen/default-suse-11sp3.yml +0 -4
- data/test/integration/.kitchen/default-suse-12.yml +0 -4
- data/test/integration/.kitchen/default-suse-hi11sp3.yml +0 -4
- data/test/integration/.kitchen/default-ubuntu-1204.yml +0 -4
- data/test/integration/.kitchen/default-ubuntu-1404.yml +0 -4
- data/test/integration/.kitchen/default-ubuntu-1510.yml +0 -4
- data/test/integration/.kitchen/default-windows-2008.yml +0 -5
- data/test/integration/.kitchen/default-windows-2012.yml +0 -1
- data/test/integration/.kitchen/default-windows-2012r2.yml +0 -6
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-1011/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-solaris-113/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chef-windows-server-2008r2-standard/Vagrantfile +0 -7
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-chris-rock-omnios-r151014/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-omniti-omnios-r151014/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/Vagrantfile +0 -8
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +0 -9
- 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-chef-solaris-1011.log +0 -0
- data/test/integration/.kitchen/logs/default-chef-solaris-113.log +0 -0
- data/test/integration/.kitchen/logs/default-chef-windows-server-2008r2-standard.log +0 -43
- data/test/integration/.kitchen/logs/default-chef-windows-server-2012r2-standard.log +0 -0
- data/test/integration/.kitchen/logs/default-chris-rock-omnios-r151014.log +0 -41
- 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 -240
- data/test/integration/.kitchen/logs/default-dusank-oi-server.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-livinginthepast-smartos-base64.log +0 -0
- data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
- data/test/integration/.kitchen/logs/default-modernIE-w10-edge.log +0 -2
- data/test/integration/.kitchen/logs/default-modernIE-w7-ie11.log +0 -2
- data/test/integration/.kitchen/logs/default-modernIE-w81-ie11.log +0 -2
- data/test/integration/.kitchen/logs/default-omniti-omnios-r151014.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-opentable-win-2008r2-standard-amd64-nocm.log +0 -0
- data/test/integration/.kitchen/logs/default-opentable-win-2012r2-standard-amd64-nocm.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-suse-hi11sp3.log +0 -37
- 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 +0 -23
- 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-2008-opentable.log +0 -2
- data/test/integration/.kitchen/logs/default-windows-2008.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012R2-matt.log +0 -2
- data/test/integration/.kitchen/logs/default-windows-2012r2-opentable.log +0 -2
- data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
- data/test/integration/.kitchen/logs/default-winrm.log +0 -0
- data/test/integration/.kitchen/logs/kitchen.log +0 -3
- 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 +0 -3
- 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 +0 -1
- data/test/integration/Berksfile.lock +0 -27
- data/test/integration/TODO.md +0 -15
- data/test/integration/bootstrap.sh +0 -3
- 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 +0 -7
- data/test/mac/service_spec.rb +0 -5
- data/test/serverspec/.kitchen.yml +0 -18
- data/test/serverspec/.kitchen/default-ubuntu-1404.yml +0 -6
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +0 -9
- data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +0 -2
- data/test/serverspec/.kitchen/logs/kitchen.log +0 -3
- data/test/serverspec/Berksfile +0 -3
- data/test/serverspec/Berksfile.lock +0 -5
- data/test/serverspec/TODO.md +0 -2
- data/test/serverspec/test/integration/default/serverspec/os_spec.rb +0 -25
- data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +0 -48
- data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +0 -37
- data/test/solaris_test.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70a0c204211c2bd4a689aff2790fe23999a5013a
|
4
|
+
data.tar.gz: ee648ad90d3d80a6f2cd4f2c18207d39916a6b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c71d588c6547180d6f54e769c1580dc88d98634cc7100583e6723ea172014fb1f3feb7471791cbd9429b112bda7dbba840564e6ea65ec61faf36427847ca92e2
|
7
|
+
data.tar.gz: 0d5750125ca6c6cce5ab69a001726dc7663ae95b2269cf8a162ff9e08037ae64ca3607a220af7ae11f47b2c623b3f17b99da92ebabd8650481ae6916b5286a18
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,43 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v0.10.
|
3
|
+
## [0.11.0](https://github.com/chef/inspec/tree/0.11.0) (2016-02-09)
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.10.1...0.11.0)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- Improve apache resource [\#407](https://github.com/chef/inspec/pull/407) ([chris-rock](https://github.com/chris-rock))
|
9
|
+
- auditd\_rules rework [\#400](https://github.com/chef/inspec/pull/400) ([srenatus](https://github.com/srenatus))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- File stats are not always working properly [\#430](https://github.com/chef/inspec/issues/430)
|
14
|
+
- Integration test for apache config [\#406](https://github.com/chef/inspec/issues/406)
|
15
|
+
- rework auditd\_rules resource [\#312](https://github.com/chef/inspec/issues/312)
|
16
|
+
- resource/auditd\_rules: update rule list format [\#309](https://github.com/chef/inspec/issues/309)
|
5
17
|
|
6
18
|
**Merged pull requests:**
|
7
19
|
|
20
|
+
- Fix supermarket cli registration [\#441](https://github.com/chef/inspec/pull/441) ([chris-rock](https://github.com/chris-rock))
|
21
|
+
- update to winrm 1.6.1 command scheme [\#439](https://github.com/chef/inspec/pull/439) ([arlimus](https://github.com/arlimus))
|
22
|
+
- semantics: rename CLI plugins registry -\> commands [\#435](https://github.com/chef/inspec/pull/435) ([arlimus](https://github.com/arlimus))
|
23
|
+
- avoid automatic plugin loading via library [\#434](https://github.com/chef/inspec/pull/434) ([arlimus](https://github.com/arlimus))
|
24
|
+
- clarify the role of the plugin API at the moment [\#433](https://github.com/chef/inspec/pull/433) ([arlimus](https://github.com/arlimus))
|
25
|
+
- Implement Supermarket Extension [\#432](https://github.com/chef/inspec/pull/432) ([chris-rock](https://github.com/chris-rock))
|
26
|
+
- dedup Gemfiles [\#429](https://github.com/chef/inspec/pull/429) ([srenatus](https://github.com/srenatus))
|
27
|
+
- fix loading order of plugins [\#428](https://github.com/chef/inspec/pull/428) ([arlimus](https://github.com/arlimus))
|
28
|
+
- Update dsl\_inspec.rst [\#427](https://github.com/chef/inspec/pull/427) ([GeoFruck](https://github.com/GeoFruck))
|
29
|
+
|
30
|
+
## [v0.10.1](https://github.com/chef/inspec/tree/v0.10.1) (2016-02-05)
|
31
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.10.0...v0.10.1)
|
32
|
+
|
33
|
+
**Fixed bugs:**
|
34
|
+
|
8
35
|
- wrap basecli in inspec module [\#425](https://github.com/chef/inspec/pull/425) ([arlimus](https://github.com/arlimus))
|
9
36
|
|
37
|
+
**Merged pull requests:**
|
38
|
+
|
39
|
+
- 0.10.1 [\#426](https://github.com/chef/inspec/pull/426) ([chris-rock](https://github.com/chris-rock))
|
40
|
+
|
10
41
|
## [v0.10.0](https://github.com/chef/inspec/tree/v0.10.0) (2016-02-05)
|
11
42
|
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.11...v0.10.0)
|
12
43
|
|
data/Gemfile
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
source 'https://rubygems.org'
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
# pin dependency for Ruby 1.9.3 since bundler is not
|
6
|
+
# detecting that net-ssh 3 does not work with 1.9.3
|
7
|
+
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.9.3')
|
8
|
+
gem 'net-ssh', '~> 2.9'
|
9
|
+
end
|
10
|
+
|
5
11
|
group :test do
|
6
12
|
gem 'bundler', '~> 1.5'
|
7
13
|
gem 'minitest', '~> 5.5'
|
data/bin/inspec
CHANGED
@@ -142,8 +142,12 @@ class Inspec::InspecCLI < Inspec::BaseCLI # rubocop:disable Metrics/ClassLength
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
# Load all plugins on startup
|
146
|
+
ctl = Inspec::PluginCtl.new
|
147
|
+
ctl.list.each { |x| ctl.load(x) }
|
148
|
+
|
145
149
|
# load CLI plugins before the Inspec CLI has been started
|
146
|
-
Inspec::Plugins::CLI.
|
150
|
+
Inspec::Plugins::CLI.subcommands.each { |_subcommand, params|
|
147
151
|
Inspec::InspecCLI.register(
|
148
152
|
params[:klass],
|
149
153
|
params[:subcommand_name],
|
data/docs/dsl_inspec.rst
CHANGED
@@ -11,7 +11,7 @@ The following sections describe the syntax and show some simple examples of usin
|
|
11
11
|
Syntax
|
12
12
|
=====================================================
|
13
13
|
|
14
|
-
The following resource tests |ssh| server configuration. For example, a simple control may
|
14
|
+
The following resource tests |ssh| server configuration. For example, a simple control may described as:
|
15
15
|
|
16
16
|
.. code-block:: ruby
|
17
17
|
|
data/docs/resources.rst
CHANGED
@@ -306,12 +306,14 @@ The following examples show how to use this InSpec audit resource.
|
|
306
306
|
|
307
307
|
auditd_rules
|
308
308
|
=====================================================
|
309
|
-
Use the ``auditd_rules`` |inspec resource| to test the rules for logging that exist on the system. The ``audit.rules`` file is typically located under ``/etc/audit/`` and contains the list of rules that define what is captured in log files.
|
309
|
+
Use the ``auditd_rules`` |inspec resource| to test the rules for logging that exist on the system. The ``audit.rules`` file is typically located under ``/etc/audit/`` and contains the list of rules that define what is captured in log files. This resource uses `auditctl` to query the _run-time_ auditd rules setup (which may divert from `audit.rules`).
|
310
310
|
|
311
311
|
**Stability: Experimental**
|
312
312
|
|
313
313
|
Syntax
|
314
314
|
-----------------------------------------------------
|
315
|
+
A change in the output format (with an `audit` package version 2.3 or newer) is reflected in two interfaces included in `auditd_rules`:
|
316
|
+
|
315
317
|
A ``auditd_rules`` |inspec resource| block declares one (or more) rules to be tested, and then what that rule should do:
|
316
318
|
|
317
319
|
.. code-block:: ruby
|
@@ -342,7 +344,7 @@ or test that individual rules are defined:
|
|
342
344
|
|
343
345
|
where each test
|
344
346
|
|
345
|
-
*
|
347
|
+
* must declare one (or more) rules to be tested
|
346
348
|
|
347
349
|
Examples
|
348
350
|
-----------------------------------------------------
|
@@ -352,12 +354,47 @@ The following examples show how to use this InSpec audit resource.
|
|
352
354
|
|
353
355
|
.. code-block:: ruby
|
354
356
|
|
357
|
+
# syntax for audit < 2.3
|
355
358
|
describe audit_daemon_rules do
|
356
359
|
its("LIST_RULES") {
|
357
360
|
should contain_match(/^exit,always arch=.* key=time-change syscall=adjtimex,settimeofday/)
|
358
361
|
}
|
359
362
|
end
|
360
363
|
|
364
|
+
# syntax for auditd >= 2.3
|
365
|
+
describe auditd_rules do
|
366
|
+
its(:lines) { should contain_match(%r{-w /etc/ssh/sshd_config/}) }
|
367
|
+
end
|
368
|
+
|
369
|
+
The syntax for recent auditd versions allows more precise tests, such as the following:
|
370
|
+
|
371
|
+
**Query the audit daemon status.**
|
372
|
+
|
373
|
+
.. code-block:: ruby
|
374
|
+
|
375
|
+
describe auditd_rules.status('backlog') do
|
376
|
+
it { should cmp 0 }
|
377
|
+
end
|
378
|
+
|
379
|
+
**Query properties of rules targeting specific syscalls or files.**
|
380
|
+
|
381
|
+
.. code-block:: ruby
|
382
|
+
|
383
|
+
describe auditd_rules.syscall('open').action do
|
384
|
+
it { should eq(['always']) }
|
385
|
+
end
|
386
|
+
|
387
|
+
describe auditd_rules.key('sshd_config') do
|
388
|
+
its(:permissions) { should contain_match(/x/) }
|
389
|
+
end
|
390
|
+
|
391
|
+
Note that filters can be chained, for example:
|
392
|
+
|
393
|
+
.. code-block:: ruby
|
394
|
+
|
395
|
+
describe auditd_rules.syscall('open').action('always').list do
|
396
|
+
it { should eq(['exit']) }
|
397
|
+
end
|
361
398
|
|
362
399
|
|
363
400
|
bond
|
@@ -0,0 +1,10 @@
|
|
1
|
+
name: resource
|
2
|
+
title: InSpec Example Resources
|
3
|
+
maintainer: Chef Software, Inc.
|
4
|
+
copyright: Chef Software, Inc.
|
5
|
+
copyright_email: support@chef.io
|
6
|
+
license: Apache 2 license
|
7
|
+
summary: Demonstrates the use of InSpec custom resources
|
8
|
+
version: 1.0.0
|
9
|
+
supports:
|
10
|
+
- linux
|
@@ -142,5 +142,5 @@ module Compliance
|
|
142
142
|
end
|
143
143
|
|
144
144
|
# register the subcommand to Inspec CLI registry
|
145
|
-
Inspec::Plugins::CLI.
|
145
|
+
Inspec::Plugins::CLI.add_subcommand(ComplianceCLI, 'compliance', 'compliance SUBCOMMAND ...', 'Chef Compliance commands', {})
|
146
146
|
end
|
@@ -10,22 +10,3 @@ To use the CLI, this InSpec add-on adds the following commands:
|
|
10
10
|
|
11
11
|
- via supermarket exec: `inspec supermarket exec nathenharvey/tmp-compliance-profile`
|
12
12
|
- via supermarket scheme: `inspec exec supermarket://nathenharvey/tmp-compliance-profile`
|
13
|
-
|
14
|
-
|
15
|
-
# fetch all available profiles in local cache
|
16
|
-
# https://supermarket.chef.io/api/v1/tools-search\?q\=compliance_profile
|
17
|
-
|
18
|
-
# get the tool slug url
|
19
|
-
# https://supermarket.chef.io/api/v1/tools/tmp-compliance-profile
|
20
|
-
# https://supermarket.chef.io/api/v1/tools/tmp_compliance_profile
|
21
|
-
# response
|
22
|
-
# {
|
23
|
-
# "description": "An InSpec compliance profile for use with Chef Compliance Server.\r\n",
|
24
|
-
# "instructions": "## Installation\r\n\r\nDownload the [latest release](https://github.com/nathenharvey/tmp_compliance_profile/releases) from GitHub and upload the tar.gz to your Chef Compliance Server.\r\n\r\n## Controls Included\r\n\r\n* tmp-1.0 - A /tmp directory must exist\r\n* tmp-1.1 - The /tmp directory must be owned by the root user\r\n\r\n## License & Authors\r\n\r\n*Author:* Nathen Harvey\r\n\r\n*Copyright:* 2015-2016, Chef Software, Inc.\r\n\r\n Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n",
|
25
|
-
# "name": "/tmp Compliance Profile",
|
26
|
-
# "owner": "nathenharvey",
|
27
|
-
# "slug": "tmp-compliance-profile",
|
28
|
-
# "source_url": "https://github.com/nathenharvey/tmp_compliance_profile/",
|
29
|
-
# "type": "compliance_profile",
|
30
|
-
# "up_for_adoption": false
|
31
|
-
# }
|
@@ -4,36 +4,65 @@
|
|
4
4
|
|
5
5
|
module Supermarket
|
6
6
|
class API
|
7
|
+
SUPERMARKET_URL = 'https://supermarket.chef.io'.freeze
|
8
|
+
|
9
|
+
def self.supermarket_url
|
10
|
+
SUPERMARKET_URL
|
11
|
+
end
|
12
|
+
|
13
|
+
# displays a list of profiles
|
7
14
|
def self.profiles
|
8
|
-
url =
|
9
|
-
data = get(url, { :
|
15
|
+
url = "#{SUPERMARKET_URL}/api/v1/tools-search"
|
16
|
+
_success, data = get(url, { q: 'compliance_profile' })
|
10
17
|
if !data.nil?
|
11
18
|
profiles = JSON.parse(data)
|
12
19
|
profiles['items']
|
13
|
-
# val = []
|
14
|
-
# # iterate over profiles
|
15
|
-
# profiles.each_key { |org|
|
16
|
-
# profiles[org].each_key { |name|
|
17
|
-
# val.push({ org: org, name: name})
|
18
|
-
# }
|
19
|
-
# }
|
20
|
-
# val
|
21
20
|
else
|
22
21
|
[]
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
def self.
|
27
|
-
|
28
|
-
|
25
|
+
def self.profile_name(profile)
|
26
|
+
uri = URI(profile)
|
27
|
+
[uri.host, uri.path[1..-1]]
|
28
|
+
rescue URI::Error => _e
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# displays profile infos
|
33
|
+
def self.info(profile)
|
34
|
+
_tool_owner, tool_name = profile_name("supermarket://#{profile}")
|
35
|
+
url = "#{SUPERMARKET_URL}/api/v1/tools/#{tool_name}"
|
36
|
+
_success, data = get(url, {})
|
29
37
|
if !data.nil?
|
30
|
-
|
38
|
+
JSON.parse(data)
|
31
39
|
else
|
32
40
|
{}
|
33
41
|
end
|
42
|
+
rescue JSON::ParserError
|
43
|
+
{}
|
34
44
|
end
|
35
45
|
|
36
|
-
|
46
|
+
# compares a profile with the supermarket tool info
|
47
|
+
def self.same?(profile, supermarket_tool)
|
48
|
+
tool_owner, tool_name = profile_name(profile)
|
49
|
+
tool = "#{SUPERMARKET_URL}/api/v1/tools/#{tool_name}"
|
50
|
+
supermarket_tool['tool_owner'] == tool_owner && supermarket_tool['tool'] == tool
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.find(profile)
|
54
|
+
profiles = Supermarket::API.profiles
|
55
|
+
if !profiles.empty?
|
56
|
+
index = profiles.index { |t| same?(profile, t) }
|
57
|
+
# return profile or nil
|
58
|
+
profiles[index] if !index.nil? && index >= 0
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# verifies that a profile exists
|
63
|
+
def self.exist?(profile)
|
64
|
+
!find(profile).nil?
|
65
|
+
end
|
37
66
|
|
38
67
|
def self.get(url, params)
|
39
68
|
uri = URI.parse(url)
|
@@ -44,15 +73,10 @@ module Supermarket
|
|
44
73
|
|
45
74
|
def self.send_request(uri, req)
|
46
75
|
# send request
|
47
|
-
res = Net::HTTP.start(uri.host, uri.port, :
|
76
|
+
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') {|http|
|
48
77
|
http.request(req)
|
49
78
|
}
|
50
|
-
|
51
|
-
res.body
|
52
|
-
else
|
53
|
-
puts res.body
|
54
|
-
nil
|
55
|
-
end
|
79
|
+
[res.is_a?(Net::HTTPSuccess), res.body]
|
56
80
|
end
|
57
81
|
end
|
58
82
|
end
|
@@ -6,17 +6,15 @@ module Supermarket
|
|
6
6
|
class SupermarketCLI < Inspec::BaseCLI
|
7
7
|
namespace 'supermarket'
|
8
8
|
|
9
|
-
desc 'configure SERVER', 'Changes the default supermarket https://supermarket.chef.io/api/v1/'
|
10
|
-
def configure(server)
|
11
|
-
end
|
12
|
-
|
13
9
|
desc 'profiles', 'list all available profiles in Chef Supermarket'
|
14
10
|
def profiles
|
15
|
-
# display profiles in format
|
11
|
+
# display profiles in format user/profile
|
16
12
|
supermarket_profiles = Supermarket::API.profiles
|
13
|
+
|
14
|
+
headline('Available profiles:')
|
17
15
|
supermarket_profiles.each { |p|
|
18
|
-
m = %r{
|
19
|
-
|
16
|
+
m = %r{^#{Supermarket::API.supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(p['tool'])
|
17
|
+
li("#{p['tool_owner']}/#{m[:slug]}")
|
20
18
|
}
|
21
19
|
end
|
22
20
|
|
@@ -36,19 +34,16 @@ module Supermarket
|
|
36
34
|
|
37
35
|
desc 'info profile', 'display profile details'
|
38
36
|
def info(profile)
|
39
|
-
|
40
|
-
|
41
|
-
#
|
42
|
-
#
|
43
|
-
|
44
|
-
puts
|
45
|
-
puts "
|
46
|
-
puts "url: #{info['source_url']}"
|
47
|
-
puts "\n"
|
48
|
-
puts "description:\n#{info['description']}"
|
37
|
+
info = Supermarket::API.info(profile)
|
38
|
+
|
39
|
+
puts "#{mark_text('name: ')} #{info['slug']}"
|
40
|
+
puts "#{mark_text('owner:')} #{info['owner']}"
|
41
|
+
puts "#{mark_text('url: ')} #{info['source_url']}"
|
42
|
+
puts
|
43
|
+
puts "#{mark_text('description: ')} #{info['description']}"
|
49
44
|
end
|
50
45
|
end
|
51
46
|
|
52
47
|
# register the subcommand to Inspec CLI registry
|
53
|
-
Inspec::Plugins::CLI.
|
48
|
+
Inspec::Plugins::CLI.add_subcommand(Supermarket::SupermarketCLI, 'supermarket', 'supermarket SUBCOMMAND ...', 'Supermarket commands', {})
|
54
49
|
end
|
@@ -10,34 +10,17 @@ module Supermarket
|
|
10
10
|
def handles?(profile)
|
11
11
|
# check for local scheme supermarket://
|
12
12
|
return unless URI(profile).scheme == 'supermarket'
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
# verifies that the target e.g base/ssh exists
|
15
|
+
Supermarket::API.exist?(profile)
|
16
|
+
rescue URI::Error => _e
|
16
17
|
false
|
17
18
|
end
|
18
19
|
|
19
20
|
# generates proper url
|
20
21
|
def resolve(profile, opts = {})
|
21
|
-
|
22
|
-
|
23
|
-
super(target, opts)
|
24
|
-
end
|
25
|
-
|
26
|
-
# extracts profile name from url
|
27
|
-
def get_profile_name(uri)
|
28
|
-
uri.host + uri.path
|
29
|
-
end
|
30
|
-
|
31
|
-
def build_target_url(target)
|
32
|
-
|
33
|
-
# read details from json
|
34
|
-
# extracts github url
|
35
|
-
|
36
|
-
supermarket, slug = target.split('/')
|
37
|
-
# search profile with slug
|
38
|
-
# get github url
|
39
|
-
# return github url
|
40
|
-
"https://github.com/nathenharvey/tmp_compliance_profile/"
|
22
|
+
tool_info = Supermarket::API.find(profile)
|
23
|
+
super(tool_info['tool_source_url'], opts)
|
41
24
|
end
|
42
25
|
|
43
26
|
def to_s
|
data/lib/inspec/plugins.rb
CHANGED
@@ -11,6 +11,10 @@ module Inspec
|
|
11
11
|
autoload :CLI, 'inspec/plugins/cli'
|
12
12
|
end
|
13
13
|
|
14
|
+
# PLEASE NOTE: The Plugin system is an internal mechanism for connecting
|
15
|
+
# inspec components. Its API is currently considered in an alpha state
|
16
|
+
# and may change between minor version revisions. A stable plugin API will be
|
17
|
+
# released in the future.
|
14
18
|
class PluginCtl
|
15
19
|
extend Forwardable
|
16
20
|
|
@@ -44,7 +48,3 @@ module Inspec
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
47
|
-
|
48
|
-
# Load all plugins on startup
|
49
|
-
ctl = Inspec::PluginCtl.new
|
50
|
-
ctl.list.each { |x| ctl.load(x) }
|
data/lib/inspec/plugins/cli.rb
CHANGED
@@ -6,12 +6,12 @@ module Inspec
|
|
6
6
|
module Plugins
|
7
7
|
# stores all CLI plugin, we expect those to the `Thor` subclasses
|
8
8
|
class CLI
|
9
|
-
def self.
|
10
|
-
@
|
9
|
+
def self.subcommands
|
10
|
+
@subcommands ||= {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.
|
14
|
-
|
13
|
+
def self.add_subcommand(klass, subcommand_name, usage, description, options = {})
|
14
|
+
subcommands[subcommand_name] = {
|
15
15
|
klass: klass,
|
16
16
|
subcommand_name: subcommand_name,
|
17
17
|
usage: usage,
|