mirror of
https://github.com/inspec/inspec
synced 2024-12-12 06:12:37 +00:00
1fdecc6680
The following new resources have been added; however, they presently only support FreeBSD and similar. * `zfs_dataset`: tests if a named ZFS dataset is present and/or has certain properties. * `zfs_pool`: tests if a named ZFS pool is present and/or has certain properties. Additionally, the `mount` resource has been reworked to include support for FreeBSD; while the existing class was renamed to LinuxMountParser. Unit-tests were added for all of the above. Signed-off-by: Joseph Benden <joe@benden.us>
83 lines
1.6 KiB
Text
83 lines
1.6 KiB
Text
---
|
|
title: About the mount Resource
|
|
---
|
|
|
|
# mount
|
|
|
|
Use the `mount` InSpec audit resource to test the mount points on FreeBSD and Linux systems.
|
|
|
|
## Syntax
|
|
|
|
An `mount` resource block declares the synchronization settings that should be tested:
|
|
|
|
describe mount('path') do
|
|
it { should MATCHER 'value' }
|
|
end
|
|
|
|
where
|
|
|
|
* `('path')` is the path to the mounted directory
|
|
* `MATCHER` is a valid matcher for this resource
|
|
* `'value'` is the value to be tested
|
|
|
|
|
|
## Matchers
|
|
|
|
This InSpec audit resource has the following matchers:
|
|
|
|
### be
|
|
|
|
<%= partial "/shared/matcher_be" %>
|
|
|
|
### be_mounted
|
|
|
|
The `be_mounted` matcher tests if the file is accessible from the file system:
|
|
|
|
it { should be_mounted }
|
|
|
|
### cmp
|
|
|
|
<%= partial "/shared/matcher_cmp" %>
|
|
|
|
### device
|
|
|
|
The `device` matcher tests the device from the `fstab` table:
|
|
|
|
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
|
|
|
|
### eq
|
|
|
|
<%= partial "/shared/matcher_eq" %>
|
|
|
|
### include
|
|
|
|
<%= partial "/shared/matcher_include" %>
|
|
|
|
### match
|
|
|
|
<%= partial "/shared/matcher_match" %>
|
|
|
|
### options
|
|
|
|
The `options` matcher tests the mount options for the file system from the `fstab` table:
|
|
|
|
its('options') { should eq ['rw', 'mode=620'] }
|
|
|
|
### type
|
|
|
|
The `type` matcher tests the file system type:
|
|
|
|
its('type') { should eq 'ext4' }
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
### Test a the mount point on '/'
|
|
|
|
describe mount('/') do
|
|
it { should be_mounted }
|
|
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
|
|
its('type') { should eq 'ext4' }
|
|
its('options') { should eq ['rw', 'mode=620'] }
|
|
end
|