diff --git a/docs/resources/aide_conf.md.erb b/docs/resources/aide_conf.md.erb index e5f16dd26..5ac574d68 100644 --- a/docs/resources/aide_conf.md.erb +++ b/docs/resources/aide_conf.md.erb @@ -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` +
+ ## 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/). diff --git a/docs/resources/bridge.md.erb b/docs/resources/bridge.md.erb index 3d27945a5..995c67ec1 100644 --- a/docs/resources/bridge.md.erb +++ b/docs/resources/bridge.md.erb @@ -37,6 +37,8 @@ The `interfaces` property tests if the named interface is present: its('interfaces') { should eq 'bar' } its('interfaces') { should include('foo') } +
+ ## Matchers For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). diff --git a/docs/resources/bsd_service.md.erb b/docs/resources/bsd_service.md.erb index 89ba3158b..6bf2a518f 100644 --- a/docs/resources/bsd_service.md.erb +++ b/docs/resources/bsd_service.md.erb @@ -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. +
## Matchers diff --git a/docs/resources/directory.md.erb b/docs/resources/directory.md.erb index f34ee9638..68214dec5 100644 --- a/docs/resources/directory.md.erb +++ b/docs/resources/directory.md.erb @@ -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`.
+ ## Matchers For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). diff --git a/docs/resources/docker_container.md.erb b/docs/resources/docker_container.md.erb index c0339181d..a3065a512 100644 --- a/docs/resources/docker_container.md.erb +++ b/docs/resources/docker_container.md.erb @@ -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 +
+ ## Resource Parameter Examples ### name diff --git a/docs/resources/elasticsearch.md.erb b/docs/resources/elasticsearch.md.erb index eafa17ae9..168c58dab 100644 --- a/docs/resources/elasticsearch.md.erb +++ b/docs/resources/elasticsearch.md.erb @@ -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. +
+ ## Syntax describe elasticsearch do its('property') { should cmp 'value' } end +
+ ## 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 +
+ ## 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). +
+ ## 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 +
+ ## Matchers For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). diff --git a/docs/resources/etc_hosts.md.erb b/docs/resources/etc_hosts.md.erb index b3b2776e2..ec9c4d66d 100644 --- a/docs/resources/etc_hosts.md.erb +++ b/docs/resources/etc_hosts.md.erb @@ -71,6 +71,8 @@ where its('all_host_names') { should eq [['localhost', 'localhost.localdomain', 'localhost4', 'localhost4.localdomain4'], ['localhost', 'localhost.localdomain', 'localhost6', 'localhost6.localdomain6']] } end +
+ ## Matchers For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). diff --git a/docs/resources/file.md.erb b/docs/resources/file.md.erb index e04e4b11e..fc665b202 100644 --- a/docs/resources/file.md.erb +++ b/docs/resources/file.md.erb @@ -39,6 +39,8 @@ symlink, mode, link_path, mtime, size, selinux\_label, md5sum, sha256sum, path, file\_version, product\_version +
+ ## Resource Property Examples ### content diff --git a/docs/resources/http.md.erb b/docs/resources/http.md.erb index 9eec7fe3c..d612da8e5 100644 --- a/docs/resources/http.md.erb +++ b/docs/resources/http.md.erb @@ -33,12 +33,24 @@ where
+## 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. +
+ ## Properties body, headers, http_method, status,
+ ## Property Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/iis_app.md.erb b/docs/resources/iis_app.md.erb index 5bba52971..314346d3b 100644 --- a/docs/resources/iis_app.md.erb +++ b/docs/resources/iis_app.md.erb @@ -47,6 +47,7 @@ For example: application\_pool, path, physical\_path, protocols, site\_name
+ ## Resource Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/iis_site.md.erb b/docs/resources/iis_site.md.erb index 40fe00b39..41534f81b 100644 --- a/docs/resources/iis_site.md.erb +++ b/docs/resources/iis_site.md.erb @@ -45,6 +45,8 @@ For example: app\_pool, bindings, path, state +
+ ## Property Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/inetd_conf.md.erb b/docs/resources/inetd_conf.md.erb index fc82dd779..c665f1acb 100644 --- a/docs/resources/inetd_conf.md.erb +++ b/docs/resources/inetd_conf.md.erb @@ -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/). diff --git a/docs/resources/ini.md.erb b/docs/resources/ini.md.erb index 11bcda0d7..ffe638c7a 100644 --- a/docs/resources/ini.md.erb +++ b/docs/resources/ini.md.erb @@ -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' }
+ ## Properties This resource supports any of the settings listed in an INI file as properties. +
+ ## Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/interface.md.erb b/docs/resources/interface.md.erb index ee7fd563f..02106fd07 100644 --- a/docs/resources/interface.md.erb +++ b/docs/resources/interface.md.erb @@ -23,9 +23,11 @@ An `interface` resource block declares network interface properties to be tested end
+ ## Properties `name`, `speed` +
## Resource Property Examples diff --git a/docs/resources/key_rsa.md.erb b/docs/resources/key_rsa.md.erb index c05c27aaf..d5d67213f 100644 --- a/docs/resources/key_rsa.md.erb +++ b/docs/resources/key_rsa.md.erb @@ -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 +
+ ## Matchers For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). diff --git a/docs/resources/limits_conf.md.erb b/docs/resources/limits_conf.md.erb index e807c8c36..65a69ef0d 100644 --- a/docs/resources/limits_conf.md.erb +++ b/docs/resources/limits_conf.md.erb @@ -43,6 +43,8 @@ where * `domain` +
+ ## Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/os.md.erb b/docs/resources/os.md.erb index 5f758919d..b91ac1075 100644 --- a/docs/resources/os.md.erb +++ b/docs/resources/os.md.erb @@ -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: diff --git a/docs/resources/parse_config_file.md.erb b/docs/resources/parse_config_file.md.erb index 520fb0dec..7533b311d 100644 --- a/docs/resources/parse_config_file.md.erb +++ b/docs/resources/parse_config_file.md.erb @@ -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') } diff --git a/docs/resources/processes.md.erb b/docs/resources/processes.md.erb index 7ff46b117..9f2c30c86 100644 --- a/docs/resources/processes.md.erb +++ b/docs/resources/processes.md.erb @@ -96,6 +96,7 @@ Below is a mapping table to help you understand what property the unix field map |users |UserName| |commands |Path| +
## Matchers diff --git a/docs/resources/user.md.erb b/docs/resources/user.md.erb index 329804dd8..2b30518bd 100644 --- a/docs/resources/user.md.erb +++ b/docs/resources/user.md.erb @@ -33,6 +33,7 @@ where * `gid`, `group`, `groups`, `home`, `maxdays`, `mindays`, `shell`, `uid`, and `warndays` are valid matchers for this resource
+ ## Examples The following examples show how to use this InSpec audit resource. diff --git a/docs/resources/windows_task.md.erb b/docs/resources/windows_task.md.erb index 7f78e420b..4d1e1fd59 100644 --- a/docs/resources/windows_task.md.erb +++ b/docs/resources/windows_task.md.erb @@ -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 + ... + ```