mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
Fixes obvious formatting (#2648)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
This commit is contained in:
parent
947efd4064
commit
1e3df9d3bf
21 changed files with 95 additions and 47 deletions
|
@ -39,6 +39,8 @@ Use the where clause to match a selection_line to one rule or a particular set o
|
|||
|
||||
* `conf_path`, `content`, `rules`, `all_have_rule`
|
||||
|
||||
<br>
|
||||
|
||||
## Property Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
@ -71,9 +73,6 @@ The following examples show how to use this InSpec audit resource.
|
|||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
This InSpec audit resource uses the matchers `eq` and `include`.
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ The `interfaces` property tests if the named interface is present:
|
|||
its('interfaces') { should eq 'bar' }
|
||||
its('interfaces') { should include('foo') }
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
|
|
@ -41,6 +41,7 @@ The path to the service manager's control may be specified for situations where
|
|||
## Properties
|
||||
|
||||
All properties available to the `service` resource may be used.
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
|
|
@ -24,6 +24,7 @@ A `directory` resource block declares the location of the directory to be tested
|
|||
All of the properties available to `file` may be used with `directory`.
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
|
|
@ -24,6 +24,8 @@ A `docker_container` resource block declares the configuration data to be tested
|
|||
its('command') { should eq 'nc -ll -p 1234 -e /bin/cat' }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Resource Parameter Examples
|
||||
|
||||
### name
|
||||
|
|
|
@ -10,12 +10,16 @@ Elasticsearch cluster. InSpec retrieves the node list from the cluster node URL
|
|||
provided (defaults to `http://localhost:9200`) and provides the ability to query
|
||||
a variety of settings and statuses.
|
||||
|
||||
<br>
|
||||
|
||||
## Syntax
|
||||
|
||||
describe elasticsearch do
|
||||
its('property') { should cmp 'value' }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Supported Resource parameters
|
||||
|
||||
The `elasticsearch` resource accepts a number of optional resource parameters:
|
||||
|
@ -41,6 +45,8 @@ To simply check if nodes exist that match the criteria, use the `exist` matcher:
|
|||
it { should exist }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Properties
|
||||
|
||||
The following properties are provided:
|
||||
|
@ -49,6 +55,8 @@ The following properties are provided:
|
|||
|
||||
Since the `elasticsearch` resource is meant for use on a cluster, each property will return an array of the values for each node that matches any provided search criteria. Using InSpec's `cmp` matcher helps avoid issues when comparing values when there is only a single match (i.e. when the cluster only contains a single node, or the `where` filter criteria provided only returns a single node).
|
||||
|
||||
<br>
|
||||
|
||||
## Property Examples
|
||||
|
||||
### build_hash
|
||||
|
@ -227,6 +235,8 @@ Returns the version of Elasticsearch running on each node of the cluster.
|
|||
its('version') { should cmp '5.5.2' }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
|
|
@ -71,6 +71,8 @@ where
|
|||
its('all_host_names') { should eq [['localhost', 'localhost.localdomain', 'localhost4', 'localhost4.localdomain4'], ['localhost', 'localhost.localdomain', 'localhost6', 'localhost6.localdomain6']] }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
|
|
@ -39,6 +39,8 @@ symlink, mode, link_path, mtime, size, selinux\_label, md5sum, sha256sum, path,
|
|||
|
||||
file\_version, product\_version
|
||||
|
||||
<br>
|
||||
|
||||
## Resource Property Examples
|
||||
|
||||
### content
|
||||
|
|
|
@ -33,12 +33,24 @@ where
|
|||
|
||||
<br>
|
||||
|
||||
## Local vs. Remote
|
||||
|
||||
Beginning with InSpec 1.41, you can enable the ability to have the HTTP test execute on the remote target:
|
||||
|
||||
describe http('http://www.example.com', enable_remote_worker: true) do
|
||||
its('body') { should cmp 'awesome' }
|
||||
end
|
||||
|
||||
In InSpec 2.0, the HTTP test will automatically execute remotely whenever InSpec is testing a remote node.
|
||||
|
||||
<br>
|
||||
|
||||
## Properties
|
||||
|
||||
body, headers, http_method, status,
|
||||
|
||||
<br>
|
||||
|
||||
## Property Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -47,6 +47,7 @@ For example:
|
|||
application\_pool, path, physical\_path, protocols, site\_name
|
||||
|
||||
<br>
|
||||
|
||||
## Resource Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -45,6 +45,8 @@ For example:
|
|||
|
||||
app\_pool, bindings, path, state
|
||||
|
||||
<br>
|
||||
|
||||
## Property Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -90,7 +90,5 @@ then the same test will return `false` for `ftp` and the entire test will fail.
|
|||
|
||||
## Matchers
|
||||
|
||||
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
||||
|
|
|
@ -44,10 +44,13 @@ In the event a section or setting name has a period in it, the alternate syntax
|
|||
its(['section.with.a.dot.in.it', 'setting.name.with.dots']) { should cmp 'lotsadots' }
|
||||
|
||||
<br>
|
||||
|
||||
## Properties
|
||||
|
||||
This resource supports any of the settings listed in an INI file as properties.
|
||||
|
||||
<br>
|
||||
|
||||
## Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -23,9 +23,11 @@ An `interface` resource block declares network interface properties to be tested
|
|||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Properties
|
||||
|
||||
`name`, `speed`
|
||||
|
||||
<br>
|
||||
|
||||
## Resource Property Examples
|
||||
|
|
|
@ -62,6 +62,8 @@ The `key_length` property allows testing the number of bits in the key pair.
|
|||
its('key_length') { should eq 2048 }
|
||||
end
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
|
|
@ -43,6 +43,8 @@ where
|
|||
|
||||
* `domain`
|
||||
|
||||
<br>
|
||||
|
||||
## Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -55,7 +55,7 @@ The following examples show how to use this InSpec audit resource.
|
|||
|
||||
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
||||
|
||||
## os.family? Helpers
|
||||
### os.family? Helpers
|
||||
|
||||
The `os` audit resource includes a collection of helpers that enable more granular testing of platforms, platform names, architectures, and releases. Use any of the following platform-specific helpers to test for specific platforms:
|
||||
|
||||
|
@ -103,7 +103,7 @@ Use the following helpers to test for operating system names, releases, and arch
|
|||
it { should eq 'foo' }
|
||||
end
|
||||
|
||||
## os[:family] Symbols
|
||||
### os[:family] Symbols
|
||||
|
||||
Use `os[:family]` to enable more granular testing of platforms, platform names, architectures, and releases. Use any of the following platform-specific symbols to test for specific platforms:
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ The following examples show how to use this InSpec audit resource.
|
|||
its('PARAM_X') { should include 'Y' }
|
||||
end
|
||||
|
||||
## Test a file with an ini-like structure (such as a yum.conf)
|
||||
### Test a file with an ini-like structure (such as a yum.conf)
|
||||
|
||||
describe parse_config_file('/path/to/yum.conf') do
|
||||
its('main') { should include('gpgcheck' => '1') }
|
||||
|
|
|
@ -96,6 +96,7 @@ Below is a mapping table to help you understand what property the unix field map
|
|||
|users |UserName|
|
||||
|commands |Path|
|
||||
|
||||
<br>
|
||||
|
||||
## Matchers
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ where
|
|||
* `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
|
||||
|
||||
<br>
|
||||
|
||||
## Examples
|
||||
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
|
|
@ -31,38 +31,43 @@ where
|
|||
|
||||
The following examples show how to use this InSpec resource.
|
||||
|
||||
### Test's that a task is enabled
|
||||
```
|
||||
describe windows_task('\Microsoft\Windows\Time Synchronization\SynchronizeTime') do
|
||||
it { should be_enabled }
|
||||
end
|
||||
```
|
||||
### Tests that a task is enabled
|
||||
|
||||
### Test's that a task is disabled
|
||||
```
|
||||
describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
|
||||
it { should be_disabled }
|
||||
end
|
||||
```
|
||||
```ruby
|
||||
describe windows_task('\Microsoft\Windows\Time Synchronization\SynchronizeTime') do
|
||||
it { should be_enabled }
|
||||
end
|
||||
```
|
||||
|
||||
### Test's the configuration parameters of a task
|
||||
```
|
||||
describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
|
||||
its('logon_mode') { should eq 'Interactive/Background' }
|
||||
its('last_result') { should eq '1' }
|
||||
its('task_to_run') { should cmp '%Windir%\system32\appidpolicyconverter.exe' }
|
||||
its('run_as_user') { should eq 'LOCAL SERVICE' }
|
||||
end
|
||||
```
|
||||
### Tests that a task is disabled
|
||||
|
||||
### Test's that a task is defined
|
||||
```
|
||||
describe windows_task('\Microsoft\Windows\Defrag\ScheduledDefrag') do
|
||||
it { should exist }
|
||||
end
|
||||
```
|
||||
```ruby
|
||||
describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
|
||||
it { should be_disabled }
|
||||
end
|
||||
```
|
||||
|
||||
### Tests the configuration parameters of a task
|
||||
|
||||
```ruby
|
||||
describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
|
||||
its('logon_mode') { should eq 'Interactive/Background' }
|
||||
its('last_result') { should eq '1' }
|
||||
its('task_to_run') { should cmp '%Windir%\system32\appidpolicyconverter.exe' }
|
||||
its('run_as_user') { should eq 'LOCAL SERVICE' }
|
||||
end
|
||||
```
|
||||
|
||||
### Tests that a task is defined
|
||||
|
||||
```ruby
|
||||
describe windows_task('\Microsoft\Windows\Defrag\ScheduledDefrag') do
|
||||
it { should exist }
|
||||
end
|
||||
```
|
||||
|
||||
## Gathering Tasknames
|
||||
|
||||
Rather then use the GUI you can use the `schtasks.exe` to output a full list of tasks available on the system
|
||||
|
||||
`schtasks /query /FO list`
|
||||
|
@ -71,17 +76,17 @@ rather than use the `list` output you can use `CSV` if it is easier.
|
|||
|
||||
Please make sure you use the full TaskName (include the prefix `\`) within your control
|
||||
|
||||
```
|
||||
C:\>schtasks /query /FO list
|
||||
...
|
||||
Folder: \Microsoft\Windows\Diagnosis
|
||||
HostName: XPS15
|
||||
TaskName: \Microsoft\Windows\Diagnosis\Scheduled
|
||||
Next Run Time: N/A
|
||||
Status: Ready
|
||||
Logon Mode: Interactive/Background
|
||||
...
|
||||
```
|
||||
```ruby
|
||||
C:\>schtasks /query /FO list
|
||||
...
|
||||
Folder: \Microsoft\Windows\Diagnosis
|
||||
HostName: XPS15
|
||||
TaskName: \Microsoft\Windows\Diagnosis\Scheduled
|
||||
Next Run Time: N/A
|
||||
Status: Ready
|
||||
Logon Mode: Interactive/Background
|
||||
...
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
|
|
Loading…
Reference in a new issue