mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
689fe34cc9
* Docs for apache resource
Signed-off-by: kgarmoe <kgarmoe@chef.io>
* Add deprecation warning to apache docs and resource, and clean up examples.
Signed-off-by: Adam Leff <adam@leff.co>
* Update apache_conf resource to remove dependency on apache resource
Signed-off-by: Adam Leff <adam@leff.co>
* Make conf_dir method public
Signed-off-by: Adam Leff <adam@leff.co>
* Removes unnecessary aide_conf commit, pulled in from e25f0a45
Signed-off-by: Adam Leff <adam@leff.co>
* Switch to Pathname to calculate conf_dir
Needed to avoid Windows adding `C:\` in unit tests when calling
File.expand_path.
Signed-off-by: Adam Leff <adam@leff.co>
49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
# encoding: utf-8
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
# author: Christoph Hartmann
|
|
# author: Dominik Richter
|
|
|
|
module Inspec::Resources
|
|
class Apache < Inspec.resource(1)
|
|
name 'apache'
|
|
desc 'Use the apache InSpec audit resource to retrieve Apache environment settings.'
|
|
example "
|
|
describe apache do
|
|
its ('service') { should cmp 'apache2' }
|
|
end
|
|
|
|
describe apache do
|
|
its ('conf_dir') { should cmp '/etc/apache2' }
|
|
end
|
|
|
|
describe apache do
|
|
its ('conf_path') { should cmp '/etc/apache2/apache2.conf' }
|
|
end
|
|
|
|
describe apache do
|
|
its ('user') { should cmp 'www-data' }
|
|
end
|
|
"
|
|
|
|
attr_reader :service, :conf_dir, :conf_path, :user
|
|
def initialize
|
|
warn '[DEPRECATED] The `apache` resource is deprecated and will be removed in InSpec 3.0.'
|
|
|
|
if inspec.os.debian?
|
|
@service = 'apache2'
|
|
@conf_dir = '/etc/apache2/'
|
|
@conf_path = File.join @conf_dir, 'apache2.conf'
|
|
@user = 'www-data'
|
|
else
|
|
@service = 'httpd'
|
|
@conf_dir = '/etc/httpd/'
|
|
@conf_path = File.join @conf_dir, '/conf/httpd.conf'
|
|
@user = 'apache'
|
|
end
|
|
end
|
|
|
|
def to_s
|
|
'Apache Environment'
|
|
end
|
|
end
|
|
end
|