mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
40031a9b83
This converts all current deprecation warnings/TODOs to use the `Inspec.deprecate()` deprecation facility. This also modifies `Inspec.deprecate()` to only require 1 argument. Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
48 lines
1.2 KiB
Ruby
48 lines
1.2 KiB
Ruby
# encoding: utf-8
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
|
|
module Inspec::Resources
|
|
class Apache < Inspec.resource(1)
|
|
name 'apache'
|
|
supports platform: 'unix'
|
|
desc 'Use the apache InSpec audit resource to retrieve Apache environment settings.'
|
|
example <<~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
|
|
EXAMPLE
|
|
|
|
attr_reader :service, :conf_dir, :conf_path, :user
|
|
def initialize
|
|
Inspec.deprecate(:resource_apache, 'The apache resource is deprecated')
|
|
|
|
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
|