inspec 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -3
  3. data/Gemfile +4 -1
  4. data/README.md +3 -0
  5. data/docs/dsl_inspec.md +3 -3
  6. data/docs/profiles.md +17 -0
  7. data/docs/resources/apache_conf.md.erb +10 -10
  8. data/docs/resources/apt.md.erb +13 -13
  9. data/docs/resources/audit_policy.md.erb +10 -10
  10. data/docs/resources/auditd_conf.md.erb +10 -10
  11. data/docs/resources/auditd_rules.md.erb +11 -11
  12. data/docs/resources/bash.md.erb +12 -12
  13. data/docs/resources/bond.md.erb +15 -15
  14. data/docs/resources/bridge.md.erb +11 -11
  15. data/docs/resources/bsd_service.md.erb +11 -11
  16. data/docs/resources/command.md.erb +21 -21
  17. data/docs/resources/csv.md.erb +10 -10
  18. data/docs/resources/directory.md.erb +8 -8
  19. data/docs/resources/etc_group.md.erb +16 -16
  20. data/docs/resources/etc_passwd.md.erb +17 -17
  21. data/docs/resources/etc_shadow.md.erb +19 -19
  22. data/docs/resources/file.md.erb +58 -58
  23. data/docs/resources/gem.md.erb +12 -12
  24. data/docs/resources/group.md.erb +12 -12
  25. data/docs/resources/grub_conf.md.erb +11 -11
  26. data/docs/resources/host.md.erb +13 -13
  27. data/docs/resources/iis_site.md.erb +16 -16
  28. data/docs/resources/inetd_conf.md.erb +10 -10
  29. data/docs/resources/ini.md.erb +9 -9
  30. data/docs/resources/interface.md.erb +11 -11
  31. data/docs/resources/iptables.md.erb +11 -11
  32. data/docs/resources/json.md.erb +10 -10
  33. data/docs/resources/kernel_module.md.erb +10 -10
  34. data/docs/resources/kernel_parameter.md.erb +12 -12
  35. data/docs/resources/launchd_service.md.erb +11 -11
  36. data/docs/resources/limits_conf.md.erb +10 -10
  37. data/docs/resources/login_def.md.erb +12 -12
  38. data/docs/resources/mount.md.erb +13 -13
  39. data/docs/resources/mysql_conf.md.erb +14 -14
  40. data/docs/resources/mysql_session.md.erb +10 -10
  41. data/docs/resources/npm.md.erb +12 -12
  42. data/docs/resources/ntp_conf.md.erb +9 -9
  43. data/docs/resources/oneget.md.erb +11 -11
  44. data/docs/resources/os.md.erb +13 -13
  45. data/docs/resources/os_env.md.erb +12 -12
  46. data/docs/resources/package.md.erb +15 -15
  47. data/docs/resources/parse_config.md.erb +13 -13
  48. data/docs/resources/parse_config_file.md.erb +22 -16
  49. data/docs/resources/pip.md.erb +12 -12
  50. data/docs/resources/port.md.erb +18 -18
  51. data/docs/resources/postgres_conf.md.erb +13 -13
  52. data/docs/resources/postgres_session.md.erb +11 -11
  53. data/docs/resources/powershell.md.erb +13 -13
  54. data/docs/resources/process.md.erb +12 -12
  55. data/docs/resources/registry_key.md.erb +17 -17
  56. data/docs/resources/runit_service.md.erb +11 -11
  57. data/docs/resources/security_policy.md.erb +10 -10
  58. data/docs/resources/service.md.erb +17 -17
  59. data/docs/resources/ssh_config.md.erb +13 -13
  60. data/docs/resources/sshd_config.md.erb +14 -14
  61. data/docs/resources/ssl.md.erb +12 -12
  62. data/docs/resources/sys_info.md.erb +10 -10
  63. data/docs/resources/systemd_service.md.erb +11 -11
  64. data/docs/resources/sysv_service.md.erb +11 -11
  65. data/docs/resources/upstart_service.md.erb +11 -11
  66. data/docs/resources/user.md.erb +20 -20
  67. data/docs/resources/users.md.erb +19 -19
  68. data/docs/resources/vbscript.md.erb +9 -9
  69. data/docs/resources/windows_feature.md.erb +10 -10
  70. data/docs/resources/wmi.md.erb +10 -10
  71. data/docs/resources/xinetd_conf.md.erb +17 -17
  72. data/docs/resources/yaml.md.erb +10 -10
  73. data/docs/resources/yum.md.erb +16 -16
  74. data/examples/meta-profile/README.md +0 -5
  75. data/lib/inspec/base_cli.rb +6 -0
  76. data/lib/inspec/cli.rb +10 -3
  77. data/lib/inspec/profile.rb +3 -3
  78. data/lib/inspec/rspec_json_formatter.rb +24 -15
  79. data/lib/inspec/version.rb +1 -1
  80. data/lib/resources/registry_key.rb +15 -5
  81. data/lib/utils/filter.rb +1 -0
  82. metadata +3 -4
@@ -6,7 +6,7 @@ title: About the registry_key Resource
6
6
 
7
7
  Use the `registry_key` InSpec audit resource to test key values in the Windows registry.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `registry_key` resource block declares the item in the Windows registry, the path to a setting under that item, and then one (or more) name/value pairs to be tested.
12
12
 
@@ -33,7 +33,7 @@ Or use a Ruby Hash:
33
33
  end
34
34
 
35
35
 
36
- ## Registry Key Path Separators
36
+ ### Registry Key Path Separators
37
37
 
38
38
  A Windows registry key can be used as a string in Ruby code, such as when a registry key is used as the name of a recipe. In Ruby, when a registry key is enclosed in a double-quoted string (`" "`), the same backslash character (`\`) that is used to define the registry key path separator is also used in Ruby to define an escape character. Therefore, the registry key path separators must be escaped when they are enclosed in a double-quoted string. For example, the following registry key:
39
39
 
@@ -48,15 +48,15 @@ or may be enclosed in a double-quoted string with an extra backslash as an escap
48
48
  "HKCU\\SOFTWARE\\path\\to\\key\\Themes"
49
49
 
50
50
 
51
- # Matchers
51
+ ## Matchers
52
52
 
53
53
  This InSpec audit resource has the following matchers:
54
54
 
55
- ## be
55
+ ### be
56
56
 
57
57
  <%= partial "/shared/matcher_be" %>
58
58
 
59
- ## children
59
+ ### children
60
60
 
61
61
  The `children` matcher return all of the child items of a registry key. A regular expression may be used to filter child items:
62
62
 
@@ -81,57 +81,57 @@ The following example shows how find a property that may exist against multiple
81
81
  end
82
82
  }
83
83
 
84
- ## cmp
84
+ ### cmp
85
85
 
86
86
  <%= partial "/shared/matcher_cmp" %>
87
87
 
88
- ## eq
88
+ ### eq
89
89
 
90
90
  <%= partial "/shared/matcher_eq" %>
91
91
 
92
- ## exist
92
+ ### exist
93
93
 
94
94
  The `exist` matcher tests if the registry key is present:
95
95
 
96
96
  it { should exist }
97
97
 
98
- ## have_property
98
+ ### have_property
99
99
 
100
100
  The `have_property` matcher tests if a property exists for a registry key:
101
101
 
102
102
  it { should have_property 'value' }
103
103
 
104
- ## have_property_value
104
+ ### have_property_value
105
105
 
106
106
  The `have_property_value` matcher tests if a property value exists for a registry key:
107
107
 
108
108
  it { should have_property_value 'value' }
109
109
 
110
- ## have_value
110
+ ### have_value
111
111
 
112
112
  The `have_value` matcher tests if a value exists for a registry key:
113
113
 
114
114
  it { should have_value 'value' }
115
115
 
116
- ## include
116
+ ### include
117
117
 
118
118
  <%= partial "/shared/matcher_include" %>
119
119
 
120
- ## match
120
+ ### match
121
121
 
122
122
  <%= partial "/shared/matcher_match" %>
123
123
 
124
- ## name
124
+ ### name
125
125
 
126
126
  The `name` matcher tests the value for the specified registry setting:
127
127
 
128
128
  its('name') { should eq 'value' }
129
129
 
130
- # Examples
130
+ ## Examples
131
131
 
132
132
  The following examples show how to use this InSpec audit resource.
133
133
 
134
- ## Test the start time for the Schedule service
134
+ ### Test the start time for the Schedule service
135
135
 
136
136
  describe registry_key('Task Scheduler','HKEY_LOCAL_MACHINE\...\Schedule') do
137
137
  its('Start') { should eq 2 }
@@ -139,7 +139,7 @@ The following examples show how to use this InSpec audit resource.
139
139
 
140
140
  where `'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Schedule'` is the full path to the setting.
141
141
 
142
- ## Use a regular expression in responses
142
+ ### Use a regular expression in responses
143
143
 
144
144
  describe registry_key({
145
145
  hive: 'HKEY_LOCAL_MACHINE',
@@ -6,7 +6,7 @@ title: About the runit_service Resource
6
6
 
7
7
  Use the `runit_service` InSpec audit resource to test a service using runit.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `runit_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
12
12
 
@@ -29,48 +29,48 @@ The path to the service manager's control may be specified for situations where
29
29
  it { should be_running }
30
30
  end
31
31
 
32
- # Matchers
32
+ ## Matchers
33
33
 
34
34
  This InSpec audit resource has the following matchers:
35
35
 
36
- ## be
36
+ ### be
37
37
 
38
38
  <%= partial "/shared/matcher_be" %>
39
39
 
40
- ## be_enabled
40
+ ### be_enabled
41
41
 
42
42
  The `be_enabled` matcher tests if the named service is enabled:
43
43
 
44
44
  it { should be_enabled }
45
45
 
46
- ## be_installed
46
+ ### be_installed
47
47
 
48
48
  The `be_installed` matcher tests if the named service is installed:
49
49
 
50
50
  it { should be_installed }
51
51
 
52
- ## be_running
52
+ ### be_running
53
53
 
54
54
  The `be_running` matcher tests if the named service is running:
55
55
 
56
56
  it { should be_running }
57
57
 
58
- ## cmp
58
+ ### cmp
59
59
 
60
60
  <%= partial "/shared/matcher_cmp" %>
61
61
 
62
- ## eq
62
+ ### eq
63
63
 
64
64
  <%= partial "/shared/matcher_eq" %>
65
65
 
66
- ## include
66
+ ### include
67
67
 
68
68
  <%= partial "/shared/matcher_include" %>
69
69
 
70
- ## match
70
+ ### match
71
71
 
72
72
  <%= partial "/shared/matcher_match" %>
73
73
 
74
- # Examples
74
+ ## Examples
75
75
 
76
76
  None.
@@ -6,7 +6,7 @@ title: About the security_policy Resource
6
6
 
7
7
  Use the `security_policy` InSpec audit resource to test security policies on the Windows platform.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `security_policy` resource block declares the name of a security policy and the value to be tested:
12
12
 
@@ -20,41 +20,41 @@ where
20
20
  * `{ should eq 'value' }` tests the value of `policy_name` against the value declared in the test
21
21
 
22
22
 
23
- # Matchers
23
+ ## Matchers
24
24
 
25
25
  This InSpec audit resource has the following matchers:
26
26
 
27
- ## be
27
+ ### be
28
28
 
29
29
  <%= partial "/shared/matcher_be" %>
30
30
 
31
- ## cmp
31
+ ### cmp
32
32
 
33
33
  <%= partial "/shared/matcher_cmp" %>
34
34
 
35
- ## eq
35
+ ### eq
36
36
 
37
37
  <%= partial "/shared/matcher_eq" %>
38
38
 
39
- ## include
39
+ ### include
40
40
 
41
41
  <%= partial "/shared/matcher_include" %>
42
42
 
43
- ## match
43
+ ### match
44
44
 
45
45
  <%= partial "/shared/matcher_match" %>
46
46
 
47
- ## policy_name
47
+ ### policy_name
48
48
 
49
49
  The `policy_name` matcher must be the name of a security policy:
50
50
 
51
51
  its('SeNetworkLogonRight') { should eq '*S-1-5-11' }
52
52
 
53
- # Examples
53
+ ## Examples
54
54
 
55
55
  The following examples show how to use this InSpec audit resource.
56
56
 
57
- ## Verify that only the Administrators group has remote access
57
+ ### Verify that only the Administrators group has remote access
58
58
 
59
59
  describe security_policy do
60
60
  its('SeRemoteInteractiveLogonRight') { should eq '*S-1-5-32-544' }
@@ -8,7 +8,7 @@ Use the `service` InSpec audit resource to test if the named service is installe
8
8
 
9
9
  Under some circumstances, it may be necessary to specify the service manager by using one of the following service manager-specific resources: `bsd_service`, `launchd_service`, `runit_service`, `systemd_service`, `sysv_service`, oe `upstart_service`. These resources are based on the `service` resource.
10
10
 
11
- # Syntax
11
+ ## Syntax
12
12
 
13
13
  A `service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
14
14
 
@@ -24,67 +24,67 @@ where
24
24
  * `be_installed`, `be_enabled`, and `be_running` are valid matchers for this resource
25
25
 
26
26
 
27
- # Matchers
27
+ ## Matchers
28
28
 
29
29
  This InSpec audit resource has the following matchers:
30
30
 
31
- ## be
31
+ ### be
32
32
 
33
33
  <%= partial "/shared/matcher_be" %>
34
34
 
35
- ## be_enabled
35
+ ### be_enabled
36
36
 
37
37
  The `be_enabled` matcher tests if the named service is enabled:
38
38
 
39
39
  it { should be_enabled }
40
40
 
41
- ## be_installed
41
+ ### be_installed
42
42
 
43
43
  The `be_installed` matcher tests if the named service is installed:
44
44
 
45
45
  it { should be_installed }
46
46
 
47
- ## be_running
47
+ ### be_running
48
48
 
49
49
  The `be_running` matcher tests if the named service is running:
50
50
 
51
51
  it { should be_running }
52
52
 
53
- ## cmp
53
+ ### cmp
54
54
 
55
55
  <%= partial "/shared/matcher_cmp" %>
56
56
 
57
- ## eq
57
+ ### eq
58
58
 
59
59
  <%= partial "/shared/matcher_eq" %>
60
60
 
61
- ## include
61
+ ### include
62
62
 
63
63
  <%= partial "/shared/matcher_include" %>
64
64
 
65
- ## match
65
+ ### match
66
66
 
67
67
  <%= partial "/shared/matcher_match" %>
68
68
 
69
- # Examples
69
+ ## Examples
70
70
 
71
71
  The following examples show how to use this InSpec audit resource.
72
72
 
73
- ## Test if the postgresql service is both running and enabled
73
+ ### Test if the postgresql service is both running and enabled
74
74
 
75
75
  describe service('postgresql') do
76
76
  it { should be_enabled }
77
77
  it { should be_running }
78
78
  end
79
79
 
80
- ## Test if the mysql service is both running and enabled
80
+ ### Test if the mysql service is both running and enabled
81
81
 
82
82
  describe service('mysqld') do
83
83
  it { should be_enabled }
84
84
  it { should be_running }
85
85
  end
86
86
 
87
- ## Test if ClamAV (an antivirus engine) is installed and running
87
+ ### Test if ClamAV (an antivirus engine) is installed and running
88
88
 
89
89
  describe package('clamav') do
90
90
  it { should be_installed }
@@ -97,7 +97,7 @@ The following examples show how to use this InSpec audit resource.
97
97
  it { should_not be_running }
98
98
  end
99
99
 
100
- ## Test Unix System V run levels
100
+ ### Test Unix System V run levels
101
101
 
102
102
  On targets that are using SystemV services, the existing run levels can also be checked:
103
103
 
@@ -109,7 +109,7 @@ On targets that are using SystemV services, the existing run levels can also be
109
109
  it { should be_enabled }
110
110
  end
111
111
 
112
- ## Override the service manager
112
+ ### Override the service manager
113
113
 
114
114
  Under some circumstances, it may be required to override the logic in place to select the right service manager. For example, to check a service managed by Upstart:
115
115
 
@@ -127,7 +127,7 @@ This is also possible with `systemd_service`, `runit_service`, `sysv_service`, `
127
127
  it { should be_running }
128
128
  end
129
129
 
130
- ## Verify that IIS is running
130
+ ### Verify that IIS is running
131
131
 
132
132
  describe service('W3SVC') do
133
133
  it { should be_installed }
@@ -6,7 +6,7 @@ title: About the ssh_config Resource
6
6
 
7
7
  Use the `ssh_config` InSpec audit resource to test OpenSSH client configuration data located at `/etc/ssh/ssh_config` on Linux and Unix platforms.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  An `ssh_config` resource block declares the client OpenSSH configuration data to be tested:
12
12
 
@@ -21,31 +21,31 @@ where
21
21
  * `{ should include('foo') }` tests the value of `name` as read from `ssh_config` versus the value declared in the test
22
22
 
23
23
 
24
- # Matchers
24
+ ## Matchers
25
25
 
26
26
  This InSpec audit resource has the following matchers:
27
27
 
28
- ## be
28
+ ### be
29
29
 
30
30
  <%= partial "/shared/matcher_be" %>
31
31
 
32
- ## cmp
32
+ ### cmp
33
33
 
34
34
  <%= partial "/shared/matcher_cmp" %>
35
35
 
36
- ## eq
36
+ ### eq
37
37
 
38
38
  <%= partial "/shared/matcher_eq" %>
39
39
 
40
- ## include
40
+ ### include
41
41
 
42
42
  <%= partial "/shared/matcher_include" %>
43
43
 
44
- ## match
44
+ ### match
45
45
 
46
46
  <%= partial "/shared/matcher_match" %>
47
47
 
48
- ## name
48
+ ### name
49
49
 
50
50
  The `name` matcher tests the value of `name` as read from `ssh_config` versus the value declared in the test:
51
51
 
@@ -55,11 +55,11 @@ or:
55
55
 
56
56
  its('name') { should include('bar') }
57
57
 
58
- # Examples
58
+ ## Examples
59
59
 
60
60
  The following examples show how to use this InSpec audit resource.
61
61
 
62
- ## Test SSH configuration settings
62
+ ### Test SSH configuration settings
63
63
 
64
64
  describe ssh_config do
65
65
  its('cipher') { should contain '3des' }
@@ -67,7 +67,7 @@ The following examples show how to use this InSpec audit resource.
67
67
  its('hostname') { should include('example.com') }
68
68
  end
69
69
 
70
- ## Test which variables from the local environment are sent to the server
70
+ ### Test which variables from the local environment are sent to the server
71
71
 
72
72
  only_if do
73
73
  command('sshd').exist? or command('ssh').exists?
@@ -77,14 +77,14 @@ The following examples show how to use this InSpec audit resource.
77
77
  its('SendEnv') { should include('GORDON_CLIENT') }
78
78
  end
79
79
 
80
- ## Test owner and group permissions
80
+ ### Test owner and group permissions
81
81
 
82
82
  describe ssh_config do
83
83
  its('owner') { should eq 'root' }
84
84
  its('mode') { should cmp '0644' }
85
85
  end
86
86
 
87
- ## Test SSH configuration
87
+ ### Test SSH configuration
88
88
 
89
89
  describe ssh_config do
90
90
  its('Host') { should eq '*' }
@@ -6,7 +6,7 @@ title: About the sshd_config Resource
6
6
 
7
7
  Use the `sshd_config` InSpec audit resource to test configuration data for the OpenSSH daemon located at `/etc/ssh/sshd_config` on Linux and Unix platforms. sshd---the OpenSSH daemon---listens on dedicated ports, starts a daemon for each incoming connection, and then handles encryption, authentication, key exchanges, command executation, and data exchanges.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  An `sshd_config` resource block declares the client OpenSSH configuration data to be tested:
12
12
 
@@ -21,31 +21,31 @@ where
21
21
  * `{ should include('foo') }` tests the value of `name` as read from `sshd_config` versus the value declared in the test
22
22
 
23
23
 
24
- # Matchers
24
+ ## Matchers
25
25
 
26
26
  This InSpec audit resource has the following matchers:
27
27
 
28
- ## be
28
+ ### be
29
29
 
30
30
  <%= partial "/shared/matcher_be" %>
31
31
 
32
- ## cmp
32
+ ### cmp
33
33
 
34
34
  <%= partial "/shared/matcher_cmp" %>
35
35
 
36
- ## eq
36
+ ### eq
37
37
 
38
38
  <%= partial "/shared/matcher_eq" %>
39
39
 
40
- ## include
40
+ ### include
41
41
 
42
42
  <%= partial "/shared/matcher_include" %>
43
43
 
44
- ## match
44
+ ### match
45
45
 
46
46
  <%= partial "/shared/matcher_match" %>
47
47
 
48
- ## name
48
+ ### name
49
49
 
50
50
  The `name` matcher tests the value of `name` as read from `sshd_config` versus the value declared in the test:
51
51
 
@@ -55,35 +55,35 @@ or:
55
55
 
56
56
  its('name') {should include('bar') }
57
57
 
58
- # Examples
58
+ ## Examples
59
59
 
60
60
  The following examples show how to use this InSpec audit resource.
61
61
 
62
- ## Test which variables may be sent to the server
62
+ ### Test which variables may be sent to the server
63
63
 
64
64
  describe sshd_config do
65
65
  its('AcceptEnv') { should include('GORDON_SERVER') }
66
66
  end
67
67
 
68
- ## Test for IPv6-only addresses
68
+ ### Test for IPv6-only addresses
69
69
 
70
70
  describe sshd_config do
71
71
  its('AddressFamily') { should cmp 'inet6' }
72
72
  end
73
73
 
74
- ## Test the Protocol setting
74
+ ### Test the Protocol setting
75
75
 
76
76
  describe sshd_config do
77
77
  its('Protocol') { should cmp 2 }
78
78
  end
79
79
 
80
- ## Test for approved, strong ciphers
80
+ ### Test for approved, strong ciphers
81
81
 
82
82
  describe sshd_config do
83
83
  its('Ciphers') { should cmp('chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr') }
84
84
  end
85
85
 
86
- ## Test SSH protocols
86
+ ### Test SSH protocols
87
87
 
88
88
  describe sshd_config do
89
89
  its('Port') { should cmp 22 }