2018-01-31 10:16:15 +00:00
|
|
|
---
|
|
|
|
title: About the apache Resource
|
2018-02-16 00:28:15 +00:00
|
|
|
platform: linux
|
2018-01-31 10:16:15 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# apache
|
|
|
|
|
|
|
|
Use the `apache` InSpec audit resource to test the state of the Apache server on Linux/Unix systems.
|
|
|
|
|
|
|
|
<p class="warning">This resource is deprecated and should not be used. It will be removed in InSpec 3.0.</p>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2018-08-09 12:34:49 +00:00
|
|
|
## Availability
|
|
|
|
|
|
|
|
### Installation
|
|
|
|
|
|
|
|
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
|
|
|
|
|
|
### Version
|
|
|
|
|
|
|
|
This resource first became available in v1.51.15 of InSpec.
|
|
|
|
|
2018-01-31 10:16:15 +00:00
|
|
|
## Syntax
|
|
|
|
|
|
|
|
An `apache` InSpec audit resource block declares settings that should be tested:
|
|
|
|
|
|
|
|
describe apache do
|
|
|
|
its('setting_name') { should cmp 'value' }
|
|
|
|
end
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
* `'setting_name'` is description of the Apache configuration file
|
|
|
|
* `{ should cmp 'value' }` is the value that is expected
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2018-02-15 14:33:22 +00:00
|
|
|
## Properties
|
2018-01-31 10:16:15 +00:00
|
|
|
|
2018-06-06 18:10:48 +00:00
|
|
|
* `service`, `conf_dir`, `conf_path`, `user`
|
2018-01-31 10:16:15 +00:00
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
## Property Examples
|
|
|
|
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
|
|
|
|
### Test the service name.
|
|
|
|
|
|
|
|
describe apache do
|
|
|
|
its ('service') { should cmp 'apache2' }
|
|
|
|
end
|
|
|
|
|
|
|
|
### Test the configuration location
|
|
|
|
|
|
|
|
describe apache do
|
|
|
|
its ('conf_dir') { should cmp '/etc/apache2' }
|
|
|
|
end
|
|
|
|
|
|
|
|
### Test the path of the configuration file
|
|
|
|
|
|
|
|
describe apache do
|
|
|
|
its ('conf_path') { should cmp '/etc/apache2/apache2.conf' }
|
|
|
|
end
|
|
|
|
|
|
|
|
### Test the apache user
|
|
|
|
|
|
|
|
describe apache do
|
|
|
|
its ('user') { should cmp 'www-data' }
|
|
|
|
end
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
## Matchers
|
|
|
|
|
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/).
|