2015-10-21 20:52:41 +00:00
|
|
|
# author: Christoph Hartmann
|
|
|
|
# author: Dominik Richter
|
|
|
|
#
|
|
|
|
# prepare all operating systems with the required configuration
|
2015-10-22 17:57:17 +00:00
|
|
|
|
2019-02-14 05:50:33 +00:00
|
|
|
apt_update if platform_family?('debian')
|
2018-09-25 19:53:26 +00:00
|
|
|
|
|
|
|
# inject the current inspec gem for use with audit cookbook
|
|
|
|
# this is generated via Rake test:integration
|
|
|
|
cookbook_file '/root/inspec-core-local.gem' do
|
|
|
|
source 'inspec-core-local.gem'
|
|
|
|
action :create
|
|
|
|
end
|
|
|
|
|
|
|
|
chef_gem 'inspec' do
|
|
|
|
source '/root/inspec-core-local.gem'
|
|
|
|
end
|
|
|
|
|
2018-10-12 01:14:30 +00:00
|
|
|
def uuid_from_string(string)
|
|
|
|
require 'digest/sha1'
|
|
|
|
hash = Digest::SHA1.new
|
|
|
|
hash.update(string)
|
|
|
|
ary = hash.digest.unpack('NnnnnN')
|
|
|
|
ary[2] = (ary[2] & 0x0FFF) | (5 << 12)
|
|
|
|
ary[3] = (ary[3] & 0x3FFF) | 0x8000
|
|
|
|
'%08x-%04x-%04x-%04x-%04x%08x' % ary
|
|
|
|
end
|
|
|
|
|
|
|
|
# set a static node uuid for our testing nodes
|
|
|
|
Chef::Config[:chef_guid] = uuid_from_string(node.name)
|
|
|
|
|
2016-12-15 17:13:06 +00:00
|
|
|
# confgure ssh
|
|
|
|
include_recipe('os_prepare::ssh')
|
|
|
|
|
2016-02-01 16:18:33 +00:00
|
|
|
# basic tests
|
2015-10-24 09:11:36 +00:00
|
|
|
include_recipe('os_prepare::file')
|
2016-05-10 17:23:11 +00:00
|
|
|
include_recipe('os_prepare::mount') unless node['osprepare']['docker']
|
2016-02-01 16:18:33 +00:00
|
|
|
include_recipe('os_prepare::service')
|
2015-10-24 09:11:36 +00:00
|
|
|
include_recipe('os_prepare::package')
|
2015-11-17 21:12:19 +00:00
|
|
|
include_recipe('os_prepare::registry_key')
|
2017-06-15 09:13:07 +00:00
|
|
|
include_recipe('os_prepare::iis')
|
2016-05-10 17:23:11 +00:00
|
|
|
include_recipe('os_prepare::iptables') unless node['osprepare']['docker']
|
2017-03-21 21:17:50 +00:00
|
|
|
include_recipe('os_prepare::x509')
|
2017-04-04 14:34:09 +00:00
|
|
|
include_recipe('os_prepare::dh_params')
|
2016-05-10 17:23:11 +00:00
|
|
|
|
|
|
|
# config file parsing
|
2017-08-31 07:56:14 +00:00
|
|
|
include_recipe('os_prepare::json_yaml_csv_ini_xml')
|
2016-02-01 16:18:33 +00:00
|
|
|
|
|
|
|
# configure repos, eg. nginx
|
|
|
|
include_recipe('os_prepare::apt')
|
|
|
|
|
|
|
|
# application configuration
|
2017-04-07 08:56:29 +00:00
|
|
|
if node['osprepare']['application'] && node['platform_family'] != 'windows'
|
2016-05-10 17:23:11 +00:00
|
|
|
include_recipe('os_prepare::postgres')
|
|
|
|
include_recipe('os_prepare::auditctl') unless node['osprepare']['docker']
|
|
|
|
include_recipe('os_prepare::apache')
|
|
|
|
end
|
2017-04-24 14:47:03 +00:00
|
|
|
|
|
|
|
# docker host testing
|
|
|
|
include_recipe('os_prepare::docker_host') unless node['osprepare']['docker']
|
2018-04-26 19:10:14 +00:00
|
|
|
|
|
|
|
include_recipe('os_prepare::os_env')
|