Docs for apache resource

Signed-off-by: kgarmoe <kgarmoe@chef.io>
This commit is contained in:
kgarmoe 2018-01-29 14:10:47 -08:00 committed by Adam Leff
parent 19782770db
commit e25f0a45e8
3 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,71 @@
---
title: About the apache Resource
---
# apache
Use the `apache` InSpec audit resource to test the state of the Apache server on Linux/Unix systems.
<br>
## 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>
## Supported Properties
* 'service', 'conf_dir', 'conf_path', 'user'
<br>
## Property Examples
The following examples show how to use this InSpec audit resource.
### Test that Apache exists.
describe apache do
it { should exist }
end
### 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
This InSpec audit resource uses the following matchers: `should exist` and `cmp`. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

View file

@ -3,6 +3,7 @@
require 'utils/filter'
require 'utils/parser'
module Inspec::Resources
class AideConf < Inspec.resource(1)
name 'aide_conf'

View file

@ -6,6 +6,12 @@
module Inspec::Resources
class Apache < Inspec.resource(1)
name 'apache'
desc 'Use the apache InSpec audit resource to test if Apache is installed.'
example "
describe apache do
it { should exist }
end
"
attr_reader :service, :conf_dir, :conf_path, :user
def initialize