Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apache library from core inspec as it was deprecated in inspec 4 #30

Merged
merged 2 commits into from
May 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions libraries/apache.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

# copyright: 2015, Vulcano Security GmbH

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
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