inspec 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/CHANGELOG.md +23 -2
- data/Gemfile +1 -1
- data/Rakefile +15 -1
- data/docs/resources.rst +1 -1
- data/examples/profile/controls/gordon.rb +1 -1
- 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/inspec/dsl.rb +17 -17
- data/lib/inspec/metadata.rb +3 -8
- data/lib/inspec/plugins/resource.rb +1 -1
- data/lib/inspec/profile.rb +3 -2
- data/lib/inspec/profile_context.rb +2 -2
- data/lib/inspec/rule.rb +7 -7
- data/lib/inspec/shell.rb +5 -8
- data/lib/inspec/targets/dir.rb +1 -1
- data/lib/inspec/targets/tar.rb +3 -6
- data/lib/inspec/targets/url.rb +15 -9
- data/lib/inspec/targets/url.rb.orig +87 -0
- data/lib/inspec/version.rb +1 -1
- data/lib/matchers/matchers.rb +1 -1
- data/lib/resources/audit_policy.rb +1 -1
- data/lib/resources/command.rb +3 -3
- data/lib/resources/etc_group.rb +1 -1
- data/lib/resources/file.rb +4 -3
- data/lib/resources/group.rb +14 -18
- data/lib/resources/iptables.rb +1 -1
- data/lib/resources/json.rb +4 -6
- data/lib/resources/kernel_parameter.rb +1 -1
- data/lib/resources/os.rb +1 -1
- data/lib/resources/package.rb +20 -2
- data/lib/resources/passwd.rb +1 -1
- data/lib/resources/port.rb +112 -42
- data/lib/resources/postgres_conf.rb +1 -1
- data/lib/resources/postgres_session.rb +2 -2
- data/lib/resources/registry_key.rb +2 -1
- data/lib/resources/security_policy.rb +2 -2
- data/lib/resources/service.rb +50 -1
- data/lib/resources/user.rb +45 -0
- data/lib/resources/yum.rb +2 -2
- data/lib/utils/convert.rb +1 -1
- data/lib/utils/find_files.rb +3 -3
- data/lib/utils/parser.rb +2 -2
- data/tasks/maintainers.rb +6 -6
- data/test/helper.rb +4 -2
- data/test/integration/cookbooks/os_prepare/recipes/file.rb +9 -2
- data/test/integration/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +8 -2
- data/test/integration/test/integration/default/etc_group_spec.rb +22 -0
- data/test/integration/test/integration/default/file_spec.rb +10 -1
- data/test/integration/test/integration/default/group_spec.rb +17 -0
- data/test/integration/test/integration/default/package_spec.rb +10 -4
- data/test/integration/test/integration/default/port_spec.rb +6 -0
- data/test/integration/test/integration/default/service_spec.rb +3 -0
- data/test/integration/test/integration/default/user_spec.rb +26 -16
- data/test/unit/metadata_test.rb +24 -0
- data/test/unit/mock/cmd/lsof-nP-i-FpctPn +63 -0
- data/test/unit/mock/cmd/netstat-tulpen +1 -0
- data/test/unit/mock/cmd/systemctl-show-all-sshd +1 -1
- data/test/unit/mock/profiles/complete-meta/metadata.rb +1 -1
- data/test/unit/mock/profiles/custom-resource/libraries/resource.rb +3 -0
- data/test/unit/mock/profiles/custom-resource/metadata.rb +7 -0
- data/{examples/kitchen-ansible/.kitchen/logs/default-centos-71.log → test/unit/mock/profiles/custom-resource/test/.gitkeep} +0 -0
- data/test/unit/profile_test.rb +6 -2
- data/test/unit/resources/port_test.rb +8 -0
- data/test/unit/targets.rb +132 -0
- metadata +19 -551
- data/bin/os +0 -23
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +0 -432
- data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +0 -10
- data/examples/kitchen-ansible/Gemfile.lock +0 -154
- data/examples/kitchen-chef/.kitchen/default-centos-71.yml +0 -6
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +0 -6
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +0 -6
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +0 -9
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +0 -9
- 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 -4
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +0 -4
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +0 -4
- data/examples/kitchen-chef/.kitchen/logs/kitchen.log +0 -8
- data/examples/kitchen-chef/Berksfile.lock +0 -11
- data/examples/kitchen-chef/Gemfile.lock +0 -223
- data/examples/kitchen-puppet/.bundle/config +0 -2
- 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 -306
- data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +0 -10
- data/examples/kitchen-puppet/.librarian/puppet/config +0 -2
- data/examples/kitchen-puppet/Gemfile.lock +0 -174
- data/examples/kitchen-puppet/Puppetfile.lock +0 -2
- 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/resources/certificate.rb +0 -0
- data/lib/resources/private_key.rb +0 -0
- 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/.DS_Store +0 -0
- data/test/integration/.kitchen.local.yml +0 -68
- data/test/integration/.kitchen/default-aws-linux.yml +0 -4
- data/test/integration/.kitchen/default-centos-511.yml +0 -6
- data/test/integration/.kitchen/default-centos-67.yml +0 -6
- data/test/integration/.kitchen/default-centos-7.yml +0 -4
- data/test/integration/.kitchen/default-centos-71.yml +0 -6
- data/test/integration/.kitchen/default-debian-6010.yml +0 -6
- data/test/integration/.kitchen/default-debian-78.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-21.yml +0 -6
- data/test/integration/.kitchen/default-fedora-22.yml +0 -4
- data/test/integration/.kitchen/default-freebsd-102.yml +0 -6
- data/test/integration/.kitchen/default-freebsd-93.yml +0 -6
- data/test/integration/.kitchen/default-opensuse-132-x86-64.yml +0 -6
- 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-ubuntu-1004.yml +0 -6
- 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-2012.yml +0 -5
- data/test/integration/.kitchen/default-windows-2012r2.yml +0 -6
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/Vagrantfile +0 -9
- 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-fedora-21/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/Vagrantfile +0 -9
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/id +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/Vagrantfile +0 -9
- 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-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-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 +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-2012.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012r2.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 -11
- data/test/integration/TODO.md +0 -15
- 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/integration/test/integration/default/etc_group.rb +0 -13
- 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/unit/mock/cmd/lsof-np-itcp +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec38b70d89c495843d834ff8825ed447419a29fd
|
4
|
+
data.tar.gz: 2d3ef5b473cef4c2c2beb2dfd299e8a964b599bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e4ecc01b3091ef0918a2733d73c455b708de5a34dbc3bb869bb9563bfe4f3360becb2bc80c7c7b331eb57db22223af0d5430f012dd829da1add361643d9266
|
7
|
+
data.tar.gz: 045c295e95f3377e15796011d42fdc3c5b9d82b32073d1476b981cfc0c14d255ac236742e4cf5124e5e134d99f0a87a1bffb453338400337095846e9e4b867e0
|
data/.rubocop.yml
CHANGED
@@ -45,13 +45,17 @@ Style/PredicateName:
|
|
45
45
|
Enabled: false
|
46
46
|
Style/ClassAndModuleChildren:
|
47
47
|
Enabled: false
|
48
|
+
Style/ConditionalAssignment:
|
49
|
+
Enabled: false
|
48
50
|
Style/BracesAroundHashParameters:
|
49
51
|
Enabled: false
|
50
52
|
Style/AndOr:
|
51
53
|
Enabled: false
|
52
54
|
Style/Not:
|
53
55
|
Enabled: false
|
54
|
-
Style/
|
56
|
+
Style/TrailingCommaInLiteral:
|
57
|
+
EnforcedStyleForMultiline: comma
|
58
|
+
Style/TrailingCommaInArguments:
|
55
59
|
EnforcedStyleForMultiline: comma
|
56
60
|
Style/NegatedIf:
|
57
61
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,27 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.9.
|
4
|
-
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.
|
3
|
+
## [0.9.9](https://github.com/chef/inspec/tree/0.9.9) (2016-01-15)
|
4
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.8...0.9.9)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- Resource registry\_key { should\_not exist } unavailable [\#322](https://github.com/chef/inspec/issues/322)
|
9
|
+
- bugfix: only skip regkey if required [\#364](https://github.com/chef/inspec/pull/364) ([chris-rock](https://github.com/chris-rock))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- add tests for loading metadata yaml internals [\#368](https://github.com/chef/inspec/pull/368) ([arlimus](https://github.com/arlimus))
|
14
|
+
- make metadata.rb legacy mode consistent for supports [\#367](https://github.com/chef/inspec/pull/367) ([arlimus](https://github.com/arlimus))
|
15
|
+
- lint with rubocop 0.36 [\#366](https://github.com/chef/inspec/pull/366) ([arlimus](https://github.com/arlimus))
|
16
|
+
- Fix ssh\_config example [\#365](https://github.com/chef/inspec/pull/365) ([tas50](https://github.com/tas50))
|
17
|
+
- Correctly detect UDP ports on linux [\#363](https://github.com/chef/inspec/pull/363) ([mivok](https://github.com/mivok))
|
18
|
+
- Update the title of the gordon-1.0 control [\#359](https://github.com/chef/inspec/pull/359) ([chris-rock](https://github.com/chris-rock))
|
19
|
+
- Inspec::Targets::UrlHelper: fix github handling, add tests [\#357](https://github.com/chef/inspec/pull/357) ([srenatus](https://github.com/srenatus))
|
20
|
+
- Fix systemd service enabled check [\#356](https://github.com/chef/inspec/pull/356) ([jmccann](https://github.com/jmccann))
|
21
|
+
- Adding AIX classes, tests, and targetted ssh testing [\#333](https://github.com/chef/inspec/pull/333) ([foobarbam](https://github.com/foobarbam))
|
22
|
+
|
23
|
+
## [v0.9.8](https://github.com/chef/inspec/tree/v0.9.8) (2016-01-11)
|
24
|
+
[Full Changelog](https://github.com/chef/inspec/compare/v0.9.7...v0.9.8)
|
5
25
|
|
6
26
|
**Implemented enhancements:**
|
7
27
|
|
@@ -29,6 +49,7 @@
|
|
29
49
|
**Merged pull requests:**
|
30
50
|
|
31
51
|
- fix reading profiles bug [\#352](https://github.com/chef/inspec/pull/352) ([srenatus](https://github.com/srenatus))
|
52
|
+
- 0.9.8 [\#350](https://github.com/chef/inspec/pull/350) ([chris-rock](https://github.com/chris-rock))
|
32
53
|
- clarify how to bump version in rake [\#348](https://github.com/chef/inspec/pull/348) ([arlimus](https://github.com/arlimus))
|
33
54
|
- Add `supports` to metadata to specify supported systems [\#344](https://github.com/chef/inspec/pull/344) ([arlimus](https://github.com/arlimus))
|
34
55
|
- Update list of examples [\#340](https://github.com/chef/inspec/pull/340) ([chris-rock](https://github.com/chris-rock))
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -46,6 +46,20 @@ namespace :test do
|
|
46
46
|
path = File.join(File.dirname(__FILE__), 'test', 'integration')
|
47
47
|
sh('sh', '-c', "cd #{path} && bundle exec kitchen test -c #{concurrency} -t .")
|
48
48
|
end
|
49
|
+
|
50
|
+
task :ssh, [:target] do |_t, args|
|
51
|
+
tests_path = File.join(File.dirname(__FILE__), 'test', 'integration', 'test', 'integration', 'default')
|
52
|
+
key_files = ENV['key_files'] || File.join(ENV['HOME'], '.ssh', 'id_rsa')
|
53
|
+
|
54
|
+
sh_cmd = "bin/inspec exec #{tests_path}/"
|
55
|
+
sh_cmd += ENV['test'] ? "#{ENV['test']}_spec.rb" : '*'
|
56
|
+
sh_cmd += " --sudo" unless args[:target].split('@')[0] == 'root'
|
57
|
+
sh_cmd += " -t ssh://#{args[:target]}"
|
58
|
+
sh_cmd += " --key_files=#{key_files}"
|
59
|
+
sh_cmd += " --format=#{ENV['format']}" if ENV['format']
|
60
|
+
|
61
|
+
sh('sh', '-c', sh_cmd)
|
62
|
+
end
|
49
63
|
end
|
50
64
|
|
51
65
|
# Print the current version of this gem or update it.
|
@@ -60,7 +74,7 @@ def inspec_version(target = nil)
|
|
60
74
|
|
61
75
|
unless target.nil?
|
62
76
|
raw = File.read(path)
|
63
|
-
nu = raw.sub(/VERSION.*/, "VERSION = '#{target}'")
|
77
|
+
nu = raw.sub(/VERSION.*/, "VERSION = '#{target}'.freeze")
|
64
78
|
File.write(path, nu)
|
65
79
|
load(path)
|
66
80
|
end
|
data/docs/resources.rst
CHANGED
@@ -3888,7 +3888,7 @@ The following examples show how to use this InSpec audit resource.
|
|
3888
3888
|
|
3889
3889
|
describe ssh_config do
|
3890
3890
|
its('cipher') { should contain '3des' }
|
3891
|
-
its('port') { should '22' }
|
3891
|
+
its('port') { should eq '22' }
|
3892
3892
|
its('hostname') { should include('example.com') }
|
3893
3893
|
end
|
3894
3894
|
|
@@ -12,7 +12,7 @@ title 'Gordon Config Checks'
|
|
12
12
|
# ```
|
13
13
|
control 'gordon-1.0' do
|
14
14
|
impact 0.7
|
15
|
-
title '
|
15
|
+
title 'Verify the version number of Gordon'
|
16
16
|
desc 'An optional description...'
|
17
17
|
describe gordon_config do
|
18
18
|
its('version') { should eq('1.0') }
|
@@ -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
|
data/lib/inspec/dsl.rb
CHANGED
@@ -13,8 +13,21 @@ module Inspec::DSL
|
|
13
13
|
::Inspec::DSL.load_spec_files_for_profile self, id, true, &block
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
alias require_rules require_controls
|
17
|
+
alias include_rules include_controls
|
18
|
+
|
19
|
+
def self.rule_from_check(m, a, b)
|
20
|
+
if a.is_a?(Array) && !a.empty? &&
|
21
|
+
a[0].respond_to?(:resource_skipped) &&
|
22
|
+
!a[0].resource_skipped.nil?
|
23
|
+
::Inspec::Rule.__send__(m, *a) do
|
24
|
+
it a[0].resource_skipped
|
25
|
+
end
|
26
|
+
else
|
27
|
+
# execute the method
|
28
|
+
::Inspec::Rule.__send__(m, *a, &b)
|
29
|
+
end
|
30
|
+
end
|
18
31
|
|
19
32
|
# Register a given rule with RSpec and
|
20
33
|
# let it run. This happens after everything
|
@@ -24,24 +37,11 @@ module Inspec::DSL
|
|
24
37
|
fid = InspecBaseRule.full_id(r, profile_id)
|
25
38
|
checks.each do |m, a, b|
|
26
39
|
# check if the resource is skippable and skipped
|
27
|
-
|
28
|
-
|
29
|
-
!a[0].resource_skipped.nil?
|
30
|
-
cres = ::Inspec::Rule.__send__(m, *a) do
|
31
|
-
it a[0].resource_skipped
|
32
|
-
end
|
33
|
-
else
|
34
|
-
# execute the method
|
35
|
-
cres = ::Inspec::Rule.__send__(m, *a, &b)
|
36
|
-
end
|
37
|
-
if m == 'describe'
|
38
|
-
set_rspec_ids(cres, fid)
|
39
|
-
end
|
40
|
+
cres = rule_from_check(m, a, b)
|
41
|
+
set_rspec_ids(cres, fid) if m == 'describe'
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
|
-
private
|
44
|
-
|
45
45
|
# merge two rules completely; all defined
|
46
46
|
# fields from src will be overwritten in dst
|
47
47
|
def self.merge_rules(dst, src)
|
data/lib/inspec/metadata.rb
CHANGED
@@ -35,14 +35,9 @@ module Inspec
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def supports(sth, version = nil)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
{
|
42
|
-
:'os-name' => sth, # rubocop:disable Style/HashSyntax, Lint/UnneededDisable
|
43
|
-
version: version,
|
44
|
-
},
|
45
|
-
)
|
38
|
+
# Ignore supports with metadata.rb. This file is legacy and the way it
|
39
|
+
# it handles `supports` deprecated. A deprecation warning will be printed
|
40
|
+
# already.
|
46
41
|
end
|
47
42
|
|
48
43
|
def is_supported(os, entry)
|
@@ -22,7 +22,7 @@ module Inspec
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.__register(name, obj)
|
25
|
-
# rubocop:disable Lint/NestedMethodDefinition
|
25
|
+
# rubocop:disable Lint/NestedMethodDefinition, Lint/DuplicateMethods
|
26
26
|
cl = Class.new(obj) do
|
27
27
|
# add some common methods
|
28
28
|
include Inspec::Plugins::ResourceCommon
|
data/lib/inspec/profile.rb
CHANGED
@@ -17,6 +17,7 @@ module Inspec
|
|
17
17
|
|
18
18
|
attr_reader :params
|
19
19
|
attr_reader :path
|
20
|
+
attr_reader :metadata
|
20
21
|
|
21
22
|
def initialize(options = nil)
|
22
23
|
@options = options || {}
|
@@ -104,7 +105,7 @@ module Inspec
|
|
104
105
|
# check if the profile is using the old test directory instead of the
|
105
106
|
# new controls directory
|
106
107
|
if Pathname.new(path).join('test').exist? && !Pathname.new(path).join('controls').exist?
|
107
|
-
warn.call('Profile uses deprecated `test` directory, rename it to `controls
|
108
|
+
warn.call('Profile uses deprecated `test` directory, rename it to `controls`.')
|
108
109
|
end
|
109
110
|
|
110
111
|
count = rules_count
|
@@ -147,7 +148,7 @@ module Inspec
|
|
147
148
|
|
148
149
|
profile_name = @params[:name]
|
149
150
|
|
150
|
-
opts[:zip] ?
|
151
|
+
ext = opts[:zip] ? 'zip' : 'tar.gz'
|
151
152
|
slug = profile_name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '_')
|
152
153
|
archive = Pathname.new(File.dirname(__FILE__)).join('../..', "#{slug}.#{ext}")
|
153
154
|
|
data/lib/inspec/rule.rb
CHANGED
@@ -138,11 +138,11 @@ module Inspec
|
|
138
138
|
rule.instance_variable_set(:@profile_id, profile_id)
|
139
139
|
pid = profile_id
|
140
140
|
end
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
141
|
+
|
142
|
+
# if we don't have a profile id, just return the rule's ID
|
143
|
+
return rid if pid.nil? or pid.empty?
|
144
|
+
# otherwise combine them
|
145
|
+
"#{pid}/#{rid}"
|
146
146
|
end
|
147
147
|
|
148
148
|
private
|
@@ -155,8 +155,8 @@ module Inspec
|
|
155
155
|
def unindent(text)
|
156
156
|
return '' if text.nil?
|
157
157
|
text.strip.split("\n").map(&:strip)
|
158
|
-
|
159
|
-
|
158
|
+
.map { |x| x.empty? ? "\n" : x }
|
159
|
+
.join(' ')
|
160
160
|
end
|
161
161
|
|
162
162
|
# get the rule's source code
|
data/lib/inspec/shell.rb
CHANGED
@@ -89,10 +89,8 @@ You are currently running on:
|
|
89
89
|
EOF
|
90
90
|
elsif resource == 'resources'
|
91
91
|
resources
|
92
|
-
|
93
|
-
|
94
|
-
if !Inspec::Resource.registry[resource].nil?
|
95
|
-
puts <<EOF
|
92
|
+
elsif !Inspec::Resource.registry[resource].nil?
|
93
|
+
puts <<EOF
|
96
94
|
#{mark 'Name:'} #{resource}
|
97
95
|
|
98
96
|
#{mark 'Description:'}
|
@@ -107,10 +105,9 @@ EOF
|
|
107
105
|
https://github.com/chef/inspec/blob/master/docs/resources.rst##{resource}
|
108
106
|
|
109
107
|
EOF
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
end
|
108
|
+
else
|
109
|
+
puts 'Only the following resources are available:'
|
110
|
+
resources
|
114
111
|
end
|
115
112
|
end
|
116
113
|
|
data/lib/inspec/targets/dir.rb
CHANGED
data/lib/inspec/targets/tar.rb
CHANGED
@@ -9,16 +9,13 @@ require 'inspec/targets/archive'
|
|
9
9
|
module Inspec::Targets
|
10
10
|
class TarHelper < ArchiveHelper
|
11
11
|
def handles?(target)
|
12
|
-
File.file?(target)
|
13
|
-
target.end_with?('.tar.gz') ||
|
14
|
-
target.end_with?('.tgz')
|
15
|
-
)
|
12
|
+
File.file?(target) && target.end_with?('.tar.gz', '.tgz')
|
16
13
|
end
|
17
14
|
|
18
15
|
def structure(input)
|
19
16
|
files = []
|
20
17
|
rootdir = ''
|
21
|
-
Gem::Package::TarReader.new(Zlib::GzipReader.open
|
18
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open(input)) do |tar|
|
22
19
|
files = tar.map(&:full_name)
|
23
20
|
end
|
24
21
|
|
@@ -35,7 +32,7 @@ module Inspec::Targets
|
|
35
32
|
|
36
33
|
def content(input, files, rootdir = nil, opts = {})
|
37
34
|
content = []
|
38
|
-
Gem::Package::TarReader.new(Zlib::GzipReader.open
|
35
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open(input)) do |tar|
|
39
36
|
tar.each do |entry|
|
40
37
|
if entry.directory?
|
41
38
|
# nothing to do
|
data/lib/inspec/targets/url.rb
CHANGED
@@ -17,11 +17,12 @@ module Inspec::Targets
|
|
17
17
|
|
18
18
|
def resolve(target, opts = {})
|
19
19
|
# abort if the target does not start with http or https
|
20
|
-
return nil unless target.start_with?
|
20
|
+
return nil unless target.start_with?('https://', 'http://')
|
21
21
|
|
22
|
-
# support for github
|
23
|
-
|
24
|
-
|
22
|
+
# support for github url
|
23
|
+
m = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?$}.match(target)
|
24
|
+
if m
|
25
|
+
url = "https://github.com/#{m[:user]}/#{m[:repo]}/archive/master.tar.gz"
|
25
26
|
else
|
26
27
|
url = target
|
27
28
|
end
|
@@ -29,10 +30,10 @@ module Inspec::Targets
|
|
29
30
|
resolve_zip(url, opts)
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
# download url into archive using opts,
|
34
|
+
# returns File object and content-type from HTTP headers
|
35
|
+
def download_archive(url, archive, opts)
|
34
36
|
archive.binmode
|
35
|
-
|
36
37
|
remote = open(
|
37
38
|
url,
|
38
39
|
http_basic_authentication: [opts['user'] || '', opts['password'] || ''],
|
@@ -43,7 +44,12 @@ module Inspec::Targets
|
|
43
44
|
archive.rewind
|
44
45
|
archive.close
|
45
46
|
|
46
|
-
|
47
|
+
[archive, remote.meta['content-type']]
|
48
|
+
end
|
49
|
+
|
50
|
+
def resolve_zip(url, opts)
|
51
|
+
archive, content_type = download_archive(url, Tempfile.new(['inspec-dl-', '.tar.gz']), opts)
|
52
|
+
|
47
53
|
# replace extension with zip if we detected a zip content type
|
48
54
|
if ['application/x-zip-compressed', 'application/zip'].include?(content_type)
|
49
55
|
# rename file for proper detection in DirHelper
|
@@ -53,8 +59,8 @@ module Inspec::Targets
|
|
53
59
|
|
54
60
|
content = ZipHelper.new.resolve(new_path)
|
55
61
|
File.unlink(new_path)
|
56
|
-
# use tar helper as default
|
57
62
|
elsif ['application/x-gzip', 'application/gzip'].include?(content_type)
|
63
|
+
# use tar helper as default (otherwise returns nil)
|
58
64
|
content = TarHelper.new.resolve(archive.path)
|
59
65
|
archive.unlink
|
60
66
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# author: Dominik Richter
|
3
|
+
# author: Christoph Hartmann
|
4
|
+
|
5
|
+
require 'uri'
|
6
|
+
require 'tempfile'
|
7
|
+
require 'open-uri'
|
8
|
+
require 'inspec/targets/zip'
|
9
|
+
|
10
|
+
module Inspec::Targets
|
11
|
+
class UrlHelper
|
12
|
+
def handles?(target)
|
13
|
+
uri = URI.parse(target)
|
14
|
+
return false if uri.nil? or uri.scheme.nil?
|
15
|
+
%{ http https }.include? uri.scheme
|
16
|
+
end
|
17
|
+
|
18
|
+
def resolve(target, opts = {})
|
19
|
+
# abort if the target does not start with http or https
|
20
|
+
return nil unless target.start_with?('https://', 'http://')
|
21
|
+
|
22
|
+
<<<<<<< a4b7ba89cb8a1c4442908d7a5ca821b2b1617c87
|
23
|
+
# support for github url
|
24
|
+
m = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?$}.match(target)
|
25
|
+
if m
|
26
|
+
url = "https://github.com/#{m[:user]}/#{m[:repo]}/archive/master.tar.gz"
|
27
|
+
else
|
28
|
+
url = target
|
29
|
+
end
|
30
|
+
=======
|
31
|
+
# support for github https url
|
32
|
+
url =
|
33
|
+
if target.start_with? 'https://github.com' and target.end_with? '.git'
|
34
|
+
target.sub(/.git$/, '') + '/archive/master.tar.gz'
|
35
|
+
else
|
36
|
+
target
|
37
|
+
end
|
38
|
+
>>>>>>> lint
|
39
|
+
|
40
|
+
resolve_zip(url, opts)
|
41
|
+
end
|
42
|
+
|
43
|
+
# download url into archive using opts,
|
44
|
+
# returns File object and content-type from HTTP headers
|
45
|
+
def download_archive(url, archive, opts)
|
46
|
+
archive.binmode
|
47
|
+
remote = open(
|
48
|
+
url,
|
49
|
+
http_basic_authentication: [opts['user'] || '', opts['password'] || ''],
|
50
|
+
)
|
51
|
+
|
52
|
+
# download content
|
53
|
+
archive.write(remote.read)
|
54
|
+
archive.rewind
|
55
|
+
archive.close
|
56
|
+
|
57
|
+
[archive, remote.meta['content-type']]
|
58
|
+
end
|
59
|
+
|
60
|
+
def resolve_zip(url, opts)
|
61
|
+
archive, content_type = download_archive(url, Tempfile.new(['inspec-dl-', '.tar.gz']), opts)
|
62
|
+
|
63
|
+
# replace extension with zip if we detected a zip content type
|
64
|
+
if ['application/x-zip-compressed', 'application/zip'].include?(content_type)
|
65
|
+
# rename file for proper detection in DirHelper
|
66
|
+
pn = Pathname.new(archive.path)
|
67
|
+
new_path = pn.dirname.join(pn.basename.to_s.gsub('tar.gz', 'zip'))
|
68
|
+
File.rename(pn.to_s, new_path.to_s)
|
69
|
+
|
70
|
+
content = ZipHelper.new.resolve(new_path)
|
71
|
+
File.unlink(new_path)
|
72
|
+
elsif ['application/x-gzip', 'application/gzip'].include?(content_type)
|
73
|
+
# use tar helper as default (otherwise returns nil)
|
74
|
+
content = TarHelper.new.resolve(archive.path)
|
75
|
+
archive.unlink
|
76
|
+
end
|
77
|
+
|
78
|
+
content
|
79
|
+
end
|
80
|
+
|
81
|
+
def to_s
|
82
|
+
'URL Loader'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
Inspec::Targets.add_module('url', UrlHelper.new)
|
87
|
+
end
|