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 group Resource
6
6
 
7
7
  Use the `group` InSpec audit resource to test groups on the system.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  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:
12
12
 
@@ -20,53 +20,53 @@ where
20
20
  * `'group_name'` must specify the name of a group on the system
21
21
  * `exist` and `'gid'` are valid matchers for this resource
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
- ## be_local
31
+ ### be_local
32
32
 
33
33
  The `be_local` matcher tests if the group is a local group:
34
34
 
35
35
  it { should be_local }
36
36
 
37
- ## cmp
37
+ ### cmp
38
38
 
39
39
  <%= partial "/shared/matcher_cmp" %>
40
40
 
41
- ## eq
41
+ ### eq
42
42
 
43
43
  <%= partial "/shared/matcher_eq" %>
44
44
 
45
- ## exist
45
+ ### exist
46
46
 
47
47
  The `exist` matcher tests if the named user exists:
48
48
 
49
49
  it { should exist }
50
50
 
51
- ## gid
51
+ ### gid
52
52
 
53
53
  The `gid` matcher tests the named group identifier:
54
54
 
55
55
  its('gid') { should eq 1234 }
56
56
 
57
- ## include
57
+ ### include
58
58
 
59
59
  <%= partial "/shared/matcher_include" %>
60
60
 
61
- ## match
61
+ ### match
62
62
 
63
63
  <%= partial "/shared/matcher_match" %>
64
64
 
65
- # Examples
65
+ ## Examples
66
66
 
67
67
  The following examples show how to use this InSpec audit resource.
68
68
 
69
- ## Test the group identifier for the root group
69
+ ### Test the group identifier for the root group
70
70
 
71
71
  describe group('root') do
72
72
  it { should exist }
@@ -6,7 +6,7 @@ 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
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `grub_conf` resource block declares a list of settings in a `grub.conf` file:
12
12
 
@@ -29,35 +29,35 @@ where
29
29
  * `'value'` is the value that is expected
30
30
 
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
- ## cmp
40
+ ### cmp
41
41
 
42
42
  <%= partial "/shared/matcher_cmp" %>
43
43
 
44
- ## eq
44
+ ### eq
45
45
 
46
46
  <%= partial "/shared/matcher_eq" %>
47
47
 
48
- ## include
48
+ ### include
49
49
 
50
50
  <%= partial "/shared/matcher_include" %>
51
51
 
52
- ## match
52
+ ### match
53
53
 
54
54
  <%= partial "/shared/matcher_match" %>
55
55
 
56
- # Examples
56
+ ## Examples
57
57
 
58
58
  The following examples show how to use this InSpec audit resource.
59
59
 
60
- ## Test a grub.conf file
60
+ ### Test a grub.conf file
61
61
 
62
62
  A Grub configuration file located at `/etc/grub.conf` is similar to the following:
63
63
 
@@ -99,7 +99,7 @@ The following test verifies the `ramdisk_size` for the non-deault kernel:
99
99
  its('kernel') { should include 'ramdisk_size=400000' }
100
100
  end
101
101
 
102
- ## Test a configuration file and boot configuration
102
+ ### Test a configuration file and boot configuration
103
103
 
104
104
  describe grub_conf('/etc/grub.conf', 'default') do
105
105
  its('kernel') { should include '/vmlinuz-2.6.32-573.7.1.el6.x86_64' }
@@ -108,7 +108,7 @@ The following test verifies the `ramdisk_size` for the non-deault kernel:
108
108
  its('timeout') { should eq '5' }
109
109
  end
110
110
 
111
- ## Test a specific kernel
111
+ ### Test a specific kernel
112
112
 
113
113
  grub_conf('/etc/grub.conf', 'CentOS (2.6.32-573.12.1.el6.x86_64)') do
114
114
  its('kernel') { should include 'audit=1' }
@@ -6,7 +6,7 @@ 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
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  A `host` resource block declares a host name, and then (depending on what is to be tested) a port and/or a protocol:
12
12
 
@@ -25,59 +25,59 @@ where
25
25
  * `be_reachable` is a valid matcher for this resource
26
26
 
27
27
 
28
- # Matchers
28
+ ## Matchers
29
29
 
30
30
  This InSpec audit resource has the following matchers:
31
31
 
32
- ## be
32
+ ### be
33
33
 
34
34
  <%= partial "/shared/matcher_be" %>
35
35
 
36
- ## be_reachable
36
+ ### be_reachable
37
37
 
38
38
  The `be_reachable` matcher tests if the host name is available:
39
39
 
40
40
  it { should be_reachable }
41
41
 
42
- ## be_resolvable
42
+ ### be_resolvable
43
43
 
44
44
  The `be_resolvable` matcher tests for host name resolution, i.e. "resolvable to an IP address":
45
45
 
46
46
  it { should be_resolvable }
47
47
 
48
- ## cmp
48
+ ### cmp
49
49
 
50
50
  <%= partial "/shared/matcher_cmp" %>
51
51
 
52
- ## eq
52
+ ### eq
53
53
 
54
54
  <%= partial "/shared/matcher_eq" %>
55
55
 
56
- ## include
56
+ ### include
57
57
 
58
58
  <%= partial "/shared/matcher_include" %>
59
59
 
60
- ## ipaddress
60
+ ### ipaddress
61
61
 
62
62
  The `ipaddress` matcher tests if a host name is resolvable to a specific IP address:
63
63
 
64
64
  its('ipaddress') { should include '93.184.216.34' }
65
65
 
66
- ## match
66
+ ### match
67
67
 
68
68
  <%= partial "/shared/matcher_match" %>
69
69
 
70
- # Examples
70
+ ## Examples
71
71
 
72
72
  The following examples show how to use this InSpec audit resource.
73
73
 
74
- ## Verify host name is reachable over a specific protocol and port number
74
+ ### Verify host name is reachable over a specific protocol and port number
75
75
 
76
76
  describe host('example.com', port: 53, proto: 'udp') do
77
77
  it { should be_reachable }
78
78
  end
79
79
 
80
- ## Verify that a specific IP address can be resolved
80
+ ### Verify that a specific IP address can be resolved
81
81
 
82
82
  describe host('example.com', port: 80, proto: 'tcp') do
83
83
  it { should be_resolvable }
@@ -6,7 +6,7 @@ title: About the iis_site Resource
6
6
 
7
7
  Use the `iis_site` InSpec audit resource to test the state of IIS on Windows Server 2012 (and later).
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  An `iis_site` resource block declares details about the named site:
12
12
 
@@ -36,35 +36,35 @@ For example:
36
36
  it { should have_path('C:\\inetpub\\wwwroot') }
37
37
  end
38
38
 
39
- # Matchers
39
+ ## Matchers
40
40
 
41
41
  This InSpec audit resource has the following matchers:
42
42
 
43
- ## be
43
+ ### be
44
44
 
45
45
  <%= partial "/shared/matcher_be" %>
46
46
 
47
- ## be_running
47
+ ### be_running
48
48
 
49
49
  The `be_running` matcher tests if the site 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
- ## exist
61
+ ### exist
62
62
 
63
63
  The `exist` matcher tests if the site exists:
64
64
 
65
65
  it { should exist }
66
66
 
67
- ## have_app_pool
67
+ ### have_app_pool
68
68
 
69
69
  The `have_app_pool` matcher tests if the named application pool exists for the site:
70
70
 
@@ -74,7 +74,7 @@ For example, testing if a site's application pool inherits the settings of the p
74
74
 
75
75
  it { should have_app_pool('/') }
76
76
 
77
- ## have_binding
77
+ ### have_binding
78
78
 
79
79
  The `have_binding` matcher tests if the specified binding exists for the site:
80
80
 
@@ -86,7 +86,7 @@ or:
86
86
 
87
87
  A site may have multiple bindings; use a `have_binding` matcher for each unique site binding to be tested.
88
88
 
89
- ### Binding Attributes
89
+ ##### Binding Attributes
90
90
 
91
91
  The `have_binding` matcher can also test attributes that are defined for a site binding. For example, the `sslFlags` attribute defines if SSL is enabled, and (when enabled) what level of SSL is applied to the site.
92
92
 
@@ -106,25 +106,25 @@ Testing a site with 128-bit SSL enabled:
106
106
 
107
107
  it { should have_binding('https :443:www.contoso.com sslFlags=Ssl128') }
108
108
 
109
- ## have_path
109
+ ### have_path
110
110
 
111
111
  The `have_path` matcher tests if the named path is defined for the site:
112
112
 
113
113
  it { should have_path('C:\\inetpub\\wwwroot') }
114
114
 
115
- ## include
115
+ ### include
116
116
 
117
117
  <%= partial "/shared/matcher_include" %>
118
118
 
119
- ## match
119
+ ### match
120
120
 
121
121
  <%= partial "/shared/matcher_match" %>
122
122
 
123
- # Examples
123
+ ## Examples
124
124
 
125
125
  The following examples show how to use this InSpec audit resource.
126
126
 
127
- ## Test a default IIS site
127
+ ### Test a default IIS site
128
128
 
129
129
  describe iis_site('Default Web Site') do
130
130
  it { should exist }
@@ -134,7 +134,7 @@ The following examples show how to use this InSpec audit resource.
134
134
  it { should have_path('%SystemDrive%\\inetpub\\wwwroot\\') }
135
135
  end
136
136
 
137
- ## Test if IIS service is running
137
+ ### Test if IIS service is running
138
138
 
139
139
  describe service('W3SVC') do
140
140
  it { should be_installed }
@@ -6,7 +6,7 @@ title: About the inetd_conf Resource
6
6
 
7
7
  Use the `inetd_conf` InSpec audit resource to test if a service is listed in the `inetd.conf` file on Linux and Unix platforms. inetd---the Internet service daemon---listens on dedicated ports, and then loads the appropriate program based on a request. The `inetd.conf` file is typically located at `/etc/inetd.conf` and contains a list of Internet services associated to the ports on which that service will listen. Only enabled services may handle a request; only services that are required by the system should be enabled.`
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  An `inetd_conf` resource block declares the list of services that are enabled in the `inetd.conf` file:
12
12
 
@@ -21,7 +21,7 @@ where
21
21
  * `should eq 'value'` is the value that is expected
22
22
 
23
23
 
24
- # Matchers
24
+ ## Matchers
25
25
 
26
26
  This resource matches any service that is listed in the `inetd.conf` file. You may want to ensure that specific services do not listen via `inetd.conf`:
27
27
 
@@ -43,31 +43,31 @@ For example:
43
43
  its('exec') { should eq nil }
44
44
  end
45
45
 
46
- ## be
46
+ ### be
47
47
 
48
48
  <%= partial "/shared/matcher_be" %>
49
49
 
50
- ## cmp
50
+ ### cmp
51
51
 
52
52
  <%= partial "/shared/matcher_cmp" %>
53
53
 
54
- ## eq
54
+ ### eq
55
55
 
56
56
  <%= partial "/shared/matcher_eq" %>
57
57
 
58
- ## include
58
+ ### include
59
59
 
60
60
  <%= partial "/shared/matcher_include" %>
61
61
 
62
- ## match
62
+ ### match
63
63
 
64
64
  <%= partial "/shared/matcher_match" %>
65
65
 
66
- # Examples
66
+ ## Examples
67
67
 
68
68
  The following examples show how to use this InSpec audit resource.
69
69
 
70
- ## Verify that FTP is disabled
70
+ ### Verify that FTP is disabled
71
71
 
72
72
  The contents if the `inetd.conf` file contain the following:
73
73
 
@@ -88,7 +88,7 @@ Because both the `ftp` and `telnet` Internet services are commented out (`#`), b
88
88
 
89
89
  then the same test will return `false` for `ftp` and the entire test will fail.
90
90
 
91
- ## Test if telnet is installed
91
+ ### Test if telnet is installed
92
92
 
93
93
  describe package('telnetd') do
94
94
  it { should_not be_installed }
@@ -6,7 +6,7 @@ title: About the ini Resource
6
6
 
7
7
  Use the `ini` InSpec audit resource to test settings in an INI file.
8
8
 
9
- # Syntax
9
+ ## Syntax
10
10
 
11
11
  An `ini` resource block declares the configuration settings to be tested:
12
12
 
@@ -27,35 +27,35 @@ For example:
27
27
  its('server') { should eq '192.0.2.62' }
28
28
  end
29
29
 
30
- # Matchers
30
+ ## Matchers
31
31
 
32
32
  This InSpec audit resource has the following matchers:
33
33
 
34
- ## be
34
+ ### be
35
35
 
36
36
  <%= partial "/shared/matcher_be" %>
37
37
 
38
- ## cmp
38
+ ### cmp
39
39
 
40
40
  <%= partial "/shared/matcher_cmp" %>
41
41
 
42
- ## eq
42
+ ### eq
43
43
 
44
44
  <%= partial "/shared/matcher_eq" %>
45
45
 
46
- ## include
46
+ ### include
47
47
 
48
48
  <%= partial "/shared/matcher_include" %>
49
49
 
50
- ## match
50
+ ### match
51
51
 
52
52
  <%= partial "/shared/matcher_match" %>
53
53
 
54
- # Examples
54
+ ## Examples
55
55
 
56
56
  The following examples show how to use this InSpec audit resource.
57
57
 
58
- ## Test SMTP settings in a PHP INI file
58
+ ### Test SMTP settings in a PHP INI file
59
59
 
60
60
  For example, a PHP INI file located at contains the following settings:
61
61