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 audit_policy Resource
6
6
 
7
7
  Use the `audit_policy` Inspec audit resource to test auditing policies on the Windows platform. An auditing policy is a category of security-related events to be audited. Auditing is disabled by default and may be enabled for categories like account management, logon events, policy changes, process tracking, privilege use, system events, or object access. For each auditing category property that is enabled, the auditing level may be set to `No Auditing`, `Not Specified`, `Success`, `Success and Failure`, or `Failure`.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `audit_policy` resource block declares a parameter that belongs to an audit policy category or subcategory:
@@ -19,30 +21,7 @@ where
19
21
  * `'parameter'` must specify a parameter
20
22
  * `'value'` must be one of `No Auditing`, `Not Specified`, `Success`, `Success and Failure`, or `Failure`
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
 
@@ -59,3 +38,9 @@ The following examples show how to use this InSpec audit resource.
59
38
  describe audit_policy do
60
39
  its('User Account Management') { should eq 'Success' }
61
40
  end
41
+
42
+ <br>
43
+
44
+ ## Matchers
45
+
46
+ 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 auditd Resource
6
6
 
7
7
  Use the `auditd` InSpec audit resource to test the rules for logging that exist on the system. The audit.rules file is typically located under /etc/audit/ and contains the list of rules that define what is captured in log files. These rules are output using the auditcl -l command. This resource supports versions of `audit` >= 2.3.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `auditd` resource block declares one (or more) rules to be tested, and then what that rule should do:
@@ -23,30 +25,7 @@ or test that multiple individual rules are defined:
23
25
 
24
26
  where each test must declare one (or more) rules to be tested.
25
27
 
26
-
27
- ## Matchers
28
-
29
- This InSpec audit resource has the following matchers:
30
-
31
- ### be
32
-
33
- <%= partial "/shared/matcher_be" %>
34
-
35
- ### cmp
36
-
37
- <%= partial "/shared/matcher_cmp" %>
38
-
39
- ### eq
40
-
41
- <%= partial "/shared/matcher_eq" %>
42
-
43
- ### include
44
-
45
- <%= partial "/shared/matcher_include" %>
46
-
47
- ### match
48
-
49
- <%= partial "/shared/matcher_match" %>
28
+ <br>
50
29
 
51
30
  ## Examples
52
31
 
@@ -91,3 +70,9 @@ The key filter may be useful in evaluating rules with particular key values:
91
70
  describe auditd.where { key == "privileged" } do
92
71
  its('permissions') { should include ['x'] }
93
72
  end
73
+
74
+ <br>
75
+
76
+ ## Matchers
77
+
78
+ 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 auditd_conf Resource
6
6
 
7
7
  Use the `auditd_conf` InSpec audit resource to test the configuration settings for the audit daemon. This file is typically located under `/etc/audit/auditd.conf'` on Unix and Linux platforms.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `auditd_conf` resource block declares configuration settings that should be tested:
@@ -20,40 +22,7 @@ where
20
22
  * `('path')` is the non-default path to the `auditd.conf` configuration file
21
23
  * `{ should cmp 'value' }` is the value that is expected
22
24
 
23
-
24
- ## Matchers
25
-
26
- This InSpec audit resource has the following matchers:
27
-
28
- ### be
29
-
30
- <%= partial "/shared/matcher_be" %>
31
-
32
- ### cmp
33
-
34
- <%= partial "/shared/matcher_cmp" %>
35
-
36
- ### eq
37
-
38
- <%= partial "/shared/matcher_eq" %>
39
-
40
- ### include
41
-
42
- <%= partial "/shared/matcher_include" %>
43
-
44
- ### keyword
45
-
46
- This matcher will matche any keyword that is listed in the `auditd.conf` configuration file. Option names and values are case-insensitive:
47
-
48
- its('log_format') { should cmp 'raw' }
49
-
50
- or:
51
-
52
- its('max_log_file') { should cmp 6 }
53
-
54
- ### match
55
-
56
- <%= partial "/shared/matcher_match" %>
25
+ <br>
57
26
 
58
27
  ## Examples
59
28
 
@@ -77,3 +46,20 @@ The following examples show how to use this InSpec audit resource.
77
46
  its('disk_full_action') { should cmp 'halt' }
78
47
  its('disk_error_action') { should cmp 'halt' }
79
48
  end
49
+
50
+ <br>
51
+
52
+ ## Matchers
53
+
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/).
55
+
56
+
57
+ ### keyword
58
+
59
+ This matcher will matche any keyword that is listed in the `auditd.conf` configuration file. Option names and values are case-insensitive:
60
+
61
+ its('log_format') { should cmp 'raw' }
62
+
63
+ or:
64
+
65
+ its('max_log_file') { should cmp 6 }
@@ -6,6 +6,7 @@ title: About the auditd_rules Resource
6
6
 
7
7
  Use the `auditd_rules` InSpec audit resource to test the rules for logging that exist on the system. The `audit.rules` file is typically located under `/etc/audit/` and contains the list of rules that define what is captured in log files. This resource uses `auditctl` to query the run-time `auditd` rules setup, which may be different from `audit.rules`.
8
8
 
9
+ <br>
9
10
 
10
11
  ## Syntax
11
12
 
@@ -61,30 +62,7 @@ or test that individual rules are defined:
61
62
 
62
63
  where each test must declare one (or more) rules to be tested.
63
64
 
64
-
65
- ## Matchers
66
-
67
- This InSpec audit resource has the following matchers:
68
-
69
- ### be
70
-
71
- <%= partial "/shared/matcher_be" %>
72
-
73
- ### cmp
74
-
75
- <%= partial "/shared/matcher_cmp" %>
76
-
77
- ### eq
78
-
79
- <%= partial "/shared/matcher_eq" %>
80
-
81
- ### include
82
-
83
- <%= partial "/shared/matcher_include" %>
84
-
85
- ### match
86
-
87
- <%= partial "/shared/matcher_match" %>
65
+ <br>
88
66
 
89
67
  ## Examples
90
68
 
@@ -130,3 +108,9 @@ Filters may be chained. For example:
130
108
  describe auditd_rules.syscall('open').action('always').list do
131
109
  it { should eq(['exit']) }
132
110
  end
111
+
112
+ <br>
113
+
114
+ ## Matchers
115
+
116
+ 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 bash Resource
6
6
 
7
7
  Use the `bash` InSpec audit resource to test an arbitrary command that is run on the system using a Bash script.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `command` resource block declares a command to be run, one (or more) expected outputs, and the location to which that output is sent:
@@ -29,22 +31,11 @@ For example:
29
31
  its('exit_status') { should eq 0 }
30
32
  end
31
33
 
34
+ <br>
32
35
 
33
36
  ## Matchers
34
37
 
35
- This InSpec audit resource has the following matchers:
36
-
37
- ### be
38
-
39
- <%= partial "/shared/matcher_be" %>
40
-
41
- ### cmp
42
-
43
- <%= partial "/shared/matcher_cmp" %>
44
-
45
- ### eq
46
-
47
- <%= partial "/shared/matcher_eq" %>
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/).
48
39
 
49
40
  ### exist
50
41
 
@@ -58,14 +49,6 @@ The `exit_status` matcher tests the exit status for the command:
58
49
 
59
50
  its('exit_status') { should eq 0 }
60
51
 
61
- ### include
62
-
63
- <%= partial "/shared/matcher_include" %>
64
-
65
- ### match
66
-
67
- <%= partial "/shared/matcher_match" %>
68
-
69
52
  ### stderr
70
53
 
71
54
  The `stderr` matcher tests results of the command as returned in standard error (stderr):
@@ -77,8 +60,3 @@ The `stderr` matcher tests results of the command as returned in standard error
77
60
  The `stdout` matcher tests results of the command as returned in standard output (stdout).
78
61
 
79
62
  its('stdout') { should match /bin/ }
80
-
81
-
82
- ## Examples
83
-
84
- None.
@@ -6,6 +6,8 @@ title: About the bond Resource
6
6
 
7
7
  Use the `bond` InSpec audit resource to test a logical, bonded network interface (i.e. "two or more network interfaces aggregated into a single, logical network interface"). On Linux platforms, any value in the `/proc/net/bonding` directory may be tested.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `bond` resource block declares a bonded network interface, and then specifies the properties of that bonded network interface to be tested:
@@ -19,18 +21,35 @@ where
19
21
  * `'name'` is the name of the bonded network interface
20
22
  * `{ should exist }` is a valid matcher for this resource
21
23
 
24
+ <br>
22
25
 
23
- ## Matchers
26
+ ## Examples
24
27
 
25
- This InSpec audit resource has the following matchers:
28
+ The following examples show how to use this InSpec audit resource.
26
29
 
27
- ### be
30
+ ### Test if eth0 is a secondary interface for bond0
28
31
 
29
- <%= partial "/shared/matcher_be" %>
32
+ describe bond('bond0') do
33
+ it { should exist }
34
+ it { should have_interface 'eth0' }
35
+ end
30
36
 
31
- ### cmp
37
+ ### Test parameters for bond0
32
38
 
33
- <%= partial "/shared/matcher_cmp" %>
39
+ describe bond('bond0') do
40
+ its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
41
+ its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
42
+ its('MII Status') { should eq 'up' }
43
+ its('MII Polling Interval (ms)') { should eq '100' }
44
+ its('Up Delay (ms)') { should eq '0' }
45
+ its('Down Delay (ms)') { should eq '0' }
46
+ end
47
+
48
+ <br>
49
+
50
+ ## Matchers
51
+
52
+ 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/).
34
53
 
35
54
  ### content
36
55
 
@@ -38,10 +57,6 @@ The `content` matcher tests if contents in the file that defines the bonded netw
38
57
 
39
58
  its('content') { should match('value') }
40
59
 
41
- ### eq
42
-
43
- <%= partial "/shared/matcher_eq" %>
44
-
45
60
  ### exist
46
61
 
47
62
  The `exist` matcher tests if the bonded network interface is available:
@@ -54,44 +69,14 @@ The `have_interface` matcher tests if the bonded network interface has one (or m
54
69
 
55
70
  it { should have_interface }
56
71
 
57
- ### include
58
-
59
- <%= partial "/shared/matcher_include" %>
60
-
61
72
  ### interfaces
62
73
 
63
74
  The `interfaces` matcher tests if the named secondary interfaces are available:
64
75
 
65
76
  its('interfaces') { should eq ['eth0', 'eth1', ...] }
66
77
 
67
- ### match
68
-
69
- <%= partial "/shared/matcher_match" %>
70
-
71
78
  ### params
72
79
 
73
80
  The `params` matcher tests arbitrary parameters for the bonded network interface:
74
81
 
75
82
  its('params') { should eq 'value' }
76
-
77
- ## Examples
78
-
79
- The following examples show how to use this InSpec audit resource.
80
-
81
- ### Test if eth0 is a secondary interface for bond0
82
-
83
- describe bond('bond0') do
84
- it { should exist }
85
- it { should have_interface 'eth0' }
86
- end
87
-
88
- ### Test parameters for bond0
89
-
90
- describe bond('bond0') do
91
- its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
92
- its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
93
- its('MII Status') { should eq 'up' }
94
- its('MII Polling Interval (ms)') { should eq '100' }
95
- its('Up Delay (ms)') { should eq '0' }
96
- its('Down Delay (ms)') { should eq '0' }
97
- end
@@ -9,6 +9,8 @@ Use the `bridge` InSpec audit resource to test basic network bridge properties,
9
9
  * On Linux platforms, any value in the `/sys/class/net/{interface}/bridge` directory may be tested
10
10
  * On the Windows platform, the `Get-NetAdapter` cmdlet is associated with the `Get-NetAdapterBinding` cmdlet and returns the `ComponentID ms_bridge` value as a JSON object
11
11
 
12
+ <br>
13
+
12
14
  ## Syntax
13
15
 
14
16
  A `bridge` resource block declares the bridge to be tested and what interface it should be associated with:
@@ -18,21 +20,11 @@ A `bridge` resource block declares the bridge to be tested and what interface it
18
20
  it { should have_interface 'eth0' }
19
21
  end
20
22
 
21
- ## Matchers
22
-
23
- This InSpec audit resource has the following matchers:
24
-
25
- ### be
26
-
27
- <%= partial "/shared/matcher_be" %>
28
-
29
- ### cmp
30
-
31
- <%= partial "/shared/matcher_cmp" %>
23
+ <br>
32
24
 
33
- ### eq
25
+ ## Matchers
34
26
 
35
- <%= partial "/shared/matcher_eq" %>
27
+ 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/).
36
28
 
37
29
  ### exist
38
30
 
@@ -46,10 +38,6 @@ The `have_interface` matcher tests if the named interface is defined for the net
46
38
 
47
39
  it { should have_interface 'eth0' }
48
40
 
49
- ### include
50
-
51
- <%= partial "/shared/matcher_include" %>
52
-
53
41
  ### interfaces
54
42
 
55
43
  The `interfaces` matcher tests if the named interface is present:
@@ -57,11 +45,3 @@ The `interfaces` matcher tests if the named interface is present:
57
45
  its('interfaces') { should eq 'foo' }
58
46
  its('interfaces') { should eq 'bar' }
59
47
  its('interfaces') { should include('foo') }
60
-
61
- ### match
62
-
63
- <%= partial "/shared/matcher_match" %>
64
-
65
- ## Examples
66
-
67
- None.
@@ -6,6 +6,8 @@ title: About the bsd_service Resource
6
6
 
7
7
  Use the `bsd_service` InSpec audit resource to test a service using a Berkeley OS-style `init` on the FreeBSD platform.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `bsd_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.