2015-10-21 22:52:41 +02:00
|
|
|
#
|
|
|
|
# prepare all operating systems with the required configuration
|
2015-10-22 19:57:17 +02:00
|
|
|
|
2019-02-13 21:50:33 -08:00
|
|
|
apt_update if platform_family?('debian')
|
2018-09-25 15:53:26 -04: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-11 21:14:30 -04: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 18:13:06 +01:00
|
|
|
# confgure ssh
|
|
|
|
include_recipe('os_prepare::ssh')
|
|
|
|
|
2016-02-01 17:18:33 +01:00
|
|
|
# basic tests
|
2015-10-24 11:11:36 +02:00
|
|
|
include_recipe('os_prepare::file')
|
2016-05-10 19:23:11 +02:00
|
|
|
include_recipe('os_prepare::mount') unless node['osprepare']['docker']
|
2016-02-01 17:18:33 +01:00
|
|
|
include_recipe('os_prepare::service')
|
2015-10-24 11:11:36 +02:00
|
|
|
include_recipe('os_prepare::package')
|
2015-11-17 22:12:19 +01:00
|
|
|
include_recipe('os_prepare::registry_key')
|
2017-06-15 05:13:07 -04:00
|
|
|
include_recipe('os_prepare::iis')
|
2016-05-10 19:23:11 +02:00
|
|
|
include_recipe('os_prepare::iptables') unless node['osprepare']['docker']
|
2017-03-21 22:17:50 +01:00
|
|
|
include_recipe('os_prepare::x509')
|
2017-04-04 09:34:09 -05:00
|
|
|
include_recipe('os_prepare::dh_params')
|
2016-05-10 19:23:11 +02:00
|
|
|
|
|
|
|
# config file parsing
|
2017-08-31 03:56:14 -04:00
|
|
|
include_recipe('os_prepare::json_yaml_csv_ini_xml')
|
2016-02-01 17:18:33 +01:00
|
|
|
|
|
|
|
# configure repos, eg. nginx
|
|
|
|
include_recipe('os_prepare::apt')
|
|
|
|
|
|
|
|
# application configuration
|
2017-04-07 10:56:29 +02:00
|
|
|
if node['osprepare']['application'] && node['platform_family'] != 'windows'
|
2016-05-10 19:23:11 +02:00
|
|
|
include_recipe('os_prepare::postgres')
|
|
|
|
include_recipe('os_prepare::auditctl') unless node['osprepare']['docker']
|
|
|
|
include_recipe('os_prepare::apache')
|
|
|
|
end
|
2017-04-24 16:47:03 +02:00
|
|
|
|
|
|
|
# docker host testing
|
|
|
|
include_recipe('os_prepare::docker_host') unless node['osprepare']['docker']
|
2018-04-26 15:10:14 -04:00
|
|
|
|
|
|
|
include_recipe('os_prepare::os_env')
|