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
@@ -6,6 +6,8 @@ title: About the sysv_service Resource
6
6
 
7
7
  Use the `sysv_service` InSpec audit resource to test a service using SystemV.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `sysv_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
@@ -29,13 +31,11 @@ The path to the service manager's control may be specified for situations where
29
31
  it { should be_running }
30
32
  end
31
33
 
32
- ## Matchers
33
-
34
- This InSpec audit resource has the following matchers:
34
+ <br>
35
35
 
36
- ### be
36
+ ## Matchers
37
37
 
38
- <%= partial "/shared/matcher_be" %>
38
+ 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/).
39
39
 
40
40
  ### be_enabled
41
41
 
@@ -54,23 +54,3 @@ The `be_installed` matcher tests if the named service is installed:
54
54
  The `be_running` matcher tests if the named service is running:
55
55
 
56
56
  it { should be_running }
57
-
58
- ### cmp
59
-
60
- <%= partial "/shared/matcher_cmp" %>
61
-
62
- ### eq
63
-
64
- <%= partial "/shared/matcher_eq" %>
65
-
66
- ### include
67
-
68
- <%= partial "/shared/matcher_include" %>
69
-
70
- ### match
71
-
72
- <%= partial "/shared/matcher_match" %>
73
-
74
- ## Examples
75
-
76
- None.
@@ -6,6 +6,8 @@ title: About the upstart_service Resource
6
6
 
7
7
  Use the `upstart_service` InSpec audit resource to test a service using Upstart.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `upstart_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
@@ -29,13 +31,11 @@ The path to the service manager's control may be specified for situations where
29
31
  it { should be_running }
30
32
  end
31
33
 
32
- ## Matchers
33
-
34
- This InSpec audit resource has the following matchers:
34
+ <br>
35
35
 
36
- ### be
36
+ ## Matchers
37
37
 
38
- <%= partial "/shared/matcher_be" %>
38
+ 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/).
39
39
 
40
40
  ### be_enabled
41
41
 
@@ -54,23 +54,3 @@ The `be_installed` matcher tests if the named service is installed:
54
54
  The `be_running` matcher tests if the named service is running:
55
55
 
56
56
  it { should be_running }
57
-
58
- ### cmp
59
-
60
- <%= partial "/shared/matcher_cmp" %>
61
-
62
- ### eq
63
-
64
- <%= partial "/shared/matcher_eq" %>
65
-
66
- ### include
67
-
68
- <%= partial "/shared/matcher_include" %>
69
-
70
- ### match
71
-
72
- <%= partial "/shared/matcher_match" %>
73
-
74
- ## Examples
75
-
76
- None.
@@ -6,6 +6,8 @@ title: About the user Resource
6
6
 
7
7
  Use the `user` InSpec audit resource to test user profiles for a single, known/expected local user, including the groups to which that user belongs, the frequency of required password changes, and the directory paths to home and shell.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `user` resource block declares a user name, and then one (or more) matchers:
@@ -29,21 +31,40 @@ where
29
31
  * `it { should exist }` tests if the user exists
30
32
  * `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
31
33
 
32
- ## Matchers
34
+ <br>
35
+ ## Examples
33
36
 
34
- This InSpec audit resource has the following matchers:
37
+ The following examples show how to use this InSpec audit resource.
35
38
 
36
- ### be
39
+ ### Verify available users for the MySQL server
37
40
 
38
- <%= partial "/shared/matcher_be" %>
41
+ describe user('root') do
42
+ it { should exist }
43
+ it { should belong_to_group 'root' }
44
+ its('uid') { should eq 0 }
45
+ its('groups') { should eq ['root'] }
46
+ end
39
47
 
40
- ### cmp
48
+ describe user('mysql') do
49
+ it { should_not exist }
50
+ end
41
51
 
42
- <%= partial "/shared/matcher_cmp" %>
52
+ ### Test users on multiple platforms
43
53
 
44
- ### eq
54
+ The `nginx` user is typically `www-data`, but on CentOS it's `nginx`. The following example shows how to test for the `nginx` user with a single test, but accounting for all platforms:
55
+
56
+ web_user = 'www-data'
57
+ web_user = 'nginx' if os[:family] == 'centos'
58
+
59
+ describe user(web_user) do
60
+ it { should exist }
61
+ end
62
+
63
+ <br>
64
+
65
+ ## Matchers
45
66
 
46
- <%= partial "/shared/matcher_eq" %>
67
+ 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/).
47
68
 
48
69
  ### exist
49
70
 
@@ -79,14 +100,6 @@ The `home` matcher tests the home directory path for the user:
79
100
 
80
101
  its('home') { should eq '/root' }
81
102
 
82
- ### include
83
-
84
- <%= partial "/shared/matcher_include" %>
85
-
86
- ### match
87
-
88
- <%= partial "/shared/matcher_match" %>
89
-
90
103
  ### maxdays
91
104
 
92
105
  The `maxdays` matcher tests the maximum number of days between password changes:
@@ -124,31 +137,3 @@ The `warndays` matcher tests the number of days a user is warned before a passwo
124
137
  its('warndays') { should eq 5 }
125
138
 
126
139
  where `5` represents the number of days a user is warned.
127
-
128
- ## Examples
129
-
130
- The following examples show how to use this InSpec audit resource.
131
-
132
- ### Verify available users for the MySQL server
133
-
134
- describe user('root') do
135
- it { should exist }
136
- it { should belong_to_group 'root' }
137
- its('uid') { should eq 0 }
138
- its('groups') { should eq ['root'] }
139
- end
140
-
141
- describe user('mysql') do
142
- it { should_not exist }
143
- end
144
-
145
- ### Test users on multiple platforms
146
-
147
- The `nginx` user is typically `www-data`, but on CentOS it's `nginx`. The following example shows how to test for the `nginx` user with a single test, but accounting for all platforms:
148
-
149
- web_user = 'www-data'
150
- web_user = 'nginx' if os[:family] == 'centos'
151
-
152
- describe user(web_user) do
153
- it { should exist }
154
- end
@@ -6,6 +6,8 @@ title: About the users Resource
6
6
 
7
7
  Use the `users` InSpec audit resource to look up all local users available on the system, and then test specific properties of those users. This resource does not return information about users that may be located on other systems, such as LDAP or Active Directory.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `users` resource block declares a user name, and then one (or more) matchers:
@@ -33,21 +35,23 @@ or:
33
35
  it { should exist }
34
36
  end
35
37
 
36
- ## Matchers
38
+ <br>
37
39
 
38
- This InSpec audit resource has the following matchers:
40
+ ## Examples
39
41
 
40
- ### be
42
+ The following examples show how to use this InSpec audit resource.
41
43
 
42
- <%= partial "/shared/matcher_be" %>
44
+ ### Use a regular expression to find users
43
45
 
44
- ### cmp
46
+ describe users.where { uid =~ /S\-1\-5\-21\-\d+\-\d+\-\d+\-500/ } do
47
+ it { should exist }
48
+ end
45
49
 
46
- <%= partial "/shared/matcher_cmp" %>
50
+ <br>
47
51
 
48
- ### eq
52
+ ## Matchers
49
53
 
50
- <%= partial "/shared/matcher_eq" %>
54
+ 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/).
51
55
 
52
56
  ### exist
53
57
 
@@ -83,14 +87,6 @@ The `home` matcher tests the home directory path for the user:
83
87
 
84
88
  its('home') { should eq '/root' }
85
89
 
86
- ### include
87
-
88
- <%= partial "/shared/matcher_include" %>
89
-
90
- ### match
91
-
92
- <%= partial "/shared/matcher_match" %>
93
-
94
90
  ### maxdays
95
91
 
96
92
  The `maxdays` matcher tests the maximum number of days between password changes:
@@ -128,13 +124,3 @@ The `warndays` matcher tests the number of days a user is warned before a passwo
128
124
  its('warndays') { should eq 5 }
129
125
 
130
126
  where `5` represents the number of days a user is warned.
131
-
132
- ## Examples
133
-
134
- The following examples show how to use this InSpec audit resource.
135
-
136
- ### Use a regular expression to find users
137
-
138
- describe users.where { uid =~ /S\-1\-5\-21\-\d+\-\d+\-\d+\-500/ } do
139
- it { should exist }
140
- end
@@ -6,6 +6,8 @@ title: About the vbscript Resource
6
6
 
7
7
  Use the `vbscript` InSpec audit resource to test a VBScript on the Windows platform.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `vbscript` resource block tests the output of a VBScript on the Windows platform:
@@ -19,30 +21,7 @@ where
19
21
  * `'script_name'` is the name of the VBScript to test
20
22
  * `('output')` is the expected output of the VBScript
21
23
 
22
-
23
- ## Matchers
24
-
25
- This InSpec audit resource has the following matchers:
26
-
27
- ### be
28
-
29
- <%= partial "/shared/matcher_be" %>
30
-
31
- ### cmp
32
-
33
- <%= partial "/shared/matcher_cmp" %>
34
-
35
- ### eq
36
-
37
- <%= partial "/shared/matcher_eq" %>
38
-
39
- ### include
40
-
41
- <%= partial "/shared/matcher_include" %>
42
-
43
- ### match
44
-
45
- <%= partial "/shared/matcher_match" %>
24
+ <br>
46
25
 
47
26
  ## Examples
48
27
 
@@ -67,3 +46,9 @@ and tested for whitespace removal from standard output:
67
46
  describe vbscript(script) do
68
47
  its('strip') { should eq "hello" }
69
48
  end
49
+
50
+ <br>
51
+
52
+ ## Matchers
53
+
54
+ For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -6,6 +6,8 @@ title: About the virtualization Resource
6
6
 
7
7
  Use the `virtualization` InSpec audit resource to test the virtualization platform on which the system is running.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `virtualization` resource block declares the virtualization platform that should be tested:
@@ -20,29 +22,7 @@ where
20
22
  * `MATCHER` is a valid matcher for this resource
21
23
  * `'value'` is the value to be tested
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
- ### cmp
32
-
33
- <%= partial "/shared/matcher_cmp" %>
34
-
35
- ### eq
36
-
37
- <%= partial "/shared/matcher_eq" %>
38
-
39
- ### include
40
-
41
- <%= partial "/shared/matcher_include" %>
42
-
43
- ### match
44
-
45
- <%= partial "/shared/matcher_match" %>
25
+ <br>
46
26
 
47
27
  ## Examples
48
28
 
@@ -69,3 +49,8 @@ The following examples show how to use this InSpec audit resource.
69
49
  end
70
50
  end
71
51
 
52
+ <br>
53
+
54
+ ## Matchers
55
+
56
+ For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -6,6 +6,8 @@ title: About the windows_feature Resource
6
6
 
7
7
  Use the `windows_feature` InSpec audit resource to test features on Windows via the `Get-WindowsFeature` cmdlet.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `windows_feature` resource block declares the name of the Windows feature, tests if that feature is installed, and then returns information about that feature:
@@ -19,36 +21,7 @@ where
19
21
  * `('feature_name')` must specify a Windows feature name, such as `DHCP Server` or `IIS-Webserver`
20
22
  * `be_installed` is a valid matcher for this resource
21
23
 
22
-
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 Windows feature 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" %>
24
+ <br>
52
25
 
53
26
  ## Examples
54
27
 
@@ -59,3 +32,15 @@ The following examples show how to use this InSpec audit resource.
59
32
  describe windows_feature('DHCP Server') do
60
33
  it{ should be_installed }
61
34
  end
35
+
36
+ <br>
37
+
38
+ ## Matchers
39
+
40
+ 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/).
41
+
42
+ ### be_installed
43
+
44
+ The `be_installed` matcher tests if the named Windows feature is installed:
45
+
46
+ it { should be_installed }
@@ -4,6 +4,8 @@ title: About the windows_hotfix Resource
4
4
 
5
5
  Use the `windows_hotfix` InSpec audit resource to test if the hotfix has been installed on a Windows system.
6
6
 
7
+ <br>
8
+
7
9
  ## Syntax
8
10
 
9
11
  A `windows_hotfix` resource block declares a hotfix to validate:
@@ -17,15 +19,7 @@ where
17
19
  * `('name')` must specify the name of a hotfix, such as `'KB4012213'`
18
20
  * `be_installed` is a valid matcher for this resource
19
21
 
20
- ## Matcher
21
-
22
- This InSpec audit resource has the following matcher:
23
-
24
- ### be_installed
25
-
26
- The `be_installed` matcher tests if the named hotfix is installed on the system:
27
-
28
- it { should be_installed }
22
+ <br>
29
23
 
30
24
  ## Examples
31
25
 
@@ -42,3 +36,15 @@ The following examples show how to use this InSpec audit resource.
42
36
  describe windows_hotfix('KB9999999') do
43
37
  it { should_not be_installed }
44
38
  end
39
+
40
+ <br>
41
+
42
+ ## Matchers
43
+
44
+ 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/).
45
+
46
+ ### be_installed
47
+
48
+ The `be_installed` matcher tests if the named hotfix is installed on the system:
49
+
50
+ it { should be_installed }