2015-10-26 21:41:02 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
|
|
|
2016-03-08 18:06:55 +00:00
|
|
|
module Inspec::Resources
|
|
|
|
class Apache < Inspec.resource(1)
|
|
|
|
name 'apache'
|
2018-02-19 14:26:49 +00:00
|
|
|
supports platform: 'unix'
|
2018-01-31 10:16:15 +00:00
|
|
|
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
|
|
|
|
"
|
2015-10-26 21:41:02 +00:00
|
|
|
|
2016-03-08 18:06:55 +00:00
|
|
|
attr_reader :service, :conf_dir, :conf_path, :user
|
|
|
|
def initialize
|
2018-10-15 22:25:27 +00:00
|
|
|
warn '[DEPRECATED] The `apache` resource is deprecated and will be removed in InSpec 4.0'
|
2018-01-31 10:16:15 +00:00
|
|
|
|
2016-08-03 17:18:24 +00:00
|
|
|
if inspec.os.debian?
|
2016-03-08 18:06:55 +00:00
|
|
|
@service = 'apache2'
|
|
|
|
@conf_dir = '/etc/apache2/'
|
2016-03-09 09:39:07 +00:00
|
|
|
@conf_path = File.join @conf_dir, 'apache2.conf'
|
2016-03-08 18:06:55 +00:00
|
|
|
@user = 'www-data'
|
|
|
|
else
|
|
|
|
@service = 'httpd'
|
|
|
|
@conf_dir = '/etc/httpd/'
|
2016-03-09 09:39:07 +00:00
|
|
|
@conf_path = File.join @conf_dir, '/conf/httpd.conf'
|
2016-03-08 18:06:55 +00:00
|
|
|
@user = 'apache'
|
|
|
|
end
|
2015-10-26 21:41:02 +00:00
|
|
|
end
|
|
|
|
|
2016-03-08 18:06:55 +00:00
|
|
|
def to_s
|
|
|
|
'Apache Environment'
|
|
|
|
end
|
2015-10-26 21:41:02 +00:00
|
|
|
end
|
|
|
|
end
|