Doc review

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>
This commit is contained in:
Deepa Kumaraswamy 2022-05-13 19:15:25 +05:30
parent 875e99099e
commit 833a437e92

View file

@ -11,45 +11,45 @@ platform = "os"
parent = "inspec/resources/os"
+++
Use the `processes` Chef InSpec audit resource to test properties for programs that are running on the system.
Use the `processes` Chef InSpec audit resource to test the properties of system programs.
## Availability
### Installation
This resource is distributed with Chef InSpec.
The Chef InSpec distributes this resource.
### Version
This resource first became available in v1.0.0 of InSpec.
This resource is available from InSpec 1.0 version.
## Syntax
A `processes` resource block declares the name of the process to be tested, and then declares one (or more) property/value pairs:
A `processes` resource block declares the process name that must be tested and defines one or more property and value pairs.
describe processes('process_name') do
its('property_name') { should eq ['property_value'] }
describe processes('NAME') do
its('property_name') { should eq ['VALUE'] }
end
where
- `'process_name'` specifies the name of a process to check. If this is a string, it will be converted to a Regexp. For more specificity, pass a Regexp directly. If left blank, all processes will be returned.
- `property_name` is some valid property of this resource.
- `property_value` is the expected value for the specified property.
> where
>
> - `process_name` specifies the name of the process to test. If the value is a string, it is converted to a `Regexp`. You can pass a `Regexp` directly for more accurate results. If left blank returns all processes.
> - `property_name` is a valid property of this resource.
> - `property_value` is the expected value for the specified property.
## Properties
The specific properties of this resource are: `labels`, `pids`, `cpus`, `mem`, `vsz`, `rss`, `tty`, `states`, `start`, `time`, `users`, `commands`, `count` and `list`
The specific properties of this resource are: `labels`, `pids`, `cpus`, `mem`, `vsz`, `rss`, `tty`, `states`, `start`, `time`, `users`, `commands`, `count`, and `list`
The properties can be used as:
Usage of these properties is as follows:
its('property_name') { should eq ['property_value'] }
its('property_name') { should eq ['VALUE'] }
## Matchers
For a full list of available matchers, please visit our [matchers page](/inspec/matchers/).
For a full list of available matchers, please visit the [matchers page](/inspec/matchers/).
The specific matcher of this resource is: `be_running`
The specific matcher of this resource is: `be_running`.
### be_running
@ -61,22 +61,22 @@ The `be_running` matcher tests if the named process is running:
The following examples show how to use this Chef InSpec audit resource.
### Test if the list length for the mysqld process is 1
### Test if the mysqld process list length is 1
describe processes('mysqld') do
describe processes('SQLD') do
its('list.length') { should eq 1 }
end
### Test if the process count for the mysqld process is 1
### Test if the mysqld process count is 1
describe processes('mysqld') do
describe processes('SQLD') do
its('count') { should eq 1 }
end
### Test if the process is owned by a specific user
### Test if the user owns the process
describe processes('init') do
its('users') { should eq ['root'] }
its('users') { should eq ['ROOT'] }
end
describe processes('winlogon') do
@ -90,7 +90,7 @@ The following examples show how to use this Chef InSpec audit resource.
end
describe processes('windows_process') do
its('labels') { should cmp "High" }
its('labels') { should cmp "HIGH" }
end
### Test if a process exists on the system
@ -107,9 +107,7 @@ The following examples show how to use this Chef InSpec audit resource.
### Test for a process using a specific Regexp
If the process name is too common for a string to uniquely find it,
you may use a regexp. Inclusion of whitespace characters may be
needed.
Use `regexp` if the process name is too common for a string to find it uniquely. You may need to include whitespace characters.
describe processes(Regexp.new("/usr/local/bin/swap -d")) do
its('list.length') { should eq 1 }
@ -117,13 +115,11 @@ needed.
### Notes for auditing Windows systems
Sometimes with system properties there isn't a direct comparison between different operating systems.
Most of the `property_name`'s do align between the different OS's.
Sometimes there is no direct comparison between different operating systems and system properties. Most of the `property_name` do align between the various operating systems.
There are however some exception's, for example, within linux `states` offers multiple properties.
Windows doesn't have direct comparison that is a single property so instead `states` is mapped to the property of `Responding`, This is a boolean true/false flag to help determine if the process is hung.
However, there are some exceptions. For example, within Linux operating system, `states` offer multiple properties. Windows operating systems do not have a direct comparison on a single property. Hence, `states` is mapped to the property of `Responding` and determines a boolean (true/false) flag if the process is hung.
Below is a mapping table to help you understand what property the unix field maps to the windows `Get-Process` Property
The following mapping table aids you in understanding the Unix field property mapping to the Windows `Get-Process` property:
| _unix ps field_ | _windows PowerShell Property_ |
| :-------------: | :---------------------------: |
@ -139,4 +135,3 @@ Below is a mapping table to help you understand what property the unix field map
| time | TotalProcessorTime |
| users | UserName |
| commands | Path |