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
@@ -4,9 +4,11 @@ title: About the windows_task Resource
4
4
 
5
5
  # windows_task
6
6
 
7
- Use the `windows_task` Inspec audit resource to test a scheduled tasks configuration on a Windows platform.
7
+ Use the `windows_task` Inspec audit resource to test a scheduled tasks configuration on a Windows platform.
8
8
  Microsoft and application vendors use scheduled tasks to perform a variety of system maintaince tasks but system administrators can schedule their own.
9
9
 
10
+ <br>
11
+
10
12
  ## Syntax
11
13
 
12
14
  A `windows_task` resource block declares the name of the task (as its full path) and tests its configuration:
@@ -18,33 +20,11 @@ A `windows_task` resource block declares the name of the task (as its full path)
18
20
 
19
21
  where
20
22
 
21
- * `'parameter'` must be a valid parameter defined within this resource ie `logon_mode`, `last_result`, `task_to_run`, `run_as_user`
23
+ * `'parameter'` must be a valid parameter defined within this resource ie `logon_mode`, `last_result`, `task_to_run`, `run_as_user`
22
24
  * `'value'` will be used to compare the value gather from your chosen parameter
23
- * `'be_enabled'` is an example of a valid matcher that checks the state of a task, other examples are `exist` or `be_disabled`
24
-
25
- ## Matchers
26
-
27
- This InSpec audit resource has the following matchers:
28
-
29
- ### be
30
-
31
- <%= partial "/shared/matcher_be" %>
32
-
33
- ### cmp
34
-
35
- <%= partial "/shared/matcher_cmp" %>
36
-
37
- ### eq
25
+ * `'be_enabled'` is an example of a valid matcher that checks the state of a task, other examples are `exist` or `be_disabled`
38
26
 
39
- <%= partial "/shared/matcher_eq" %>
40
-
41
- ### include
42
-
43
- <%= partial "/shared/matcher_include" %>
44
-
45
- ### match
46
-
47
- <%= partial "/shared/matcher_match" %>
27
+ <br>
48
28
 
49
29
  ## Examples
50
30
 
@@ -101,3 +81,9 @@ Status: Ready
101
81
  Logon Mode: Interactive/Background
102
82
  ...
103
83
  ```
84
+
85
+ <br>
86
+
87
+ ## Matchers
88
+
89
+ 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 wmi Resource
6
6
 
7
7
  Use the `wmi` InSpec audit resource to test WMI settings on the Windows platform.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `wmi` resource block tests WMI settings on the Windows platform:
@@ -46,30 +48,7 @@ and the second uses a filter in the Ruby Hash to first identify WinRM, and then
46
48
  its('DisplayName') { should eq 'Windows Remote Management (WS-Management)'}
47
49
  end
48
50
 
49
-
50
- ## Matchers
51
-
52
- This InSpec audit resource has the following matchers:
53
-
54
- ### be
55
-
56
- <%= partial "/shared/matcher_be" %>
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" %>
51
+ <br>
73
52
 
74
53
  ## Examples
75
54
 
@@ -93,3 +72,9 @@ The following examples show how to use this InSpec audit resource.
93
72
  }) do
94
73
  its('Setting') { should eq false }
95
74
  end
75
+
76
+ <br>
77
+
78
+ ## Matchers
79
+
80
+ For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
@@ -12,6 +12,8 @@ or communications over a network. They may also be used for authentication.
12
12
  Examples include SSL certificates, S/MIME certificates and VPN authentication
13
13
  certificates.
14
14
 
15
+ <br>
16
+
15
17
  ## Syntax
16
18
 
17
19
  An `x509_certificate` resource block declares a certificate `key file` to be tested.
@@ -20,6 +22,8 @@ An `x509_certificate` resource block declares a certificate `key file` to be tes
20
22
  its('validity_in_days') { should be > 30 }
21
23
  end
22
24
 
25
+ <br>
26
+
23
27
  ## Supported Properties
24
28
 
25
29
  ### subject.XX
@@ -6,6 +6,8 @@ title: About the xinetd_conf Resource
6
6
 
7
7
  Use the `xinetd_conf` InSpec audit resource to test services under `/etc/xinet.d` on Linux and Unix platforms. xinetd---the extended Internet service daemon---listens on all ports, and then loads the appropriate program based on a request. The `xinetd.conf` file is typically located at `/etc/xinetd.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
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `xinetd_conf` resource block declares settings found in a `xinetd.conf` file for the named service:
@@ -21,28 +23,80 @@ where
21
23
  * `('setting')` is a setting in the `xinetd.conf` file
22
24
  * `should eq 'value'` is the value that is expected
23
25
 
26
+ <br>
24
27
 
25
- ## Matchers
28
+ ## Examples
26
29
 
27
- This InSpec audit resource has the following matchers:
30
+ The following examples show how to use this InSpec audit resource.
28
31
 
29
- ### be
32
+ ### Test a socket_type
30
33
 
31
- <%= partial "/shared/matcher_be" %>
34
+ The network socket type: `dgram` (a datagram-based service), `raw` (a service that requires direct access to an IP address), `stream` (a stream-based service), or `seqpacket` (a service that requires a sequenced packet).
32
35
 
33
- ### be_enabed
36
+ describe xinetd_conf.services('service_name') do
37
+ its('socket_types') { should include 'dgram' }
38
+ end
34
39
 
35
- The `be_enabled` matcher tests if a service listed under `/etc/xinet.d` is enabled:
40
+ ### Test a service type
36
41
 
37
- it { should be_enabled }
42
+ The type of service: `INTERNAL` (a service provided by xinetd), `RPC` (an RPC-based service), `TCPMUX` (a service that is started on a well-known TPCMUX port), or `UNLISTED` (a service that is not listed in a standard system file location).
38
43
 
39
- ### cmp
44
+ describe xinetd_conf.services('service_name') do
45
+ its('type') { should include 'RPC' }
46
+ end
40
47
 
41
- <%= partial "/shared/matcher_cmp" %>
48
+ ### Test the telnet service
49
+
50
+ For example, a `telnet` file under `/etc/xinet.d` contains the following settings:
51
+
52
+ service telnet
53
+ {
54
+ disable = yes
55
+ flags = REUSE
56
+ socket_type = stream
57
+ wait = no
58
+ user = root
59
+ server = /usr/sbin/in.telnetd
60
+ log_on_failure += USERID
61
+ }
42
62
 
43
- ### eq
63
+ Some examples of tests that can be run against that file include:
44
64
 
45
- <%= partial "/shared/matcher_eq" %>
65
+ describe xinetd_conf.services('telnet') do
66
+ it { should be_disabled }
67
+ end
68
+
69
+ and
70
+
71
+ describe xinetd_conf.services('telnet') do
72
+ its('socket_type') { should include 'stream' }
73
+ end
74
+
75
+ and
76
+
77
+ describe xinetd_conf.services('telnet') do
78
+ its('wait') { should eq 'no' }
79
+ end
80
+
81
+ All three settings can be tested in the same block as well:
82
+
83
+ describe xinetd_conf.services('telnet') do
84
+ it { should be_disabled }
85
+ its('socket_type') { should include 'stream' }
86
+ its('wait') { should eq 'no' }
87
+ end
88
+
89
+ <br>
90
+
91
+ ## Matchers
92
+
93
+ 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/).
94
+
95
+ ### be_enabed
96
+
97
+ The `be_enabled` matcher tests if a service listed under `/etc/xinet.d` is enabled:
98
+
99
+ it { should be_enabled }
46
100
 
47
101
  ### ids
48
102
 
@@ -54,14 +108,6 @@ For example:
54
108
 
55
109
  its('ids') { should include 'chargen-stream chargen-dgram'}
56
110
 
57
- ### include
58
-
59
- <%= partial "/shared/matcher_include" %>
60
-
61
- ### match
62
-
63
- <%= partial "/shared/matcher_match" %>
64
-
65
111
  ### services
66
112
 
67
113
  The `services` matcher tests if the named service is listed under `/etc/xinet.d`:
@@ -107,64 +153,3 @@ For TCP (`stream`) socket types the `wait` matcher should test for `no`:
107
153
 
108
154
  its('socket_types') { should eq 'stream' }
109
155
  its('wait') { should eq 'no' }
110
-
111
- ## Examples
112
-
113
- The following examples show how to use this InSpec audit resource.
114
-
115
- ### Test a socket_type
116
-
117
- The network socket type: `dgram` (a datagram-based service), `raw` (a service that requires direct access to an IP address), `stream` (a stream-based service), or `seqpacket` (a service that requires a sequenced packet).
118
-
119
- describe xinetd_conf.services('service_name') do
120
- its('socket_types') { should include 'dgram' }
121
- end
122
-
123
- ### Test a service type
124
-
125
- The type of service: `INTERNAL` (a service provided by xinetd), `RPC` (an RPC-based service), `TCPMUX` (a service that is started on a well-known TPCMUX port), or `UNLISTED` (a service that is not listed in a standard system file location).
126
-
127
- describe xinetd_conf.services('service_name') do
128
- its('type') { should include 'RPC' }
129
- end
130
-
131
- ### Test the telnet service
132
-
133
- For example, a `telnet` file under `/etc/xinet.d` contains the following settings:
134
-
135
- service telnet
136
- {
137
- disable = yes
138
- flags = REUSE
139
- socket_type = stream
140
- wait = no
141
- user = root
142
- server = /usr/sbin/in.telnetd
143
- log_on_failure += USERID
144
- }
145
-
146
- Some examples of tests that can be run against that file include:
147
-
148
- describe xinetd_conf.services('telnet') do
149
- it { should be_disabled }
150
- end
151
-
152
- and
153
-
154
- describe xinetd_conf.services('telnet') do
155
- its('socket_type') { should include 'stream' }
156
- end
157
-
158
- and
159
-
160
- describe xinetd_conf.services('telnet') do
161
- its('wait') { should eq 'no' }
162
- end
163
-
164
- All three settings can be tested in the same block as well:
165
-
166
- describe xinetd_conf.services('telnet') do
167
- it { should be_disabled }
168
- its('socket_type') { should include 'stream' }
169
- its('wait') { should eq 'no' }
170
- end
@@ -6,6 +6,8 @@ title: About the xml Resource
6
6
 
7
7
  Use the `xml` InSpec audit resource to test data in an XML file.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  An `xml` resource block declares the data to be tested. Assume the following XML file:
@@ -34,42 +36,26 @@ where
34
36
  * `root/name` is an XPath expression
35
37
  * `should eq ['foo']` tests a value of `root/name` as read from an XML file versus the value declared in the test
36
38
 
37
- ## Matchers
38
-
39
- This InSpec audit resource has the following matchers:
40
-
41
- ### be
42
-
43
- <%= partial "/shared/matcher_be" %>
44
-
45
- ### cmp
39
+ <br>
46
40
 
47
- <%= partial "/shared/matcher_cmp" %>
41
+ ## Examples
48
42
 
49
- ### eq
43
+ The following examples show how to use this InSpec audit resource.
50
44
 
51
- <%= partial "/shared/matcher_eq" %>
45
+ ### Test an AppPool's presence in an applicationHost.config file
52
46
 
53
- ### include
47
+ describe xml('applicationHost.config') do
48
+ its('configuration/system.applicationHost/applicationPools/add@name') { should contain('my_pool') }
49
+ end
54
50
 
55
- <%= partial "/shared/matcher_include" %>
51
+ <br>
56
52
 
57
- ### match
53
+ ## Matchers
58
54
 
59
- <%= partial "/shared/matcher_match" %>
55
+ 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
56
 
61
57
  ### name
62
58
 
63
59
  The `name` matcher tests the value of `name` as read from a JSON file versus the value declared in the test:
64
60
 
65
61
  its('name') { should eq 'foo' }
66
-
67
- ## Examples
68
-
69
- The following examples show how to use this InSpec audit resource.
70
-
71
- ### Test an AppPool's presence in an applicationHost.config file
72
-
73
- describe xml('applicationHost.config') do
74
- its('configuration/system.applicationHost/applicationPools/add@name') { should contain('my_pool') }
75
- end
@@ -6,6 +6,8 @@ title: About the yaml Resource
6
6
 
7
7
  Use the `yaml` InSpec audit resource to test configuration data in a Yaml file.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `yaml` resource block declares the configuration data to be tested. Assume the following Yaml file:
@@ -41,43 +43,26 @@ Like the `json` resource, the `yaml` resource can read a file, run a command, or
41
43
  its('key2') { should cmp 'value2' }
42
44
  end
43
45
 
46
+ <br>
44
47
 
45
- ## Matchers
46
-
47
- This InSpec audit resource has the following matchers:
48
-
49
- ### be
50
-
51
- <%= partial "/shared/matcher_be" %>
52
-
53
- ### cmp
54
-
55
- <%= partial "/shared/matcher_cmp" %>
48
+ ## Examples
56
49
 
57
- ### eq
50
+ The following examples show how to use this InSpec audit resource.
58
51
 
59
- <%= partial "/shared/matcher_eq" %>
52
+ ### Test a kitchen.yml file driver
60
53
 
61
- ### include
54
+ describe yaml('.kitchen.yaml') do
55
+ its('driver.name') { should eq('vagrant') }
56
+ end
62
57
 
63
- <%= partial "/shared/matcher_include" %>
58
+ <br>
64
59
 
65
- ### match
60
+ ## Matchers
66
61
 
67
- <%= partial "/shared/matcher_match" %>
62
+ 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/).
68
63
 
69
64
  ### name
70
65
 
71
66
  The `name` matcher tests the value of `name` as read from a Yaml file versus the value declared in the test:
72
67
 
73
68
  its('name') { should eq 'foo' }
74
-
75
- ## Examples
76
-
77
- The following examples show how to use this InSpec audit resource.
78
-
79
- ### Test a kitchen.yml file driver
80
-
81
- describe yaml('.kitchen.yaml') do
82
- its('driver.name') { should eq('vagrant') }
83
- end
@@ -6,6 +6,8 @@ title: About the yum Resource
6
6
 
7
7
  Use the `yum` InSpec audit resource to test packages in the Yum repository.
8
8
 
9
+ <br>
10
+
9
11
  ## Syntax
10
12
 
11
13
  A `yum` resource block declares a package repo, tests if the package repository is present, and if it that package repository is a valid package source (i.e. "is enabled"):
@@ -19,41 +21,58 @@ where
19
21
 
20
22
  * `repo('name')` is the (optional) name of a package repo, using either a full identifier (`'updates/7/x86_64'`) or a short identifier (`'updates'`)
21
23
 
22
- ## Matchers
24
+ <br>
23
25
 
24
- This InSpec audit resource has the following matchers:
26
+ ## Examples
25
27
 
26
- ### be
28
+ The following examples show how to use this InSpec audit resource.
27
29
 
28
- <%= partial "/shared/matcher_be" %>
30
+ ### Test if the yum repo exists
29
31
 
30
- ### be_enabled
32
+ describe yum do
33
+ its('repos') { should exist }
34
+ end
31
35
 
32
- The `be_enabled` matcher tests if the package repository is a valid package source:
36
+ ### Test if the 'base/7/x86_64' repo exists and is enabled
33
37
 
34
- it { should be_enabled }
38
+ describe yum do
39
+ its('repos') { should include 'base/7/x86_64' }
40
+ its('epel') { should exist }
41
+ its('epel') { should be_enabled }
42
+ end
35
43
 
36
- ### cmp
44
+ ### Test if a specific yum repo exists
37
45
 
38
- <%= partial "/shared/matcher_cmp" %>
46
+ describe yum.repo('epel') do
47
+ it { should exist }
48
+ it { should be_enabled }
49
+ end
39
50
 
40
- ### eq
51
+ ### Test a particular repository configuration, such as its Base URL
41
52
 
42
- <%= partial "/shared/matcher_eq" %>
53
+ describe yum.repo('mycompany-artifacts') do
54
+ it { should exist }
55
+ it { should be_enabled }
56
+ its('baseurl') { should include 'mycompany.biz' }
57
+ end
43
58
 
44
- ### exist
59
+ <br>
45
60
 
46
- The `exist` matcher tests if the package repository exists:
61
+ ## Matchers
47
62
 
48
- it { should exist }
63
+ 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/).
49
64
 
50
- ### include
65
+ ### be_enabled
51
66
 
52
- <%= partial "/shared/matcher_include" %>
67
+ The `be_enabled` matcher tests if the package repository is a valid package source:
53
68
 
54
- ### match
69
+ it { should be_enabled }
55
70
 
56
- <%= partial "/shared/matcher_match" %>
71
+ ### exist
72
+
73
+ The `exist` matcher tests if the package repository exists:
74
+
75
+ it { should exist }
57
76
 
58
77
  ### repo('name')
59
78
 
@@ -76,36 +95,3 @@ The `shortname` matcher names a specific package repository's group identifier.
76
95
  describe yum.repo('Directory Server') do
77
96
  its('shortname') { should eq 'directory-server' }
78
97
  end
79
-
80
- ## Examples
81
-
82
- The following examples show how to use this InSpec audit resource.
83
-
84
- ### Test if the yum repo exists
85
-
86
- describe yum do
87
- its('repos') { should exist }
88
- end
89
-
90
- ### Test if the 'base/7/x86_64' repo exists and is enabled
91
-
92
- describe yum do
93
- its('repos') { should include 'base/7/x86_64' }
94
- its('epel') { should exist }
95
- its('epel') { should be_enabled }
96
- end
97
-
98
- ### Test if a specific yum repo exists
99
-
100
- describe yum.repo('epel') do
101
- it { should exist }
102
- it { should be_enabled }
103
- end
104
-
105
- ### Test a particular repository configuration, such as its Base URL
106
-
107
- describe yum.repo('mycompany-artifacts') do
108
- it { should exist }
109
- it { should be_enabled }
110
- its('baseurl') { should include 'mycompany.biz' }
111
- end