add apache base config

This commit is contained in:
Christoph Hartmann 2015-10-26 22:41:02 +01:00 committed by Dominik Richter
parent a2bc0845cd
commit cdb30c356f
3 changed files with 32 additions and 2 deletions

View file

@ -21,6 +21,7 @@ module Inspec
end
end
require 'resources/apache'
require 'resources/apache_conf'
require 'resources/apt'
require 'resources/audit_policy'

29
lib/resources/apache.rb Normal file
View file

@ -0,0 +1,29 @@
# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Christoph Hartmann
# author: Dominik Richter
# license: All rights reserved
class Apache < Inspec.resource(1)
name 'apache'
attr_reader :service, :conf_dir, :conf_path, :user
def initialize
case inspec.os[:family]
when 'ubuntu', '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

View file

@ -12,8 +12,8 @@ class ApacheConf < Inspec.resource(1)
include FindFiles
def initialize(conf_path)
@conf_path = conf_path
def initialize(conf_path = nil)
@conf_path = conf_path || inspec.apache.conf_path
@conf_dir = File.dirname(@conf_path)
@files_contents = {}
@content = nil