inspec 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +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
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
if os.linux?
|
|
4
|
-
# uses the `cmp` matcher instead of the eq matcher
|
|
5
|
-
describe sshd_config do
|
|
6
|
-
its('Port') { should eq '22' }
|
|
7
|
-
its('Port') { should_not eq 22 }
|
|
8
|
-
|
|
9
|
-
its('Port') { should cmp '22' }
|
|
10
|
-
its('Port') { should cmp 22 }
|
|
11
|
-
its('Port') { should cmp 22.0 }
|
|
12
|
-
its('Port') { should_not cmp 22.1 }
|
|
13
|
-
|
|
14
|
-
its('LogLevel') { should eq 'VERBOSE' }
|
|
15
|
-
its('LogLevel') { should_not eq 'verbose'}
|
|
16
|
-
|
|
17
|
-
its('LogLevel') { should cmp 'VERBOSE' }
|
|
18
|
-
its('LogLevel') { should cmp 'verbose' }
|
|
19
|
-
its('LogLevel') { should cmp 'VerBose' }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe passwd.passwords.uniq do
|
|
23
|
-
it { should eq ['x'] }
|
|
24
|
-
it { should cmp ['x'] }
|
|
25
|
-
it { should cmp 'x' }
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe passwd.usernames do
|
|
29
|
-
it { should include 'root' }
|
|
30
|
-
it { should_not cmp 'root' }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
len = passwd.passwords.length
|
|
34
|
-
describe len do
|
|
35
|
-
it { should cmp len.to_s }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe 122 do
|
|
39
|
-
it { should cmp 122 }
|
|
40
|
-
it { should cmp < 133 }
|
|
41
|
-
it { should cmp > 111 }
|
|
42
|
-
it { should_not cmp < 122 }
|
|
43
|
-
it { should_not cmp > 122 }
|
|
44
|
-
it { should cmp <= 122 }
|
|
45
|
-
it { should cmp >= 122 }
|
|
46
|
-
it { should cmp >= -666 }
|
|
47
|
-
it { should_not cmp <= 111 }
|
|
48
|
-
it { should_not cmp >= 133 }
|
|
49
|
-
it { should cmp /122/ }
|
|
50
|
-
it { should_not cmp /133/ }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe 0o640 do
|
|
54
|
-
it { should cmp 0o640 }
|
|
55
|
-
it { should cmp > 100 }
|
|
56
|
-
it { should_not cmp <= 0 }
|
|
57
|
-
it { should cmp == '416' }
|
|
58
|
-
it { should cmp /416$/ }
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe '12' do
|
|
62
|
-
it { should cmp 12 }
|
|
63
|
-
it { should cmp < 13 }
|
|
64
|
-
it { should cmp > 11 }
|
|
65
|
-
it { should_not cmp < 12 }
|
|
66
|
-
it { should_not cmp > 12 }
|
|
67
|
-
it { should cmp <= 12 }
|
|
68
|
-
it { should cmp >= 12 }
|
|
69
|
-
it { should cmp >= -666 }
|
|
70
|
-
it { should_not cmp <= 11 }
|
|
71
|
-
it { should_not cmp >= 13 }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
# Don't compare octal to number
|
|
75
|
-
describe '07' do
|
|
76
|
-
it { should_not cmp 7 }
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
describe 'some 123' do
|
|
80
|
-
it { should cmp 'some 123' }
|
|
81
|
-
it { should cmp /^SOME\s\d+(1|2|3)3/i }
|
|
82
|
-
it { should_not cmp /^SOME/ }
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe ['some-array'] do
|
|
86
|
-
it { should cmp 'some-array' }
|
|
87
|
-
it { should cmp /.+/ }
|
|
88
|
-
it { should_not cmp /^SOME/ }
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
describe '' do
|
|
92
|
-
it { should_not cmp >= 3 }
|
|
93
|
-
it { should_not cmp < 3 }
|
|
94
|
-
it { should_not cmp /.+/ }
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe nil do
|
|
98
|
-
it { should cmp nil }
|
|
99
|
-
it { should_not cmp >= 3 }
|
|
100
|
-
it { should_not cmp < 3 }
|
|
101
|
-
it { should_not cmp /something/ }
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
describe true do
|
|
105
|
-
it { should cmp 'true' }
|
|
106
|
-
it { should cmp 'True' }
|
|
107
|
-
it { should cmp true }
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
describe false do
|
|
111
|
-
it { should cmp 'false' }
|
|
112
|
-
it { should cmp 'False' }
|
|
113
|
-
it { should cmp false }
|
|
114
|
-
end
|
|
115
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
if ENV['DOCKER']
|
|
4
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
5
|
-
return
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
# lets define our own group
|
|
9
|
-
root_group = 'root'
|
|
10
|
-
|
|
11
|
-
if os[:family] == 'aix'
|
|
12
|
-
root_group = 'system'
|
|
13
|
-
elsif os[:family] == 'freebsd'
|
|
14
|
-
root_group = 'wheel'
|
|
15
|
-
elsif os.solaris?
|
|
16
|
-
root_group = 'sys'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
if os.unix?
|
|
20
|
-
describe etc_group do
|
|
21
|
-
its('gids') { should_not contain_duplicates }
|
|
22
|
-
its('groups') { should include root_group }
|
|
23
|
-
its('users') { should include 'root' }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe etc_group.where(name: root_group) do
|
|
27
|
-
its('users') { should include 'root' }
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
if os[:family] == 'freebsd'
|
|
8
|
-
filedata = {
|
|
9
|
-
user: 'root',
|
|
10
|
-
group: 'wheel',
|
|
11
|
-
dir_content: "\u0003\u0000",
|
|
12
|
-
dir_md5sum: '598f4fe64aefab8f00bcbea4c9239abf',
|
|
13
|
-
dir_sha256sum: '9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9',
|
|
14
|
-
}
|
|
15
|
-
elsif os[:family] == 'aix'
|
|
16
|
-
filedata = {
|
|
17
|
-
user: 'root',
|
|
18
|
-
group: 'system',
|
|
19
|
-
dir_content: nil,
|
|
20
|
-
dir_md5sum: nil,
|
|
21
|
-
dir_sha256sum: nil,
|
|
22
|
-
}
|
|
23
|
-
elsif os.solaris?
|
|
24
|
-
filedata = {
|
|
25
|
-
user: 'root',
|
|
26
|
-
group: 'sys',
|
|
27
|
-
dir_content: nil,
|
|
28
|
-
dir_md5sum: nil,
|
|
29
|
-
dir_sha256sum: nil,
|
|
30
|
-
}
|
|
31
|
-
else
|
|
32
|
-
filedata = {
|
|
33
|
-
user: 'root',
|
|
34
|
-
group: 'root',
|
|
35
|
-
dir_content: nil,
|
|
36
|
-
dir_md5sum: nil,
|
|
37
|
-
dir_sha256sum: nil,
|
|
38
|
-
}
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
if os.unix?
|
|
42
|
-
|
|
43
|
-
# test regular file
|
|
44
|
-
describe file('/tmp/file') do
|
|
45
|
-
it { should exist }
|
|
46
|
-
it { should be_file }
|
|
47
|
-
|
|
48
|
-
it { should_not be_directory }
|
|
49
|
-
it { should_not be_block_device }
|
|
50
|
-
it { should_not be_character_device }
|
|
51
|
-
it { should_not be_pipe }
|
|
52
|
-
it { should_not be_socket }
|
|
53
|
-
it { should_not be_symlink }
|
|
54
|
-
it { should_not be_mounted }
|
|
55
|
-
|
|
56
|
-
# check owner
|
|
57
|
-
it { should be_owned_by filedata[:user] }
|
|
58
|
-
it { should be_grouped_into filedata[:group] }
|
|
59
|
-
|
|
60
|
-
# it { should have_mode }
|
|
61
|
-
its('mode') { should eq 00765 }
|
|
62
|
-
it { should be_mode 00765 }
|
|
63
|
-
its('mode') { should cmp 0765 }
|
|
64
|
-
its('mode') { should_not cmp 0777 }
|
|
65
|
-
its('suid') { should eq false }
|
|
66
|
-
its('sgid') { should eq false }
|
|
67
|
-
its('sticky') { should eq false }
|
|
68
|
-
|
|
69
|
-
it { should be_readable }
|
|
70
|
-
it { should be_readable.by('owner') }
|
|
71
|
-
it { should be_readable.by('group') }
|
|
72
|
-
it { should be_readable.by('other') }
|
|
73
|
-
it { should be_readable.by_user(filedata[:user]) }
|
|
74
|
-
it { should_not be_readable.by_user('noroot') }
|
|
75
|
-
# for server spec compatibility
|
|
76
|
-
it { should be_readable.by('others') }
|
|
77
|
-
|
|
78
|
-
it { should be_writable }
|
|
79
|
-
it { should be_writable.by('owner') }
|
|
80
|
-
it { should be_writable.by('group') }
|
|
81
|
-
it { should_not be_writable.by('other') }
|
|
82
|
-
it { should be_writable.by_user(filedata[:user]) }
|
|
83
|
-
# it { should_not be_writable.by_user('noroot') }
|
|
84
|
-
# for server spec compatibility
|
|
85
|
-
it { should_not be_writable.by('others') }
|
|
86
|
-
|
|
87
|
-
it { should be_executable }
|
|
88
|
-
it { should be_executable.by('owner') }
|
|
89
|
-
it { should_not be_executable.by('group') }
|
|
90
|
-
it { should be_executable.by('other') }
|
|
91
|
-
it { should be_executable.by_user(filedata[:user]) }
|
|
92
|
-
# it { should_not be_executable.by_user('noroot') }
|
|
93
|
-
# for server spec compatibility
|
|
94
|
-
it { should be_executable.by('others') }
|
|
95
|
-
|
|
96
|
-
# test extended linux attributes
|
|
97
|
-
# it { should be_immutable }
|
|
98
|
-
|
|
99
|
-
its('content') { should eq 'hello world' }
|
|
100
|
-
its('content') { should match('world') }
|
|
101
|
-
its('size') { should eq 11 }
|
|
102
|
-
its('md5sum') { should eq '5eb63bbbe01eeed093cb22bb8f5acdc3' }
|
|
103
|
-
its('sha256sum') { should eq 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9' }
|
|
104
|
-
its('product_version') { should eq nil }
|
|
105
|
-
its('file_version') { should eq nil }
|
|
106
|
-
its('basename') { should cmp 'file' }
|
|
107
|
-
its('path') { should cmp '/tmp/file' }
|
|
108
|
-
|
|
109
|
-
its('owner') { should eq filedata[:user] }
|
|
110
|
-
its('group') { should eq filedata[:group] }
|
|
111
|
-
its('type') { should eq :file }
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
describe file('/tmp/file') do
|
|
115
|
-
its('suid') { should eq true }
|
|
116
|
-
its('sgid') { should eq true }
|
|
117
|
-
its('sticky') { should eq true }
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
describe file('/tmp/folder') do
|
|
121
|
-
it { should exist }
|
|
122
|
-
it { should be_directory }
|
|
123
|
-
|
|
124
|
-
it { should_not be_file }
|
|
125
|
-
it { should_not be_block_device }
|
|
126
|
-
it { should_not be_character_device }
|
|
127
|
-
it { should_not be_pipe }
|
|
128
|
-
it { should_not be_socket }
|
|
129
|
-
it { should_not be_symlink }
|
|
130
|
-
|
|
131
|
-
its('content') { should eq filedata[:dir_content] }
|
|
132
|
-
its('md5sum') { should eq filedata[:dir_md5sum] }
|
|
133
|
-
its('sha256sum') { should eq filedata[:dir_sha256sum] }
|
|
134
|
-
its('product_version') { should eq nil }
|
|
135
|
-
its('file_version') { should eq nil }
|
|
136
|
-
its('basename') { should cmp 'folder' }
|
|
137
|
-
its('path') { should cmp '/tmp/folder' }
|
|
138
|
-
|
|
139
|
-
its('owner') { should eq filedata[:user] }
|
|
140
|
-
its('group') { should eq filedata[:group] }
|
|
141
|
-
its('type') { should eq :directory }
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# check file mount on linux
|
|
146
|
-
if os.linux?
|
|
147
|
-
# for server spec compatibility
|
|
148
|
-
# Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed
|
|
149
|
-
# in InSpec version 1
|
|
150
|
-
describe file('/mnt/iso-disk') do
|
|
151
|
-
it { should be_mounted }
|
|
152
|
-
it { should be_mounted.with( :type => 'iso9660' ) }
|
|
153
|
-
it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) }
|
|
154
|
-
it { should be_mounted.with( :type => 'iso9660', :device => '/tmp/empty.iso' ) }
|
|
155
|
-
it { should_not be_mounted.with( :type => 'ext4' ) }
|
|
156
|
-
it { should_not be_mounted.with( :type => 'xfs' ) }
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
# compare with exact match
|
|
160
|
-
# also see mount_spec.rb
|
|
161
|
-
describe file('/mnt/iso-disk') do
|
|
162
|
-
it { should be_mounted.only_with( {
|
|
163
|
-
:device=>"/tmp/empty.iso",
|
|
164
|
-
:type=>"iso9660",
|
|
165
|
-
:options=>{
|
|
166
|
-
:ro=>true}
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
if os.windows?
|
|
173
|
-
describe file('C:\Windows') do
|
|
174
|
-
it { should exist }
|
|
175
|
-
it { should be_directory }
|
|
176
|
-
its('basename') { should cmp 'Windows' }
|
|
177
|
-
its('path') { should cmp "C:\\Windows" }
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
describe file('C:\\Test Directory\\test file.txt') do
|
|
181
|
-
it { should exist }
|
|
182
|
-
it { should be_file }
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
describe file('C:\\Test Directory') do
|
|
186
|
-
it { should exist }
|
|
187
|
-
it { should be_directory }
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
describe file("C:/Program Files (x86)/Windows NT/Accessories/wordpad.exe") do
|
|
191
|
-
it { should exist }
|
|
192
|
-
# Only works on Windows 2012 R2
|
|
193
|
-
its('file_version') { should eq '6.3.9600.17415' }
|
|
194
|
-
end
|
|
195
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
# test root group on linux
|
|
4
|
-
if os.linux?
|
|
5
|
-
describe group('root') do
|
|
6
|
-
it { should exist }
|
|
7
|
-
its('gid') { should eq 0 }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe group('noroot') do
|
|
11
|
-
it { should_not exist }
|
|
12
|
-
its('gid') { should eq nil }
|
|
13
|
-
end
|
|
14
|
-
elsif os[:family] == 'freebsd'
|
|
15
|
-
describe group('wheel') do
|
|
16
|
-
it { should exist }
|
|
17
|
-
its('gid') { should eq 0 }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe group('root') do
|
|
21
|
-
it { should_not exist }
|
|
22
|
-
its('gid') { should eq nil }
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe group('noroot') do
|
|
26
|
-
it { should_not exist }
|
|
27
|
-
its('gid') { should eq nil }
|
|
28
|
-
end
|
|
29
|
-
elsif os[:family] == 'aix'
|
|
30
|
-
describe group('system') do
|
|
31
|
-
it { should exist }
|
|
32
|
-
its('gid') { should eq 0 }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
describe group('bin') do
|
|
36
|
-
it { should exist }
|
|
37
|
-
its('gid') { should eq 2 }
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
describe group('noroot') do
|
|
41
|
-
it { should_not exist }
|
|
42
|
-
its('gid') { should eq nil }
|
|
43
|
-
end
|
|
44
|
-
elsif os.solaris?
|
|
45
|
-
describe group('root') do
|
|
46
|
-
it { should exist }
|
|
47
|
-
its('gid') { should eq 0 }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe group('bin') do
|
|
51
|
-
it { should exist }
|
|
52
|
-
its('gid') { should eq 2 }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
describe group('noroot') do
|
|
56
|
-
it { should_not exist }
|
|
57
|
-
its('gid') { should eq nil }
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
case os[:family]
|
|
8
|
-
when 'ubuntu', 'fedora'
|
|
9
|
-
describe iptables do
|
|
10
|
-
it { should have_rule('-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW -m comment --comment "http on 80" -j ACCEPT') }
|
|
11
|
-
it { should_not have_rule('-A INPUT -i eth1 -p tcp -m tcp --dport 80 -j ACCEPT') }
|
|
12
|
-
|
|
13
|
-
# single-word comments have their quotes dropped
|
|
14
|
-
it { should have_rule('-A derby-cognos-web -p tcp -m tcp --dport 80 -m comment --comment derby-cognos-web -j ACCEPT') }
|
|
15
|
-
end
|
|
16
|
-
when 'rhel', 'centos'
|
|
17
|
-
describe iptables do
|
|
18
|
-
it { should have_rule('-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW -m comment --comment "http on 80" -j ACCEPT') }
|
|
19
|
-
it { should_not have_rule('-A INPUT -i eth1 -p tcp -m tcp --dport 80 -j ACCEPT') }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe iptables do
|
|
23
|
-
it { should have_rule('-A derby-cognos-web -p tcp -m tcp --dport 80 -m comment --comment "derby-cognos-web" -j ACCEPT') }
|
|
24
|
-
end if os[:release] == 6
|
|
25
|
-
|
|
26
|
-
describe iptables do
|
|
27
|
-
it { should have_rule('-A derby-cognos-web -p tcp -m tcp --dport 80 -m comment --comment derby-cognos-web -j ACCEPT') }
|
|
28
|
-
end if os[:release] == 7
|
|
29
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
if !os.linux?
|
|
8
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__} because we are not on linux.\033[0m"
|
|
9
|
-
return
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Test kernel modules on all linux systems
|
|
13
|
-
describe kernel_module('video') do
|
|
14
|
-
it { should be_loaded }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe kernel_module('bridge') do
|
|
18
|
-
it { should_not be_loaded }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe kernel_module('dhcp') do
|
|
22
|
-
it { should_not be_loaded }
|
|
23
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
# prepare values
|
|
8
|
-
if ['ubuntu', 'centos', 'fedora', 'opensuse', 'debian'].include?(os[:family])
|
|
9
|
-
test_values = {
|
|
10
|
-
kernel_panic: 0,
|
|
11
|
-
ip_local_port_range: "32768\t61000",
|
|
12
|
-
forwarding: 0,
|
|
13
|
-
sched_autogroup_enabled: 1,
|
|
14
|
-
nf_log: 'NONE',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
# configue parameter derivations for different OS
|
|
18
|
-
test_values[:sched_autogroup_enabled] = 0 if ['centos', 'debian'].include?(os[:family])
|
|
19
|
-
|
|
20
|
-
if (os[:family] == 'ubuntu' && os[:release].to_f == 10.04) ||
|
|
21
|
-
(os[:family] == 'debian' && os[:release].to_i == 6) ||
|
|
22
|
-
(os[:family] == 'centos' && os[:release].to_i == 5) ||
|
|
23
|
-
(os[:family] == 'opensuse')
|
|
24
|
-
test_values[:sched_autogroup_enabled] = nil
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
test_values[:nf_log] = nil if os[:family] == 'centos' && os[:release].to_i == 5
|
|
28
|
-
test_values[:kernel_panic] = 90 if os[:family] == 'opensuse'
|
|
29
|
-
|
|
30
|
-
else
|
|
31
|
-
test_values = {}
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# test on all linux systems
|
|
35
|
-
if os.linux?
|
|
36
|
-
describe kernel_parameter('kernel.panic') do
|
|
37
|
-
its('value') { should eq test_values[:kernel_panic] }
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
describe kernel_parameter('net.netfilter.nf_log.0') do
|
|
41
|
-
its('value') { should eq test_values[:nf_log] }
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe kernel_parameter('kernel.sched_autogroup_enabled') do
|
|
45
|
-
its('value') { should eq test_values[:sched_autogroup_enabled] }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe kernel_parameter('net.ipv4.ip_local_port_range') do
|
|
49
|
-
its('value') { should eq test_values[:ip_local_port_range] }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
describe kernel_parameter('net.ipv4.conf.all.forwarding') do
|
|
53
|
-
its('value') { should eq test_values[:forwarding] }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# serverspec compatability
|
|
57
|
-
describe linux_kernel_parameter('net.ipv4.conf.all.forwarding') do
|
|
58
|
-
its('value') { should eq test_values[:forwarding] }
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
if !os.linux?
|
|
8
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__} because we are not on linux.\033[0m"
|
|
9
|
-
return
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# instead of `.with` or `.only_with` we recommend to use the `mount` resource
|
|
13
|
-
describe mount '/mnt/iso-disk' do
|
|
14
|
-
it { should be_mounted }
|
|
15
|
-
its('count') { should eq 1 }
|
|
16
|
-
its('device') { should eq '/tmp/empty.iso' }
|
|
17
|
-
its('type') { should eq 'iso9660' }
|
|
18
|
-
its('options') { should eq ['ro'] }
|
|
19
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
case os[:family]
|
|
4
|
-
when 'centos', 'fedora', 'opensuse', 'debian', 'ubuntu'
|
|
5
|
-
describe package('curl') do
|
|
6
|
-
it { should be_installed }
|
|
7
|
-
end
|
|
8
|
-
when 'aix'
|
|
9
|
-
describe package('bos.rte') do
|
|
10
|
-
it { should be_installed }
|
|
11
|
-
its('version') { should match /^(6|7)[.|\d]+\d$/ }
|
|
12
|
-
end
|
|
13
|
-
when 'solaris'
|
|
14
|
-
if os[:release] == '11'
|
|
15
|
-
pkg = 'system/file-system/zfs'
|
|
16
|
-
ver = /^0\.5.+$/
|
|
17
|
-
else
|
|
18
|
-
pkg = 'SUNWzfsr'
|
|
19
|
-
ver = /^11\.10.+$/
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe package(pkg) do
|
|
23
|
-
it { should be_installed }
|
|
24
|
-
its('version') { should match ver }
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe package('nginx') do
|
|
29
|
-
it { should_not be_installed }
|
|
30
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
# check that ssh runs
|
|
8
|
-
if os.unix?
|
|
9
|
-
describe port(22) do
|
|
10
|
-
it { should be_listening }
|
|
11
|
-
its('protocols') { should include('tcp') }
|
|
12
|
-
its('protocols') { should_not include('udp') }
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe port(65432) do
|
|
16
|
-
it { should_not be_listening }
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# extra test for linux
|
|
21
|
-
if os.linux?
|
|
22
|
-
describe port(22) do
|
|
23
|
-
its('processes') { should include 'sshd' }
|
|
24
|
-
its('protocols') { should include 'tcp' }
|
|
25
|
-
its('addresses') {should include '0.0.0.0'}
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
if ENV['DOCKER']
|
|
3
|
-
STDERR.puts "\033[1;33mTODO: Not running #{__FILE__.split("/").last} because we are running in docker\033[0m"
|
|
4
|
-
return
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
# postgres-server is installed on these platforms
|
|
8
|
-
if ['ubuntu', 'centos'].include? os['family']
|
|
9
|
-
postgres = postgres_session('postgres', 'inspec')
|
|
10
|
-
describe postgres.query('show ssl;') do
|
|
11
|
-
its('output') { should eq 'on' }
|
|
12
|
-
end
|
|
13
|
-
end
|