inspec 0.30.0 → 0.31.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 +50 -2
- data/Gemfile +2 -1
- data/docs/cli.rst +1 -17
- data/docs/resources.rst +128 -0
- data/docs/shell.rst +130 -0
- data/inspec.gemspec +3 -4
- data/lib/bundles/inspec-compliance/.kitchen.yml +0 -1
- data/lib/bundles/inspec-compliance/README.md +8 -3
- data/lib/bundles/inspec-compliance/api.rb +21 -6
- data/lib/bundles/inspec-compliance/bootstrap.sh +13 -9
- data/lib/bundles/inspec-compliance/cli.rb +23 -19
- data/lib/bundles/inspec-compliance/target.rb +1 -0
- data/lib/bundles/inspec-compliance/test/integration/default/cli.rb +42 -5
- data/lib/bundles/inspec-init/cli.rb +9 -0
- data/lib/bundles/inspec-supermarket/cli.rb +9 -0
- data/lib/bundles/inspec-supermarket/target.rb +2 -1
- data/lib/fetchers/local.rb +5 -2
- data/lib/fetchers/url.rb +1 -0
- data/lib/inspec/base_cli.rb +2 -1
- data/lib/inspec/cli.rb +14 -5
- data/lib/inspec/dependencies/dependency_set.rb +38 -0
- data/lib/inspec/dependencies/requirement.rb +103 -0
- data/lib/inspec/{dependencies.rb → dependencies/resolver.rb} +13 -132
- data/lib/inspec/dependencies/vendor_index.rb +98 -0
- data/lib/inspec/plugins/source_reader.rb +4 -0
- data/lib/inspec/profile.rb +2 -2
- data/lib/inspec/resource.rb +2 -0
- data/lib/inspec/runner.rb +13 -1
- data/lib/inspec/runner_mock.rb +4 -0
- data/lib/inspec/runner_rspec.rb +6 -2
- data/lib/inspec/shell.rb +22 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/resources/iis_site.rb +107 -0
- data/lib/resources/port.rb +11 -4
- data/lib/resources/ssh_conf.rb +10 -2
- data/lib/resources/ssl.rb +94 -0
- data/lib/resources/xinetd.rb +11 -2
- data/lib/utils/parser.rb +6 -1
- metadata +17 -561
- data/lib/utils/hash_map.rb +0 -37
- data/tasks/maintainers.rb +0 -213
- data/test/bench/startup/startup.flat.txt +0 -1005
- data/test/bench/startup/startup.graph.html +0 -71958
- data/test/bench/startup/startup.grind.dat +0 -101602
- data/test/bench/startup/startup.stack.html +0 -24516
- data/test/bench/startup.flat.txt +0 -998
- data/test/bench/startup.graph.html +0 -71420
- data/test/bench/startup.grind.dat +0 -103554
- data/test/bench/startup.stack.html +0 -25015
- data/test/cookbooks/os_prepare/attributes/default.rb +0 -2
- data/test/cookbooks/os_prepare/files/empty.iso +0 -0
- data/test/cookbooks/os_prepare/files/example.csv +0 -7
- data/test/cookbooks/os_prepare/files/example.ini +0 -6
- data/test/cookbooks/os_prepare/files/example.json +0 -12
- data/test/cookbooks/os_prepare/files/example.yml +0 -7
- data/test/cookbooks/os_prepare/metadata.rb +0 -13
- data/test/cookbooks/os_prepare/recipes/_runit_service_centos.rb +0 -34
- data/test/cookbooks/os_prepare/recipes/_upstart_service_centos.rb +0 -25
- data/test/cookbooks/os_prepare/recipes/apache.rb +0 -14
- data/test/cookbooks/os_prepare/recipes/apt.rb +0 -20
- data/test/cookbooks/os_prepare/recipes/auditctl.rb +0 -8
- data/test/cookbooks/os_prepare/recipes/default.rb +0 -29
- data/test/cookbooks/os_prepare/recipes/file.rb +0 -46
- data/test/cookbooks/os_prepare/recipes/iptables.rb +0 -13
- data/test/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +0 -34
- data/test/cookbooks/os_prepare/recipes/mount.rb +0 -33
- data/test/cookbooks/os_prepare/recipes/package.rb +0 -25
- data/test/cookbooks/os_prepare/recipes/postgres.rb +0 -20
- data/test/cookbooks/os_prepare/recipes/prep_container.rb +0 -15
- data/test/cookbooks/os_prepare/recipes/registry_key.rb +0 -87
- data/test/cookbooks/os_prepare/recipes/service.rb +0 -19
- data/test/cookbooks/os_prepare/templates/default/sv-default-svlog-run.erb +0 -2
- data/test/docker_run.rb +0 -162
- data/test/docker_test.rb +0 -58
- data/test/functional/helper.rb +0 -37
- data/test/functional/inheritance_test.rb +0 -62
- data/test/functional/inspec_archive_test.rb +0 -80
- data/test/functional/inspec_compliance_test.rb +0 -61
- data/test/functional/inspec_exec_json_test.rb +0 -122
- data/test/functional/inspec_exec_jsonmin_test.rb +0 -59
- data/test/functional/inspec_exec_test.rb +0 -123
- data/test/functional/inspec_json_profile_test.rb +0 -103
- data/test/functional/inspec_test.rb +0 -91
- data/test/helper.rb +0 -329
- data/test/integration/default/_debug_spec.rb +0 -8
- data/test/integration/default/apache_conf_spec.rb +0 -21
- data/test/integration/default/apt_spec.rb +0 -37
- data/test/integration/default/auditd_rules_spec.rb +0 -32
- data/test/integration/default/cmp_matcher_spec.rb +0 -115
- data/test/integration/default/csv_spec.rb +0 -11
- data/test/integration/default/etc_group_spec.rb +0 -29
- data/test/integration/default/file_spec.rb +0 -195
- data/test/integration/default/group_spec.rb +0 -59
- data/test/integration/default/ini_spec.rb +0 -11
- data/test/integration/default/iptables_spec.rb +0 -29
- data/test/integration/default/json_spec.rb +0 -11
- data/test/integration/default/kernel_module_spec.rb +0 -23
- data/test/integration/default/kernel_parameter_spec.rb +0 -60
- data/test/integration/default/mount_spec.rb +0 -19
- data/test/integration/default/os_spec.rb +0 -13
- data/test/integration/default/package_spec.rb +0 -30
- data/test/integration/default/port_spec.rb +0 -27
- data/test/integration/default/postgres_session_spec.rb +0 -13
- data/test/integration/default/powershell_spec.rb +0 -42
- data/test/integration/default/registry_key_spec.rb +0 -109
- data/test/integration/default/secpol_spec.rb +0 -11
- data/test/integration/default/service_spec.rb +0 -128
- data/test/integration/default/user_spec.rb +0 -96
- data/test/integration/default/vbscript_spec.rb +0 -22
- data/test/integration/default/wmi_spec.rb +0 -66
- data/test/integration/default/yaml_spec.rb +0 -11
- data/test/resource/command_test.rb +0 -33
- data/test/resource/dsl_test.rb +0 -45
- data/test/resource/file_test.rb +0 -146
- data/test/resource/ssh_config.rb +0 -9
- data/test/resource/sshd_config.rb +0 -9
- data/test/test-extra.yaml +0 -11
- data/test/test.yaml +0 -11
- data/test/unit/control_test.rb +0 -58
- data/test/unit/fetchers/local_test.rb +0 -67
- data/test/unit/fetchers/mock_test.rb +0 -43
- data/test/unit/fetchers/tar_test.rb +0 -36
- data/test/unit/fetchers/url_test.rb +0 -152
- data/test/unit/fetchers/zip_test.rb +0 -36
- data/test/unit/fetchers_test.rb +0 -65
- data/test/unit/metadata_test.rb +0 -137
- data/test/unit/mock/cmd/$env-PATH +0 -1
- data/test/unit/mock/cmd/Get-NetAdapter +0 -24
- data/test/unit/mock/cmd/GetUserAccount +0 -33
- data/test/unit/mock/cmd/GetWin32Group +0 -23
- data/test/unit/mock/cmd/Resolve-DnsName +0 -26
- data/test/unit/mock/cmd/Test-NetConnection +0 -4
- data/test/unit/mock/cmd/auditctl +0 -3
- data/test/unit/mock/cmd/auditctl-legacy +0 -7
- data/test/unit/mock/cmd/auditctl-s +0 -8
- data/test/unit/mock/cmd/auditpol +0 -2
- data/test/unit/mock/cmd/brew-info-jq +0 -1
- data/test/unit/mock/cmd/chage-l-root +0 -7
- data/test/unit/mock/cmd/dpkg-s-curl +0 -21
- data/test/unit/mock/cmd/dscl +0 -5
- data/test/unit/mock/cmd/env +0 -1
- data/test/unit/mock/cmd/etc-apt +0 -7
- data/test/unit/mock/cmd/find-apache2-conf-enabled +0 -1
- data/test/unit/mock/cmd/find-apache2-ports-conf +0 -1
- data/test/unit/mock/cmd/find-etc-rc-d-name-S +0 -12
- data/test/unit/mock/cmd/find-net-interface +0 -9
- data/test/unit/mock/cmd/find-xinetd.d +0 -2
- data/test/unit/mock/cmd/gem-list-local-a-q-rubocop +0 -1
- data/test/unit/mock/cmd/get-net-tcpconnection +0 -24
- data/test/unit/mock/cmd/get-netadapter-binding-bridge +0 -4
- data/test/unit/mock/cmd/get-package-firefox +0 -30
- data/test/unit/mock/cmd/get-package-ruby +0 -18
- data/test/unit/mock/cmd/get-service-dhcp +0 -10
- data/test/unit/mock/cmd/get-windows-feature +0 -7
- data/test/unit/mock/cmd/get-wmiobject +0 -9
- data/test/unit/mock/cmd/getent-hosts-example.com +0 -1
- data/test/unit/mock/cmd/getent-passwd-jfolmer +0 -1
- data/test/unit/mock/cmd/getent-passwd-root +0 -1
- data/test/unit/mock/cmd/hpux-netstat-inet +0 -10
- data/test/unit/mock/cmd/hpux-netstat-inet6 +0 -11
- data/test/unit/mock/cmd/id-chartmann +0 -1
- data/test/unit/mock/cmd/id-jfolmer +0 -1
- data/test/unit/mock/cmd/id-root +0 -1
- data/test/unit/mock/cmd/initctl--version +0 -5
- data/test/unit/mock/cmd/initctl-show-config-ssh +0 -3
- data/test/unit/mock/cmd/initctl-status-ssh +0 -1
- data/test/unit/mock/cmd/iptables-s +0 -6
- data/test/unit/mock/cmd/launchctl-list +0 -3
- data/test/unit/mock/cmd/logins-x +0 -4
- data/test/unit/mock/cmd/ls-1-etc-init.d +0 -2
- data/test/unit/mock/cmd/ls-sys-class-net-br +0 -2
- data/test/unit/mock/cmd/lsmod +0 -2
- data/test/unit/mock/cmd/lsof-nP-i-FpctPn +0 -63
- data/test/unit/mock/cmd/mount +0 -1
- data/test/unit/mock/cmd/mount-multiple +0 -2
- data/test/unit/mock/cmd/netstat-an.utf8 +0 -13
- data/test/unit/mock/cmd/netstat-tulpen +0 -6
- data/test/unit/mock/cmd/npm-ls-g--json-bower +0 -9
- data/test/unit/mock/cmd/pacman-qi-curl +0 -21
- data/test/unit/mock/cmd/ping-example.com +0 -6
- data/test/unit/mock/cmd/pip-show-jinja2 +0 -11
- data/test/unit/mock/cmd/pkg-info-system-file-system-zfs +0 -8
- data/test/unit/mock/cmd/pkginfo-l-SUNWzfsr +0 -7
- data/test/unit/mock/cmd/ps-aux +0 -5
- data/test/unit/mock/cmd/ps-auxZ +0 -3
- data/test/unit/mock/cmd/pw-usershow-root-7 +0 -1
- data/test/unit/mock/cmd/reg_schedule +0 -6
- data/test/unit/mock/cmd/rpm-qia-curl +0 -24
- data/test/unit/mock/cmd/s11-netstat-an-finet-finet6 +0 -32
- data/test/unit/mock/cmd/sbin_sysctl +0 -1
- data/test/unit/mock/cmd/secedit-export +0 -7
- data/test/unit/mock/cmd/service-e +0 -2
- data/test/unit/mock/cmd/service-sendmail-onestatus +0 -3
- data/test/unit/mock/cmd/service-sshd-status +0 -1
- data/test/unit/mock/cmd/sockstat +0 -5
- data/test/unit/mock/cmd/success +0 -0
- data/test/unit/mock/cmd/swlist-l-product +0 -1
- data/test/unit/mock/cmd/systemctl-show-all-dbus +0 -6
- data/test/unit/mock/cmd/systemctl-show-all-sshd +0 -7
- data/test/unit/mock/cmd/win32_product +0 -8
- data/test/unit/mock/cmd/yum-repolist-all +0 -52
- data/test/unit/mock/files/apache2.conf +0 -14
- data/test/unit/mock/files/auditd.conf +0 -4
- data/test/unit/mock/files/bond0 +0 -37
- data/test/unit/mock/files/etcgroup +0 -3
- data/test/unit/mock/files/example.csv +0 -6
- data/test/unit/mock/files/grub.conf +0 -21
- data/test/unit/mock/files/inetd.conf +0 -2
- data/test/unit/mock/files/kitchen.yml +0 -7
- data/test/unit/mock/files/limits.conf +0 -5
- data/test/unit/mock/files/login.defs +0 -5
- data/test/unit/mock/files/mysql.conf +0 -8
- data/test/unit/mock/files/mysql2.conf +0 -2
- data/test/unit/mock/files/ntp.conf +0 -5
- data/test/unit/mock/files/passwd +0 -2
- data/test/unit/mock/files/policyfile.lock.json +0 -12
- data/test/unit/mock/files/ports.conf +0 -6
- data/test/unit/mock/files/rootwrap.conf +0 -7
- data/test/unit/mock/files/serve-cgi-bin.conf +0 -20
- data/test/unit/mock/files/shadow +0 -2
- data/test/unit/mock/files/ssh_config +0 -5
- data/test/unit/mock/files/sshd_config +0 -7
- data/test/unit/mock/files/sysctl.conf +0 -7
- data/test/unit/mock/files/xinetd.conf +0 -9
- data/test/unit/mock/files/xinetd.d/.gitkeep +0 -0
- data/test/unit/mock/files/xinetd.d_chargen-dgram +0 -9
- data/test/unit/mock/files/xinetd.d_chargen-stream +0 -9
- data/test/unit/mock/profiles/complete-metadata/inspec.yml +0 -7
- data/test/unit/mock/profiles/complete-profile/controls/filesystem_spec.rb +0 -16
- data/test/unit/mock/profiles/complete-profile/inspec.yml +0 -10
- data/test/unit/mock/profiles/complete-profile/libraries/testlib.rb +0 -1
- data/test/unit/mock/profiles/empty-metadata/inspec.yml +0 -0
- data/test/unit/mock/profiles/legacy-complete-metadata/metadata.rb +0 -7
- data/test/unit/mock/profiles/legacy-complete-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/controls/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/metadata.rb +0 -0
- data/test/unit/mock/profiles/legacy-simple-metadata/metadata.rb +0 -1
- data/test/unit/mock/profiles/legacy-simple-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/library/controls/filesystem_spec.rb +0 -7
- data/test/unit/mock/profiles/library/inspec.yml +0 -10
- data/test/unit/mock/profiles/library/libraries/gordonlib.rb +0 -2
- data/test/unit/mock/profiles/library/libraries/testlib.rb +0 -12
- data/test/unit/mock/profiles/resource-tiny/inspec.yml +0 -10
- data/test/unit/mock/profiles/resource-tiny/libraries/resource.rb +0 -3
- data/test/unit/mock/profiles/simple-metadata/inspec.yml +0 -1
- data/test/unit/mock/profiles/skippy-profile-os/controls/one.rb +0 -3
- data/test/unit/mock/profiles/skippy-profile-os/inspec.yml +0 -5
- data/test/unit/mock/profiles/spec_only/specfile.rb +0 -11
- data/test/unit/mock/profiles/supported_inspec/inspec.yml +0 -2
- data/test/unit/mock/profiles/unsupported_inspec/inspec.yml +0 -2
- data/test/unit/objects_test.rb +0 -65
- data/test/unit/plugin_test.rb +0 -44
- data/test/unit/plugins/resource_test.rb +0 -60
- data/test/unit/profile_context_test.rb +0 -345
- data/test/unit/profile_test.rb +0 -252
- data/test/unit/resources/apache_conf_test.rb +0 -31
- data/test/unit/resources/apt_test.rb +0 -46
- data/test/unit/resources/audit_policy_test.rb +0 -13
- data/test/unit/resources/auditd_conf_test.rb +0 -15
- data/test/unit/resources/auditd_rules_test.rb +0 -91
- data/test/unit/resources/bash_test.rb +0 -29
- data/test/unit/resources/bond_test.rb +0 -24
- data/test/unit/resources/bridge_test.rb +0 -56
- data/test/unit/resources/csv_test.rb +0 -35
- data/test/unit/resources/etc_group_test.rb +0 -37
- data/test/unit/resources/file_test.rb +0 -202
- data/test/unit/resources/gem_test.rb +0 -20
- data/test/unit/resources/group_test.rb +0 -96
- data/test/unit/resources/grub_conf_test.rb +0 -29
- data/test/unit/resources/host_test.rb +0 -38
- data/test/unit/resources/inetd_conf_test.rb +0 -15
- data/test/unit/resources/ini_test.rb +0 -16
- data/test/unit/resources/interface_test.rb +0 -54
- data/test/unit/resources/iptables_test.rb +0 -35
- data/test/unit/resources/json_test.rb +0 -36
- data/test/unit/resources/kernel_module_test.rb +0 -23
- data/test/unit/resources/kernel_parameter_test.rb +0 -13
- data/test/unit/resources/limits_conf_test.rb +0 -14
- data/test/unit/resources/login_def_test.rb +0 -16
- data/test/unit/resources/mount_test.rb +0 -26
- data/test/unit/resources/mysql_conf_test.rb +0 -14
- data/test/unit/resources/npm_test.rb +0 -20
- data/test/unit/resources/ntp_conf_test.rb +0 -16
- data/test/unit/resources/oneget_test.rb +0 -45
- data/test/unit/resources/os_env_test.rb +0 -18
- data/test/unit/resources/os_test.rb +0 -40
- data/test/unit/resources/package_test.rb +0 -87
- data/test/unit/resources/parse_config_test.rb +0 -26
- data/test/unit/resources/passwd_test.rb +0 -111
- data/test/unit/resources/pip_test.rb +0 -15
- data/test/unit/resources/port_test.rb +0 -165
- data/test/unit/resources/powershell_test.rb +0 -32
- data/test/unit/resources/processes_test.rb +0 -72
- data/test/unit/resources/registry_key_test.rb +0 -18
- data/test/unit/resources/security_policy_test.rb +0 -16
- data/test/unit/resources/service_test.rb +0 -305
- data/test/unit/resources/shadow_test.rb +0 -67
- data/test/unit/resources/ssh_conf_test.rb +0 -33
- data/test/unit/resources/user_test.rb +0 -124
- data/test/unit/resources/vbscript_test.rb +0 -18
- data/test/unit/resources/windows_feature.rb +0 -17
- data/test/unit/resources/wmi_test.rb +0 -42
- data/test/unit/resources/xinetd_test.rb +0 -60
- data/test/unit/resources/yaml_test.rb +0 -34
- data/test/unit/resources/yum_test.rb +0 -68
- data/test/unit/shell_detector_test.rb +0 -78
- data/test/unit/source_reader_test.rb +0 -17
- data/test/unit/source_readers/flat_test.rb +0 -61
- data/test/unit/source_readers/inspec_test.rb +0 -38
- data/test/unit/utils/filter_array_test.rb +0 -59
- data/test/unit/utils/filter_table_test.rb +0 -177
- data/test/unit/utils/find_files_test.rb +0 -23
- data/test/unit/utils/passwd_parser_test.rb +0 -32
- data/test/unit/utils/simpleconfig_test.rb +0 -80
- data/test/unit/utils/solaris_netstat_parser.rb +0 -124
Binary file
|
@@ -1,7 +0,0 @@
|
|
1
|
-
name,version,license,title,description
|
2
|
-
addressable,2.3.6,Apache 2.0,URI Implementation,"Addressable is a replacement for the URI implementation that is part of
|
3
|
-
Ruby's standard library. It more closely conforms to the relevant RFCs and
|
4
|
-
adds support for IRIs and URI templates."
|
5
|
-
ast,2.0.0,MIT,A library for working with Abstract Syntax Trees.,A library for working with Abstract Syntax Trees.
|
6
|
-
astrolabe,1.3.0,MIT,An object-oriented AST extension for Parser,An object-oriented AST extension for Parser
|
7
|
-
berkshelf,3.2.3,Apache 2.0,"Manages a Cookbook's, or an Application's, Cookbook dependencies","Manages a Cookbook's, or an Application's, Cookbook dependencies"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
name 'os_prepare'
|
3
|
-
maintainer 'Chef Software, Inc.'
|
4
|
-
maintainer_email 'support@chef.io'
|
5
|
-
description 'This cookbook prepares the test operating systems'
|
6
|
-
version '1.0.0'
|
7
|
-
|
8
|
-
depends 'apt'
|
9
|
-
depends 'yum'
|
10
|
-
depends 'runit'
|
11
|
-
depends 'postgresql'
|
12
|
-
depends 'httpd', '~> 0.2'
|
13
|
-
depends 'windows'
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Stephan Renatus
|
3
|
-
|
4
|
-
include_recipe 'runit::default'
|
5
|
-
|
6
|
-
# put ctl in alt location
|
7
|
-
directory '/opt/chef/embedded/sbin' do
|
8
|
-
recursive true
|
9
|
-
action :create
|
10
|
-
end
|
11
|
-
|
12
|
-
link '/opt/chef/embedded/sbin/sv' do
|
13
|
-
to '/sbin/sv' # default location
|
14
|
-
end
|
15
|
-
|
16
|
-
runit_service 'running-runit-service' do
|
17
|
-
default_logger true
|
18
|
-
run_template_name 'default-svlog'
|
19
|
-
end
|
20
|
-
|
21
|
-
runit_service 'not-enabled-runit-service' do
|
22
|
-
default_logger true
|
23
|
-
run_template_name 'default-svlog'
|
24
|
-
start_down true
|
25
|
-
action :enable
|
26
|
-
end
|
27
|
-
|
28
|
-
runit_service 'not-running-runit-service' do
|
29
|
-
default_logger true
|
30
|
-
run_template_name 'default-svlog'
|
31
|
-
action :create
|
32
|
-
end
|
33
|
-
|
34
|
-
execute 'sv down not-running-runit-service'
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Stephan Renatus
|
3
|
-
|
4
|
-
directory '/etc/init' do
|
5
|
-
action :create
|
6
|
-
end
|
7
|
-
|
8
|
-
file "/etc/init/upstart-running.conf" do
|
9
|
-
content "exec tail -f /dev/null"
|
10
|
-
end
|
11
|
-
|
12
|
-
file "/etc/init/upstart-enabled-not-running.conf" do
|
13
|
-
content "exec tail -f /dev/null\nstart on networking"
|
14
|
-
end
|
15
|
-
|
16
|
-
file "/etc/init/upstart-enabled-and-running.conf" do
|
17
|
-
content "exec tail -f /dev/null\nstart on networking"
|
18
|
-
end
|
19
|
-
|
20
|
-
%w{ enabled-and-running running }.each do |srv|
|
21
|
-
service "upstart-#{srv}" do
|
22
|
-
provider Chef::Provider::Service::Upstart
|
23
|
-
action :start
|
24
|
-
end
|
25
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
|
4
|
-
# install apache service
|
5
|
-
case node['platform']
|
6
|
-
when 'ubuntu', 'centos', 'amazon', 'fedora'
|
7
|
-
|
8
|
-
return if node['platform_version'] == "15.10"
|
9
|
-
|
10
|
-
httpd_service 'default' do
|
11
|
-
action :create
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
|
5
|
-
# add nginx apt repository
|
6
|
-
case node['platform']
|
7
|
-
when 'ubuntu'
|
8
|
-
# use ppa
|
9
|
-
apt_repository 'nginx' do
|
10
|
-
uri 'ppa:nginx/stable'
|
11
|
-
distribution node['lsb']['codename']
|
12
|
-
end
|
13
|
-
when 'debian'
|
14
|
-
# use plain repo
|
15
|
-
apt_repository 'nginx' do
|
16
|
-
uri 'http://nginx.org/packages/debian'
|
17
|
-
distribution node['lsb']['codename']
|
18
|
-
components ['nginx']
|
19
|
-
end
|
20
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# prepare all operating systems with the required configuration
|
6
|
-
|
7
|
-
# container preparation
|
8
|
-
include_recipe('os_prepare::prep_container')
|
9
|
-
|
10
|
-
# basic tests
|
11
|
-
include_recipe('os_prepare::file')
|
12
|
-
include_recipe('os_prepare::mount') unless node['osprepare']['docker']
|
13
|
-
include_recipe('os_prepare::service')
|
14
|
-
include_recipe('os_prepare::package')
|
15
|
-
include_recipe('os_prepare::registry_key')
|
16
|
-
include_recipe('os_prepare::iptables') unless node['osprepare']['docker']
|
17
|
-
|
18
|
-
# config file parsing
|
19
|
-
include_recipe('os_prepare::json_yaml_csv_ini')
|
20
|
-
|
21
|
-
# configure repos, eg. nginx
|
22
|
-
include_recipe('os_prepare::apt')
|
23
|
-
|
24
|
-
# application configuration
|
25
|
-
if node['osprepare']['application']
|
26
|
-
include_recipe('os_prepare::postgres')
|
27
|
-
include_recipe('os_prepare::auditctl') unless node['osprepare']['docker']
|
28
|
-
include_recipe('os_prepare::apache')
|
29
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# prepares a sample file for verification
|
6
|
-
|
7
|
-
if node['platform_family'] != 'windows'
|
8
|
-
|
9
|
-
gid = case node['platform_family']
|
10
|
-
when 'aix'
|
11
|
-
'system'
|
12
|
-
when 'freebsd'
|
13
|
-
'wheel'
|
14
|
-
when 'solaris', 'solaris2'
|
15
|
-
'sys'
|
16
|
-
else
|
17
|
-
'root'
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
file '/tmp/file' do
|
22
|
-
mode '0765'
|
23
|
-
owner 'root'
|
24
|
-
group gid
|
25
|
-
content 'hello world'
|
26
|
-
end
|
27
|
-
|
28
|
-
file '/tmp/sfile' do
|
29
|
-
mode '7765'
|
30
|
-
owner 'root'
|
31
|
-
group gid
|
32
|
-
content 'hello suid/sgid/sticky'
|
33
|
-
end
|
34
|
-
|
35
|
-
directory '/tmp/folder' do
|
36
|
-
mode '0567'
|
37
|
-
owner 'root'
|
38
|
-
group gid
|
39
|
-
end
|
40
|
-
|
41
|
-
else
|
42
|
-
|
43
|
-
directory 'C:\Test Directory'
|
44
|
-
file 'C:\Test Directory\test file.txt'
|
45
|
-
|
46
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Stephan Renatus
|
3
|
-
|
4
|
-
case node['platform']
|
5
|
-
when 'ubuntu', 'rhel', 'centos', 'fedora'
|
6
|
-
execute 'iptables -A INPUT -i eth0 -p tcp -m tcp '\
|
7
|
-
'--dport 80 -m state --state NEW -m comment '\
|
8
|
-
'--comment "http on 80" -j ACCEPT'
|
9
|
-
execute 'iptables -N derby-cognos-web'
|
10
|
-
execute 'iptables -A INPUT -j derby-cognos-web'
|
11
|
-
execute 'iptables -A derby-cognos-web -p tcp -m tcp --dport 80 '\
|
12
|
-
'-m comment --comment "derby-cognos-web" -j ACCEPT'
|
13
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# adds a yaml file
|
6
|
-
|
7
|
-
gid = case node['platform_family']
|
8
|
-
when 'aix'
|
9
|
-
'system'
|
10
|
-
when 'freebsd'
|
11
|
-
'wheel'
|
12
|
-
when 'solaris', 'solaris2'
|
13
|
-
'sys'
|
14
|
-
else
|
15
|
-
'root'
|
16
|
-
end
|
17
|
-
|
18
|
-
['yml', 'json', 'csv', 'ini'].each { |filetype|
|
19
|
-
|
20
|
-
if node['platform_family'] != 'windows'
|
21
|
-
cookbook_file "/tmp/example.#{filetype}" do
|
22
|
-
source "example.#{filetype}"
|
23
|
-
owner 'root'
|
24
|
-
group gid
|
25
|
-
mode '0755'
|
26
|
-
action :create
|
27
|
-
end
|
28
|
-
else
|
29
|
-
cookbook_file "C:/windows/temp/example.#{filetype}" do
|
30
|
-
source "example.#{filetype}"
|
31
|
-
action :create
|
32
|
-
end
|
33
|
-
end
|
34
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# file mount tests
|
6
|
-
|
7
|
-
case node['platform']
|
8
|
-
when 'ubuntu', 'rhel', 'centos', 'fedora'
|
9
|
-
|
10
|
-
# copy iso file for mount tests
|
11
|
-
# NB created using `mkdir empty; mkisofs -o empty.iso empty/`
|
12
|
-
cookbook_file '/tmp/empty.iso' do
|
13
|
-
owner 'root'
|
14
|
-
group 'root'
|
15
|
-
mode '0755'
|
16
|
-
action :create
|
17
|
-
end
|
18
|
-
|
19
|
-
# create mount directory
|
20
|
-
directory '/mnt/iso-disk' do
|
21
|
-
owner 'root'
|
22
|
-
group 'root'
|
23
|
-
mode '0755'
|
24
|
-
action :create
|
25
|
-
end
|
26
|
-
|
27
|
-
# mount -o loop /root/empty.iso /mnt/iso-disk
|
28
|
-
mount '/mnt/iso-disk' do
|
29
|
-
device '/tmp/empty.iso'
|
30
|
-
options 'loop'
|
31
|
-
action [:mount, :enable]
|
32
|
-
end
|
33
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# installs everything to do the package test
|
6
|
-
|
7
|
-
case node['platform']
|
8
|
-
when 'ubuntu', 'debian'
|
9
|
-
include_recipe('apt')
|
10
|
-
package 'curl'
|
11
|
-
when 'rhel', 'centos', 'fedora'
|
12
|
-
include_recipe('yum')
|
13
|
-
|
14
|
-
# TODO: support DNF natively
|
15
|
-
# Special care for fedora 22, since dnf is not officially supported yet
|
16
|
-
# https://github.com/chef/chef/issues/3201
|
17
|
-
if node['platform_version'] == '22'
|
18
|
-
execute 'dnf install -y yum'
|
19
|
-
end
|
20
|
-
|
21
|
-
package 'curl'
|
22
|
-
when 'freebsd'
|
23
|
-
# do nothing
|
24
|
-
# TODO: implement Freebsd packages
|
25
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Stephan Renatus
|
3
|
-
#
|
4
|
-
# installs everyting for the postgres tests
|
5
|
-
|
6
|
-
# hw-cookbooks/postgresql is tested on these platforms
|
7
|
-
case node['platform']
|
8
|
-
when 'ubuntu', 'centos'
|
9
|
-
|
10
|
-
# also skip it on ubuntu 15.10, because the cookbook is not supported
|
11
|
-
# with `enable_pgdg_apt` yet
|
12
|
-
return if node['platform_version'] == "15.10"
|
13
|
-
# skip it on centos 5, because ca-certificates is not available
|
14
|
-
return if node['platform_version'] == "5"
|
15
|
-
|
16
|
-
node.default['postgresql']['enable_pgdg_apt'] = true
|
17
|
-
node.default['postgresql']['config']['listen_addresses'] = 'localhost'
|
18
|
-
node.default['postgresql']['password']['postgres'] = 'md506be11be01439cb4abd537e454df34ea' # "inspec"
|
19
|
-
include_recipe 'postgresql::server'
|
20
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# prepares container for normal use :-)
|
6
|
-
|
7
|
-
# install docker pre-conditions
|
8
|
-
if ['ubuntu', 'debian'].include?(node['platform'])
|
9
|
-
include_recipe('apt')
|
10
|
-
|
11
|
-
# if package lsb-release & procps is not installed
|
12
|
-
# chef returns an empty node['lsb']['codename']
|
13
|
-
package("lsb-release")
|
14
|
-
package("procps")
|
15
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Alex Pop
|
3
|
-
# author: Christoph Hartmann
|
4
|
-
#
|
5
|
-
# change a few Windows registry keys for testing purposes
|
6
|
-
|
7
|
-
if node['platform_family'] == 'windows'
|
8
|
-
|
9
|
-
registry_key 'HKLM\System\Test' do
|
10
|
-
values [{
|
11
|
-
:name => '',
|
12
|
-
:type => :string,
|
13
|
-
:data => 'test'
|
14
|
-
},{
|
15
|
-
:name => 'string value',
|
16
|
-
:type => :string,
|
17
|
-
:data => nil
|
18
|
-
},{
|
19
|
-
:name => 'binary value',
|
20
|
-
:type => :binary,
|
21
|
-
:data => 'dfa0f066'
|
22
|
-
},{
|
23
|
-
:name => 'dword value',
|
24
|
-
:type => :dword,
|
25
|
-
:data => 0
|
26
|
-
},{
|
27
|
-
:name => 'qword value',
|
28
|
-
:type => :qword,
|
29
|
-
:data => 0
|
30
|
-
},{
|
31
|
-
:name => 'multistring value',
|
32
|
-
:type => :multi_string,
|
33
|
-
:data => ['test', 'multi','string','data']
|
34
|
-
}]
|
35
|
-
recursive true
|
36
|
-
action :create
|
37
|
-
end
|
38
|
-
|
39
|
-
registry_key 'HKLM\Software\Policies\Microsoft\Windows\EventLog\System' do
|
40
|
-
values [{ name: 'MaxSize', type: :dword, data: 67_108_864 }]
|
41
|
-
recursive true
|
42
|
-
action :create
|
43
|
-
end
|
44
|
-
|
45
|
-
registry_key 'HKLM\System\CurrentControlSet\Control\Session Manager' do
|
46
|
-
values [{ name: 'SafeDllSearchMode', type: :dword, data: 1 }]
|
47
|
-
recursive true
|
48
|
-
action :create
|
49
|
-
end
|
50
|
-
|
51
|
-
registry_key 'HKLM\System\CurrentControlSet\Services\LanManServer\Parameters' do
|
52
|
-
values [{ name: 'NullSessionShares', type: :multi_string, data: [] }]
|
53
|
-
recursive true
|
54
|
-
action :create
|
55
|
-
end
|
56
|
-
|
57
|
-
registry_key 'HKLM\Software\Policies\Microsoft\Internet Explorer\Main' do
|
58
|
-
values [{ name: 'Isolation64Bit', type: :dword, data: 1 }]
|
59
|
-
recursive true
|
60
|
-
action :create
|
61
|
-
end
|
62
|
-
|
63
|
-
registry_key 'HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' do
|
64
|
-
values [{ name: 'MinEncryptionLevel', type: :dword, data: 3 }]
|
65
|
-
recursive true
|
66
|
-
action :create
|
67
|
-
end
|
68
|
-
|
69
|
-
registry_key 'HKLM\System\CurrentControlSet\Control\Lsa\MSV1_0' do
|
70
|
-
values [{ name: 'NTLMMinServerSec', type: :dword, data: 537_395_200 }]
|
71
|
-
recursive true
|
72
|
-
action :create
|
73
|
-
end
|
74
|
-
|
75
|
-
# used to verify pattern test
|
76
|
-
::Chef::Recipe.send(:include, Chef::Mixin::PowershellOut)
|
77
|
-
cmd = powershell_out!('Get-WmiObject -Class Win32_UserAccount | % { $_.SID } | ConvertTo-Json')
|
78
|
-
sids = JSON.parse(cmd.stdout)
|
79
|
-
sids.each { |sid|
|
80
|
-
registry_key "HKEY_USERS\\#{sid}\\Software\\Policies\\Microsoft\\Windows\\Installer" do
|
81
|
-
values [{ name: 'AlwaysInstallElevated', type: :dword, data: 0 }]
|
82
|
-
recursive true
|
83
|
-
ignore_failure true # ignore users that have not been logged in
|
84
|
-
action :create
|
85
|
-
end
|
86
|
-
}
|
87
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Christoph Hartmann
|
3
|
-
# author: Dominik Richter
|
4
|
-
#
|
5
|
-
# prepares services
|
6
|
-
|
7
|
-
case node['platform']
|
8
|
-
when 'ubuntu'
|
9
|
-
# install ntp as a service
|
10
|
-
include_recipe 'apt::default'
|
11
|
-
package 'ntp'
|
12
|
-
|
13
|
-
when 'centos'
|
14
|
-
# install runit for alternative service mgmt
|
15
|
-
if node['platform_version'].to_i == 6
|
16
|
-
include_recipe 'os_prepare::_runit_service_centos' unless node['osprepare']['docker']
|
17
|
-
include_recipe 'os_prepare::_upstart_service_centos' unless node['osprepare']['docker']
|
18
|
-
end
|
19
|
-
end
|
data/test/docker_run.rb
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# author: Dominik Richter
|
3
|
-
|
4
|
-
require 'docker'
|
5
|
-
require 'yaml'
|
6
|
-
require 'concurrent'
|
7
|
-
|
8
|
-
class DockerRunner
|
9
|
-
def initialize(conf_path = nil)
|
10
|
-
@conf_path = conf_path ||
|
11
|
-
ENV['config']
|
12
|
-
|
13
|
-
docker_run_concurrency = (ENV['N'] || 5).to_i
|
14
|
-
|
15
|
-
if @conf_path.nil?
|
16
|
-
fail "You must provide a configuration file with docker boxes"
|
17
|
-
end
|
18
|
-
|
19
|
-
unless File.file?(@conf_path)
|
20
|
-
fail "Can't find configuration in #{@conf_path}"
|
21
|
-
end
|
22
|
-
|
23
|
-
@conf = YAML.load_file(@conf_path)
|
24
|
-
if @conf.nil? or @conf.empty?
|
25
|
-
fail "Can't read coniguration in #{@conf_path}"
|
26
|
-
end
|
27
|
-
if @conf['images'].nil?
|
28
|
-
fail "You must configure test images in your #{@conf_path}"
|
29
|
-
end
|
30
|
-
|
31
|
-
@images = docker_images_by_tag
|
32
|
-
@image_pull_tickets = Concurrent::Semaphore.new(2)
|
33
|
-
@docker_run_tickets = Concurrent::Semaphore.new(docker_run_concurrency)
|
34
|
-
end
|
35
|
-
|
36
|
-
def run_all(&block)
|
37
|
-
fail 'You must provide a block for run_all' unless block_given?
|
38
|
-
|
39
|
-
promises = @conf['images'].map do |id|
|
40
|
-
run_on_target(id, &block)
|
41
|
-
end
|
42
|
-
|
43
|
-
# wait for all tests to be finished
|
44
|
-
sleep(0.1) until promises.all?(&:fulfilled?)
|
45
|
-
|
46
|
-
# return resulting values
|
47
|
-
promises.map(&:value)
|
48
|
-
end
|
49
|
-
|
50
|
-
def run_on_target(name, &block)
|
51
|
-
pr = Concurrent::Promise.new {
|
52
|
-
begin
|
53
|
-
container = start_container(name)
|
54
|
-
res = block.call(name, container)
|
55
|
-
# special rescue block to handle not implemented error
|
56
|
-
rescue NotImplementedError => err
|
57
|
-
stop_container(container)
|
58
|
-
raise err.message + "\n" + err.backtrace.join("\n")
|
59
|
-
rescue StandardError => err
|
60
|
-
stop_container(container)
|
61
|
-
raise err.message + "\n" + err.backtrace.join("\n")
|
62
|
-
end
|
63
|
-
# always stop the container
|
64
|
-
stop_container(container)
|
65
|
-
res
|
66
|
-
}.execute
|
67
|
-
|
68
|
-
# failure handling
|
69
|
-
pr.rescue do |err|
|
70
|
-
msg = "\033[31;1m#{err.message}\033[0m"
|
71
|
-
puts msg
|
72
|
-
msg + "\n" + err.backtrace.join("\n")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def provision_image(image, prov, files)
|
77
|
-
return image if prov['script'].nil?
|
78
|
-
path = File.join(File.dirname(@conf_path), prov['script'])
|
79
|
-
unless File.file?(path)
|
80
|
-
puts "Can't find script file #{path}"
|
81
|
-
return image
|
82
|
-
end
|
83
|
-
puts " script #{path}"
|
84
|
-
dst = "/bootstrap#{files.length}.sh"
|
85
|
-
files.push(dst)
|
86
|
-
image.insert_local('localPath' => path, 'outputPath' => dst)
|
87
|
-
end
|
88
|
-
|
89
|
-
def bootstrap_image(name, image)
|
90
|
-
files = []
|
91
|
-
provisions = Array(@conf['provision'])
|
92
|
-
puts "--> provision docker #{name}" unless provisions.empty?
|
93
|
-
provisions.each do |prov|
|
94
|
-
image = provision_image(image, prov, files)
|
95
|
-
end
|
96
|
-
[image, files]
|
97
|
-
end
|
98
|
-
|
99
|
-
def start_container(name, version = nil)
|
100
|
-
unless name.include?(':')
|
101
|
-
version ||= 'latest'
|
102
|
-
name = "#{name}:#{version}"
|
103
|
-
end
|
104
|
-
puts "--> schedule docker #{name}"
|
105
|
-
|
106
|
-
image = @images[name]
|
107
|
-
if image.nil?
|
108
|
-
puts "\033[35;1m--> pull docker images #{name} "\
|
109
|
-
"(this may take a while)\033[0m"
|
110
|
-
|
111
|
-
@image_pull_tickets.acquire(1)
|
112
|
-
puts "... start pull image #{name}"
|
113
|
-
image = Docker::Image.create('fromImage' => name)
|
114
|
-
@image_pull_tickets.release(1)
|
115
|
-
|
116
|
-
unless image.nil?
|
117
|
-
puts "\033[35;1m--> pull docker images finished for #{name}\033[0m"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
fail "Can't find nor pull docker image #{name}" if image.nil?
|
122
|
-
|
123
|
-
image, scripts = bootstrap_image(name, image)
|
124
|
-
|
125
|
-
@docker_run_tickets.acquire(1)
|
126
|
-
|
127
|
-
puts "--> start docker #{name}"
|
128
|
-
container = Docker::Container.create(
|
129
|
-
'Cmd' => %w{sleep 3600},
|
130
|
-
'Image' => image.id,
|
131
|
-
'OpenStdin' => true,
|
132
|
-
)
|
133
|
-
container.start
|
134
|
-
|
135
|
-
scripts.each do |script|
|
136
|
-
container.exec(%w{chmod +x}.push(script))
|
137
|
-
container.exec(%w{sh -c}.push(script))
|
138
|
-
end
|
139
|
-
|
140
|
-
container
|
141
|
-
end
|
142
|
-
|
143
|
-
def stop_container(container)
|
144
|
-
@docker_run_tickets.release(1)
|
145
|
-
puts "--> killrm docker #{container.id}"
|
146
|
-
container.kill
|
147
|
-
container.delete(force: true)
|
148
|
-
end
|
149
|
-
|
150
|
-
private
|
151
|
-
|
152
|
-
# get all docker image tags
|
153
|
-
def docker_images_by_tag
|
154
|
-
images = {}
|
155
|
-
Docker::Image.all.map do |img|
|
156
|
-
Array(img.info['RepoTags']).each do |tag|
|
157
|
-
images[tag] = img
|
158
|
-
end
|
159
|
-
end
|
160
|
-
images
|
161
|
-
end
|
162
|
-
end
|