2015-10-21 20:52:41 +00:00
|
|
|
#
|
|
|
|
# prepare all operating systems with the required configuration
|
2015-10-22 17:57:17 +00:00
|
|
|
|
2019-06-11 22:24:35 +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
|
2019-06-11 22:24:35 +00:00
|
|
|
cookbook_file "/root/inspec-core-local.gem" do
|
|
|
|
source "inspec-core-local.gem"
|
2018-09-25 19:53:26 +00:00
|
|
|
action :create
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
chef_gem "inspec" do
|
|
|
|
source "/root/inspec-core-local.gem"
|
2018-09-25 19:53:26 +00:00
|
|
|
end
|
|
|
|
|
2018-10-12 01:14:30 +00:00
|
|
|
def uuid_from_string(string)
|
2019-06-11 22:24:35 +00:00
|
|
|
require "digest/sha1"
|
2018-10-12 01:14:30 +00:00
|
|
|
hash = Digest::SHA1.new
|
|
|
|
hash.update(string)
|
2019-06-11 22:24:35 +00:00
|
|
|
ary = hash.digest.unpack("NnnnnN")
|
2018-10-12 01:14:30 +00:00
|
|
|
ary[2] = (ary[2] & 0x0FFF) | (5 << 12)
|
|
|
|
ary[3] = (ary[3] & 0x3FFF) | 0x8000
|
2019-06-11 22:24:35 +00:00
|
|
|
"%08x-%04x-%04x-%04x-%04x%08x" % ary
|
2018-10-12 01:14:30 +00:00
|
|
|
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
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::ssh")
|
2016-12-15 17:13:06 +00:00
|
|
|
|
2016-02-01 16:18:33 +00:00
|
|
|
# basic tests
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::file")
|
|
|
|
include_recipe("os_prepare::mount") unless node["osprepare"]["docker"]
|
|
|
|
include_recipe("os_prepare::service")
|
|
|
|
include_recipe("os_prepare::package")
|
|
|
|
include_recipe("os_prepare::registry_key")
|
|
|
|
include_recipe("os_prepare::iis")
|
2019-06-23 00:35:32 +00:00
|
|
|
include_recipe("os_prepare::iptables")
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::x509")
|
|
|
|
include_recipe("os_prepare::dh_params")
|
2016-05-10 17:23:11 +00:00
|
|
|
|
|
|
|
# config file parsing
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::json_yaml_csv_ini_xml")
|
2016-02-01 16:18:33 +00:00
|
|
|
|
|
|
|
# configure repos, eg. nginx
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::apt")
|
2016-02-01 16:18:33 +00:00
|
|
|
|
|
|
|
# application configuration
|
2019-06-11 22:24:35 +00:00
|
|
|
if node["osprepare"]["application"] && node["platform_family"] != "windows"
|
|
|
|
include_recipe("os_prepare::postgres")
|
|
|
|
include_recipe("os_prepare::auditctl") unless node["osprepare"]["docker"]
|
|
|
|
include_recipe("os_prepare::apache")
|
2016-05-10 17:23:11 +00:00
|
|
|
end
|
2017-04-24 14:47:03 +00:00
|
|
|
|
|
|
|
# docker host testing
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::docker_host") unless node["osprepare"]["docker"]
|
2018-04-26 19:10:14 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
include_recipe("os_prepare::os_env")
|