inspec 1.40.0 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -9
  3. data/docs/matchers.md +18 -0
  4. data/docs/plugin_kitchen_inspec.md +18 -24
  5. data/docs/profiles.md +39 -2
  6. data/docs/resources/aide_conf.md.erb +18 -28
  7. data/docs/resources/apache_conf.md.erb +19 -33
  8. data/docs/resources/apt.md.erb +22 -36
  9. data/docs/resources/audit_policy.md.erb +9 -24
  10. data/docs/resources/auditd.md.erb +9 -24
  11. data/docs/resources/auditd_conf.md.erb +20 -34
  12. data/docs/resources/auditd_rules.md.erb +8 -24
  13. data/docs/resources/bash.md.erb +4 -26
  14. data/docs/resources/bond.md.erb +25 -40
  15. data/docs/resources/bridge.md.erb +5 -25
  16. data/docs/resources/bsd_service.md.erb +5 -25
  17. data/docs/resources/command.md.erb +35 -50
  18. data/docs/resources/crontab.md.erb +9 -23
  19. data/docs/resources/csv.md.erb +12 -27
  20. data/docs/resources/dh_params.md +1 -0
  21. data/docs/resources/directory.md.erb +5 -25
  22. data/docs/resources/docker.md.erb +60 -57
  23. data/docs/resources/docker_container.md.erb +23 -19
  24. data/docs/resources/docker_image.md.erb +20 -16
  25. data/docs/resources/etc_fstab.md.erb +5 -2
  26. data/docs/resources/etc_group.md.erb +29 -45
  27. data/docs/resources/etc_hosts.md.erb +6 -0
  28. data/docs/resources/etc_hosts_allow.md.erb +6 -2
  29. data/docs/resources/etc_hosts_deny.md.erb +6 -2
  30. data/docs/resources/file.md.erb +198 -212
  31. data/docs/resources/firewalld.md.erb +7 -1
  32. data/docs/resources/gem.md.erb +21 -35
  33. data/docs/resources/group.md.erb +16 -30
  34. data/docs/resources/grub_conf.md.erb +9 -24
  35. data/docs/resources/host.md.erb +32 -49
  36. data/docs/resources/http.md.erb +38 -44
  37. data/docs/resources/iis_app.md.erb +25 -35
  38. data/docs/resources/iis_site.md.erb +26 -40
  39. data/docs/resources/inetd_conf.md.erb +27 -42
  40. data/docs/resources/ini.md.erb +9 -23
  41. data/docs/resources/interface.md.erb +5 -25
  42. data/docs/resources/iptables.md.erb +15 -29
  43. data/docs/resources/json.md.erb +12 -27
  44. data/docs/resources/kernel_module.md.erb +47 -61
  45. data/docs/resources/kernel_parameter.md.erb +15 -29
  46. data/docs/resources/key_rsa.md.erb +3 -0
  47. data/docs/resources/launchd_service.md.erb +5 -25
  48. data/docs/resources/limits_conf.md.erb +15 -29
  49. data/docs/resources/login_def.md.erb +15 -30
  50. data/docs/resources/mount.md.erb +18 -33
  51. data/docs/resources/mssql_session.md.erb +9 -12
  52. data/docs/resources/mysql_conf.md.erb +17 -32
  53. data/docs/resources/mysql_session.md.erb +15 -29
  54. data/docs/resources/nginx.md.erb +6 -0
  55. data/docs/resources/nginx_conf.md.erb +25 -20
  56. data/docs/resources/npm.md.erb +19 -35
  57. data/docs/resources/ntp_conf.md.erb +20 -37
  58. data/docs/resources/oneget.md.erb +15 -30
  59. data/docs/resources/oracledb_session.md.erb +9 -11
  60. data/docs/resources/os.md.erb +29 -43
  61. data/docs/resources/os_env.md.erb +29 -44
  62. data/docs/resources/package.md.erb +33 -42
  63. data/docs/resources/parse_config.md.erb +5 -25
  64. data/docs/resources/parse_config_file.md.erb +31 -43
  65. data/docs/resources/passwd.md.erb +24 -39
  66. data/docs/resources/pip.md.erb +20 -35
  67. data/docs/resources/port.md.erb +43 -57
  68. data/docs/resources/postgres_conf.md.erb +17 -31
  69. data/docs/resources/postgres_hba_conf.md.erb +26 -38
  70. data/docs/resources/postgres_ident_conf.md.erb +25 -37
  71. data/docs/resources/postgres_session.md.erb +15 -29
  72. data/docs/resources/powershell.md.erb +27 -42
  73. data/docs/resources/processes.md.erb +17 -33
  74. data/docs/resources/rabbitmq_config.md.erb +9 -24
  75. data/docs/resources/registry_key.md.erb +27 -42
  76. data/docs/resources/runit_service.md.erb +5 -25
  77. data/docs/resources/security_policy.md.erb +12 -27
  78. data/docs/resources/service.md.erb +27 -42
  79. data/docs/resources/shadow.md.erb +20 -35
  80. data/docs/resources/ssh_config.md.erb +19 -34
  81. data/docs/resources/sshd_config.md.erb +19 -34
  82. data/docs/resources/ssl.md.erb +39 -54
  83. data/docs/resources/sys_info.md.erb +12 -26
  84. data/docs/resources/systemd_service.md.erb +5 -25
  85. data/docs/resources/sysv_service.md.erb +5 -25
  86. data/docs/resources/upstart_service.md.erb +5 -25
  87. data/docs/resources/user.md.erb +29 -44
  88. data/docs/resources/users.md.erb +12 -26
  89. data/docs/resources/vbscript.md.erb +9 -24
  90. data/docs/resources/virtualization.md.erb +8 -23
  91. data/docs/resources/windows_feature.md.erb +15 -30
  92. data/docs/resources/windows_hotfix.md.erb +15 -9
  93. data/docs/resources/windows_task.md.erb +12 -26
  94. data/docs/resources/wmi.md.erb +9 -24
  95. data/docs/resources/x509_certificate.md.erb +4 -0
  96. data/docs/resources/xinetd_conf.md.erb +65 -80
  97. data/docs/resources/xml.md.erb +12 -26
  98. data/docs/resources/yaml.md.erb +12 -27
  99. data/docs/resources/yum.md.erb +37 -51
  100. data/docs/resources/zfs_dataset.md.erb +15 -26
  101. data/docs/resources/zfs_pool.md.erb +9 -20
  102. data/lib/inspec/backend.rb +8 -0
  103. data/lib/inspec/profile.rb +9 -1
  104. data/lib/inspec/shell.rb +13 -13
  105. data/lib/inspec/version.rb +1 -1
  106. data/lib/matchers/matchers.rb +2 -0
  107. data/lib/resources/etc_hosts.rb +1 -1
  108. data/lib/resources/host.rb +4 -1
  109. data/lib/resources/http.rb +173 -23
  110. data/lib/resources/processes.rb +106 -20
  111. data/lib/resources/ssh_conf.rb +1 -1
  112. data/lib/resources/ssl.rb +4 -3
  113. data/lib/utils/object_traversal.rb +35 -10
  114. metadata +2 -2
@@ -8,6 +8,8 @@ Use the `firewalld` InSpec audit resource to test that firewalld is configured t
8
8
 
9
9
  A firewalld has a number of zones that can be configured to allow and deny access to specific hosts, services, and ports.
10
10
 
11
+ <br>
12
+
11
13
  ## Syntax
12
14
 
13
15
  describe firewalld do
@@ -24,6 +26,8 @@ Use the where clause to test open interfaces, sources, and services in active zo
24
26
  its('sources') { should cmp ['192.168.1.0/24', '192.168.1.2'] }
25
27
  its('services') { should cmp ['ssh', 'icmp'] }
26
28
  end
29
+
30
+ <br>
27
31
 
28
32
  ## Supported Properties
29
33
 
@@ -57,9 +61,11 @@ The `default_zone` property displays the default active zone to be used.
57
61
 
58
62
  its('default_zone') { should eq 'public' }
59
63
 
64
+ <br>
65
+
60
66
  ## Matchers
61
67
 
62
- This InSpec audit resource has the following matchers:
68
+ This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
63
69
 
64
70
  ### `be_installed`
65
71
 
@@ -6,6 +6,8 @@ title: About the gem Resource
6
6
 
7
7
  Use the `gem` InSpec audit resource to test if a global Gem package is installed.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `gem` resource block declares a package and (optionally) a package version:
@@ -20,41 +22,7 @@ where
20
22
  * `('gem_binary')` can specify the path to a non-default gem binary, defaults to `'gem'`
21
23
  * `be_installed` is a valid matcher for this resource
22
24
 
23
- ## Matchers
24
-
25
- This InSpec audit resource has the following matchers:
26
-
27
- ### be
28
-
29
- <%= partial "/shared/matcher_be" %>
30
-
31
- ### be_installed
32
-
33
- The `be_installed` matcher tests if the named Gem package is installed:
34
-
35
- it { should be_installed }
36
-
37
- ### cmp
38
-
39
- <%= partial "/shared/matcher_cmp" %>
40
-
41
- ### eq
42
-
43
- <%= partial "/shared/matcher_eq" %>
44
-
45
- ### include
46
-
47
- <%= partial "/shared/matcher_include" %>
48
-
49
- ### match
50
-
51
- <%= partial "/shared/matcher_match" %>
52
-
53
- ### version
54
-
55
- The `version` matcher tests if the named package version is on the system:
56
-
57
- its('version') { should eq '0.33.0' }
25
+ <br>
58
26
 
59
27
  ## Examples
60
28
 
@@ -90,3 +58,21 @@ The following examples show how to use this InSpec audit resource.
90
58
  describe gem('knife-backup', :chef_server) do
91
59
  it { should be_installed }
92
60
  end
61
+
62
+ <br>
63
+
64
+ ## Matchers
65
+
66
+ This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
67
+
68
+ ### be_installed
69
+
70
+ The `be_installed` matcher tests if the named Gem package is installed:
71
+
72
+ it { should be_installed }
73
+
74
+ ### version
75
+
76
+ The `version` matcher tests if the named package version is on the system:
77
+
78
+ its('version') { should eq '0.33.0' }
@@ -6,6 +6,8 @@ title: About the group Resource
6
6
 
7
7
  Use the `group` InSpec audit resource to test groups on the system.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `group` resource block declares a group, and then the details to be tested, such as if the group is a local group, the group identifier, or if the group exists:
@@ -20,27 +22,30 @@ where
20
22
  * `'group_name'` must specify the name of a group on the system
21
23
  * `exist` and `'gid'` are valid matchers for this resource
22
24
 
23
- ## Matchers
25
+ <br>
24
26
 
25
- This InSpec audit resource has the following matchers:
27
+ ## Examples
26
28
 
27
- ### be
29
+ The following examples show how to use this InSpec audit resource.
28
30
 
29
- <%= partial "/shared/matcher_be" %>
31
+ ### Test the group identifier for the root group
30
32
 
31
- ### be_local
33
+ describe group('root') do
34
+ it { should exist }
35
+ its('gid') { should eq 0 }
36
+ end
32
37
 
33
- The `be_local` matcher tests if the group is a local group:
38
+ <br>
34
39
 
35
- it { should be_local }
40
+ ## Matchers
36
41
 
37
- ### cmp
42
+ This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
38
43
 
39
- <%= partial "/shared/matcher_cmp" %>
44
+ ### be_local
40
45
 
41
- ### eq
46
+ The `be_local` matcher tests if the group is a local group:
42
47
 
43
- <%= partial "/shared/matcher_eq" %>
48
+ it { should be_local }
44
49
 
45
50
  ### exist
46
51
 
@@ -53,22 +58,3 @@ The `exist` matcher tests if the named user exists:
53
58
  The `gid` matcher tests the named group identifier:
54
59
 
55
60
  its('gid') { should eq 1234 }
56
-
57
- ### include
58
-
59
- <%= partial "/shared/matcher_include" %>
60
-
61
- ### match
62
-
63
- <%= partial "/shared/matcher_match" %>
64
-
65
- ## Examples
66
-
67
- The following examples show how to use this InSpec audit resource.
68
-
69
- ### Test the group identifier for the root group
70
-
71
- describe group('root') do
72
- it { should exist }
73
- its('gid') { should eq 0 }
74
- end
@@ -6,6 +6,8 @@ title: About the grub_conf Resource
6
6
 
7
7
  Grub is a boot loader on the Linux platform used to load and then transfer control to an operating system kernel, after which that kernel initializes the rest of the operating system. Use the `grub_conf` InSpec audit resource to test boot loader configuration settings that are defined in the `grub.conf` configuration file.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `grub_conf` resource block declares a list of settings in a `grub.conf` file:
@@ -28,30 +30,7 @@ where
28
30
  * `'kernel'` specifies the default kernel (by using `'default'`) or a specific kernel; `'default'` defines the position in the list of kernels at which the default kernel is defined, i.e. `should eq '0'` for the first kernel listed or `'path', 'default'` to use the default kernel as specified in the `grub.conf` file
29
31
  * `'value'` is the value that is expected
30
32
 
31
-
32
- ## Matchers
33
-
34
- This InSpec audit resource has the following matchers:
35
-
36
- ### be
37
-
38
- <%= partial "/shared/matcher_be" %>
39
-
40
- ### cmp
41
-
42
- <%= partial "/shared/matcher_cmp" %>
43
-
44
- ### eq
45
-
46
- <%= partial "/shared/matcher_eq" %>
47
-
48
- ### include
49
-
50
- <%= partial "/shared/matcher_include" %>
51
-
52
- ### match
53
-
54
- <%= partial "/shared/matcher_match" %>
33
+ <br>
55
34
 
56
35
  ## Examples
57
36
 
@@ -113,3 +92,9 @@ The following test verifies the `ramdisk_size` for the non-deault kernel:
113
92
  grub_conf('/etc/grub.conf', 'CentOS (2.6.32-573.12.1.el6.x86_64)') do
114
93
  its('kernel') { should include 'audit=1' }
115
94
  end
95
+
96
+ <br>
97
+
98
+ ## Matchers
99
+
100
+ For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -6,17 +6,17 @@ title: About the host Resource
6
6
 
7
7
  Use the `host` InSpec audit resource to test the name used to refer to a specific host and its availability, including the Internet protocols and ports over which that host name should be available.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `host` resource block declares a host name, and then (depending on what is to be tested) a port and/or a protocol:
12
14
 
13
- .. code-block:: ruby
14
-
15
- describe host('example.com', port: 80, protocol: 'tcp') do
16
- it { should be_reachable }
17
- it { should be_resolvable }
18
- its('ipaddress') { should include '12.34.56.78' }
19
- end
15
+ describe host('example.com', port: 80, protocol: 'tcp') do
16
+ it { should be_reachable }
17
+ it { should be_resolvable }
18
+ its('ipaddress') { should include '12.34.56.78' }
19
+ end
20
20
 
21
21
  where
22
22
 
@@ -25,48 +25,7 @@ where
25
25
  * `port:` is the port number
26
26
  * `protocol: 'name'` is the Internet protocol: TCP (`protocol: 'tcp'`), UDP (`protocol: 'udp'` or ICMP (`protocol: 'icmp'`))
27
27
 
28
-
29
- ## Matchers
30
-
31
- This InSpec audit resource has the following matchers:
32
-
33
- ### be
34
-
35
- <%= partial "/shared/matcher_be" %>
36
-
37
- ### be_reachable
38
-
39
- The `be_reachable` matcher tests if the host name is available:
40
-
41
- it { should be_reachable }
42
-
43
- ### be_resolvable
44
-
45
- The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
46
-
47
- it { should be_resolvable }
48
-
49
- ### cmp
50
-
51
- <%= partial "/shared/matcher_cmp" %>
52
-
53
- ### eq
54
-
55
- <%= partial "/shared/matcher_eq" %>
56
-
57
- ### include
58
-
59
- <%= partial "/shared/matcher_include" %>
60
-
61
- ### ipaddress
62
-
63
- The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
64
-
65
- its('ipaddress') { should include '93.184.216.34' }
66
-
67
- ### match
68
-
69
- <%= partial "/shared/matcher_match" %>
28
+ <br>
70
29
 
71
30
  ## Examples
72
31
 
@@ -92,3 +51,27 @@ The following examples show how to use this InSpec audit resource.
92
51
  its('connection') { should_not match /connection refused/ }
93
52
  its('socket') { should match /STATUS_OK/ }
94
53
  end
54
+
55
+ <br>
56
+
57
+ ## Matchers
58
+
59
+ This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
60
+
61
+ ### be_reachable
62
+
63
+ The `be_reachable` matcher tests if the host name is available:
64
+
65
+ it { should be_reachable }
66
+
67
+ ### be_resolvable
68
+
69
+ The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
70
+
71
+ it { should be_resolvable }
72
+
73
+ ### ipaddress
74
+
75
+ The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
76
+
77
+ its('ipaddress') { should include '93.184.216.34' }
@@ -6,9 +6,14 @@ title: About the http Resource
6
6
 
7
7
  Use the `http` InSpec audit resource to test an http endpoint.
8
8
 
9
- <p class="warning">Currently, this resource always executes on the host on which <code>inspec exec</code> is run, even if you use the <code>--target</code> option to remotely scan a different host.<br>
9
+ <p class="warning">In InSpec 1.40 and earlier, this resource always executes on the host on which <code>inspec exec</code> is run, even if you use the <code>--target</code> option to remotely scan a different host.<br>
10
+ <br>
11
+ Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target, provided <code>curl</code> is available. See the "Local vs. Remote" section below.<br>
12
+ <br>
13
+ Executing the HTTP test on the remote target will be the default behavior in InSpec 2.0.
14
+ </p>
15
+
10
16
  <br>
11
- This will be corrected in a future version of InSpec. New InSpec releases are posted in the <a href="https://discourse.chef.io/c/chef-release" target="_blank">Release Announcements Category in Discourse</a>.</p>
12
17
 
13
18
  ## Syntax
14
19
 
@@ -32,51 +37,16 @@ where
32
37
  * `read_timeout` may be specified for a timeout for reading connections (default to 60)
33
38
  * `ssl_verify` may be specified to enable or disable verification of SSL certificates (default to `true`)
34
39
 
35
- ## Matchers
36
-
37
- This InSpec audit resource has the following matchers:
38
-
39
- ### be
40
-
41
- <%= partial "/shared/matcher_be" %>
42
-
43
- ### body
44
-
45
- The `body` matcher tests body content of http response:
46
-
47
- its('body') { should eq 'hello\n' }
48
-
49
- ### cmp
50
-
51
- <%= partial "/shared/matcher_cmp" %>
52
-
53
- ### eq
54
-
55
- <%= partial "/shared/matcher_eq" %>
56
-
57
- ### headers
58
-
59
- The `headers` matcher returns an hash of all http headers:
60
-
61
- its('headers') { should eq {} }
62
-
63
- Individual headers can be tested via:
64
-
65
- its('headers.Content-Type') { should cmp 'text/html' }
66
-
67
- ### include
68
-
69
- <%= partial "/shared/matcher_include" %>
70
-
71
- ### match
72
-
73
- <%= partial "/shared/matcher_match" %>
40
+ <br>
41
+ ## Local vs. Remote
74
42
 
75
- ### status
43
+ Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target:
76
44
 
77
- The `status` matcher tests status of the http response:
45
+ describe http('http://www.example.com', enable_remote_worker: true) do
46
+ its('body') { should cmp 'awesome' }
47
+ end
78
48
 
79
- its('status') { should eq 200 }
49
+ In InSpec 2.0, the HTTP test will automatically execute remotely whenever InSpec is testing a remote node.
80
50
 
81
51
  ## Examples
82
52
 
@@ -102,3 +72,27 @@ For example, a service is listening on default http port can be tested like this
102
72
  its('body') { should cmp 'pong' }
103
73
  its('headers.Content-Type') { should cmp 'text/html' }
104
74
  end
75
+
76
+ <br>
77
+
78
+ ### body
79
+
80
+ The `body` matcher tests body content of http response:
81
+
82
+ its('body') { should eq 'hello\n' }
83
+
84
+ ### headers
85
+
86
+ The `headers` matcher returns an hash of all http headers:
87
+
88
+ its('headers') { should eq {} }
89
+
90
+ Individual headers can be tested via:
91
+
92
+ its('headers.Content-Type') { should cmp 'text/html' }
93
+
94
+ ### status
95
+
96
+ The `status` matcher tests status of the http response:
97
+
98
+ its('status') { should eq 200 }
@@ -6,6 +6,8 @@ title: About the iis_app Resource
6
6
 
7
7
  Use the `iis_app` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `iis_app` resource block declares details about the named site:
@@ -38,17 +40,34 @@ For example:
38
40
  it { should have_path('\\My Application') }
39
41
  end
40
42
 
41
- ## Matchers
43
+ <br>
44
+
45
+ ## Examples
46
+
47
+ The following examples show how to use this InSpec audit resource.
48
+
49
+ ### Test a default IIS web application
50
+
51
+ describe iis_app('Default Web Site') do
52
+ it { should exist }
53
+ it { should be_running }
54
+ it { should have_app_pool('DefaultAppPool') }
55
+ it { should have_binding('http *:80:') }
56
+ it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
57
+ end
42
58
 
43
- This InSpec audit resource has the following matchers:
59
+ ### Test if IIS service is running
44
60
 
45
- ### cmp
61
+ describe service('W3SVC') do
62
+ it { should be_installed }
63
+ it { should be_running }
64
+ end
46
65
 
47
- <%= partial "/shared/matcher_cmp" %>
66
+ <br>
48
67
 
49
- ### eq
68
+ ## Matchers
50
69
 
51
- <%= partial "/shared/matcher_eq" %>
70
+ This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
52
71
 
53
72
  ### exist
54
73
 
@@ -95,32 +114,3 @@ Testing a web application with https enabled and http enabled:
95
114
  The `have_physical_path` matcher tests if the named path is defined for the web application:
96
115
 
97
116
  it { should have_physical_path('C:\\inetpub\\wwwroot') }
98
-
99
- ### include
100
-
101
- <%= partial "/shared/matcher_include" %>
102
-
103
- ### match
104
-
105
- <%= partial "/shared/matcher_match" %>
106
-
107
- ## Examples
108
-
109
- The following examples show how to use this InSpec audit resource.
110
-
111
- ### Test a default IIS web application
112
-
113
- describe iis_app('Default Web Site') do
114
- it { should exist }
115
- it { should be_running }
116
- it { should have_app_pool('DefaultAppPool') }
117
- it { should have_binding('http *:80:') }
118
- it { should have_path('%SystemDrive%\\inetpub\\wwwroot') }
119
- end
120
-
121
- ### Test if IIS service is running
122
-
123
- describe service('W3SVC') do
124
- it { should be_installed }
125
- it { should be_running }
126
- end