mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
7a6119e7a6
* Add missing tests for groups resource, document members propery, and assorted fixes. Update existing documentation for group resource. Add documentation for groups resource. Update group resource tests to test members property. Change groups resource members property to have simple style. (this ensures members is a single array) remove deprecated have_gid propery. change `if !` to `unless` Remove early return from members method. This prevented members from working correctly on any OS other than Windows. Add missing tests for the groups resource. remove tests for has_gid Signed-off-by: Miah Johnson <miah@chia-pet.org> * Fix comments Signed-off-by: Jared Quick <jquick@chef.io>
79 lines
1.5 KiB
Text
79 lines
1.5 KiB
Text
---
|
|
title: About the group Resource
|
|
platform: os
|
|
---
|
|
|
|
# group
|
|
|
|
Use the `group` InSpec audit resource to test a single group on the system.
|
|
|
|
<br>
|
|
|
|
## Availability
|
|
|
|
### Installation
|
|
|
|
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
|
|
### Version
|
|
|
|
This resource first became available in v1.0.0 of InSpec.
|
|
|
|
## Syntax
|
|
|
|
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:
|
|
|
|
describe group('group_name') do
|
|
it { should exist }
|
|
its('gid') { should eq 0 }
|
|
end
|
|
|
|
where
|
|
|
|
* `'group_name'` must specify the name of a group to be tested on the system
|
|
* `exist` and `'gid'` are valid matchers for this resource
|
|
|
|
<br>
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
### Test the group identifier for the root group
|
|
|
|
describe group('root') do
|
|
it { should exist }
|
|
its('gid') { should eq 0 }
|
|
end
|
|
|
|
<br>
|
|
|
|
## Properties
|
|
|
|
### gid
|
|
|
|
The `gid` property tests the named group identifier:
|
|
|
|
its('gid') { should eq 1234 }
|
|
|
|
### members
|
|
|
|
The `members` property tests the members that belong to the group:
|
|
|
|
its('members') { should include 'root' }
|
|
|
|
## Matchers
|
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
|
|
### be_local
|
|
|
|
The `be_local` matcher tests if the group is a local group:
|
|
|
|
it { should be_local }
|
|
|
|
### exist
|
|
|
|
The `exist` matcher tests if the named group exists:
|
|
|
|
it { should exist }
|