mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Docs for apache resource
Signed-off-by: kgarmoe <kgarmoe@chef.io>
This commit is contained in:
parent
19782770db
commit
e25f0a45e8
3 changed files with 78 additions and 0 deletions
71
docs/resources/apache.md.erb
Normal file
71
docs/resources/apache.md.erb
Normal 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/).
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
require 'utils/filter'
|
||||
require 'utils/parser'
|
||||
|
||||
module Inspec::Resources
|
||||
class AideConf < Inspec.resource(1)
|
||||
name 'aide_conf'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue