mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
add apache base config
This commit is contained in:
parent
a2bc0845cd
commit
cdb30c356f
3 changed files with 32 additions and 2 deletions
|
@ -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
29
lib/resources/apache.rb
Normal 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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue