2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
title: About the bsd_service Resource
|
2018-02-16 00:28:15 +00:00
|
|
|
platform: linux
|
2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# bsd_service
|
|
|
|
|
|
|
|
Use the `bsd_service` InSpec audit resource to test a service using a Berkeley OS-style `init` on the FreeBSD platform.
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Syntax
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
A `bsd_service` resource block declares the name of a service and then one (or more) matchers to test the state of the service:
|
|
|
|
|
|
|
|
describe bsd_service('service_name') do
|
|
|
|
it { should be_installed }
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
* `('service_name')` must specify a service name
|
2018-02-01 22:43:16 +00:00
|
|
|
* `be_installed`, `be_enabled`, and `be_running` are valid matchers for this resource.
|
|
|
|
|
|
|
|
### Using `bsd_service` resource parameters
|
|
|
|
|
|
|
|
#### Path
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The path to the service manager's control may be specified for situations where the path isn't available in the current `PATH`. For example:
|
|
|
|
|
|
|
|
describe bsd_service('service_name', '/path/to/control') do
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_installed }
|
|
|
|
it { should be_running }
|
|
|
|
end
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2018-02-15 14:33:22 +00:00
|
|
|
## Properties
|
2018-02-01 22:43:16 +00:00
|
|
|
|
|
|
|
All properties available to the `service` resource may be used.
|
2018-02-16 02:34:11 +00:00
|
|
|
|
2018-02-01 22:43:16 +00:00
|
|
|
<br>
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
## Matchers
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2018-02-16 03:07:18 +00:00
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### be_enabled
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `be_enabled` matcher tests if the named service is enabled:
|
|
|
|
|
|
|
|
it { should be_enabled }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### be_installed
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `be_installed` matcher tests if the named service is installed:
|
|
|
|
|
|
|
|
it { should be_installed }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### be_running
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `be_running` matcher tests if the named service is running:
|
|
|
|
|
|
|
|
it { should be_running }
|