cloud-mu 3.1.5 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +5 -1
- data/ansible/roles/mu-windows/files/LaunchConfig.json +9 -0
- data/ansible/roles/mu-windows/files/config.xml +76 -0
- data/ansible/roles/mu-windows/tasks/main.yml +16 -0
- data/bin/mu-adopt +16 -12
- data/bin/mu-azure-tests +57 -0
- data/bin/mu-cleanup +2 -4
- data/bin/mu-configure +52 -0
- data/bin/mu-deploy +3 -3
- data/bin/mu-findstray-tests +25 -0
- data/bin/mu-gen-docs +2 -4
- data/bin/mu-load-config.rb +2 -1
- data/bin/mu-node-manage +15 -16
- data/bin/mu-run-tests +37 -12
- data/cloud-mu.gemspec +3 -3
- data/cookbooks/mu-activedirectory/resources/domain.rb +4 -4
- data/cookbooks/mu-activedirectory/resources/domain_controller.rb +4 -4
- data/cookbooks/mu-tools/libraries/helper.rb +1 -1
- data/cookbooks/mu-tools/recipes/apply_security.rb +14 -14
- data/cookbooks/mu-tools/recipes/aws_api.rb +9 -0
- data/cookbooks/mu-tools/recipes/eks.rb +2 -2
- data/cookbooks/mu-tools/recipes/windows-client.rb +25 -22
- data/extras/clean-stock-amis +25 -19
- data/extras/generate-stock-images +1 -0
- data/extras/image-generators/AWS/win2k12.yaml +2 -0
- data/extras/image-generators/AWS/win2k16.yaml +2 -0
- data/extras/image-generators/AWS/win2k19.yaml +2 -0
- data/modules/mommacat.ru +1 -1
- data/modules/mu.rb +86 -98
- data/modules/mu/adoption.rb +373 -58
- data/modules/mu/cleanup.rb +214 -303
- data/modules/mu/cloud.rb +128 -1733
- data/modules/mu/cloud/database.rb +49 -0
- data/modules/mu/cloud/dnszone.rb +44 -0
- data/modules/mu/cloud/machine_images.rb +212 -0
- data/modules/mu/cloud/providers.rb +81 -0
- data/modules/mu/cloud/resource_base.rb +929 -0
- data/modules/mu/cloud/server.rb +40 -0
- data/modules/mu/cloud/server_pool.rb +1 -0
- data/modules/mu/cloud/ssh_sessions.rb +228 -0
- data/modules/mu/cloud/winrm_sessions.rb +237 -0
- data/modules/mu/cloud/wrappers.rb +169 -0
- data/modules/mu/config.rb +123 -81
- data/modules/mu/config/alarm.rb +2 -6
- data/modules/mu/config/bucket.rb +32 -3
- data/modules/mu/config/cache_cluster.rb +2 -2
- data/modules/mu/config/cdn.rb +100 -0
- data/modules/mu/config/collection.rb +1 -1
- data/modules/mu/config/container_cluster.rb +7 -2
- data/modules/mu/config/database.rb +84 -105
- data/modules/mu/config/database.yml +1 -2
- data/modules/mu/config/dnszone.rb +5 -4
- data/modules/mu/config/doc_helpers.rb +5 -6
- data/modules/mu/config/endpoint.rb +2 -1
- data/modules/mu/config/firewall_rule.rb +3 -19
- data/modules/mu/config/folder.rb +1 -1
- data/modules/mu/config/function.rb +17 -8
- data/modules/mu/config/group.rb +1 -1
- data/modules/mu/config/habitat.rb +1 -1
- data/modules/mu/config/job.rb +89 -0
- data/modules/mu/config/loadbalancer.rb +57 -11
- data/modules/mu/config/log.rb +1 -1
- data/modules/mu/config/msg_queue.rb +1 -1
- data/modules/mu/config/nosqldb.rb +1 -1
- data/modules/mu/config/notifier.rb +8 -19
- data/modules/mu/config/ref.rb +92 -14
- data/modules/mu/config/role.rb +1 -1
- data/modules/mu/config/schema_helpers.rb +38 -37
- data/modules/mu/config/search_domain.rb +1 -1
- data/modules/mu/config/server.rb +12 -13
- data/modules/mu/config/server_pool.rb +3 -7
- data/modules/mu/config/storage_pool.rb +1 -1
- data/modules/mu/config/tail.rb +11 -0
- data/modules/mu/config/user.rb +1 -1
- data/modules/mu/config/vpc.rb +27 -23
- data/modules/mu/config/vpc.yml +0 -1
- data/modules/mu/defaults/AWS.yaml +90 -90
- data/modules/mu/defaults/Azure.yaml +1 -0
- data/modules/mu/defaults/Google.yaml +1 -0
- data/modules/mu/deploy.rb +34 -20
- data/modules/mu/groomer.rb +16 -1
- data/modules/mu/groomers/ansible.rb +69 -4
- data/modules/mu/groomers/chef.rb +51 -4
- data/modules/mu/logger.rb +120 -144
- data/modules/mu/master.rb +97 -4
- data/modules/mu/mommacat.rb +160 -874
- data/modules/mu/mommacat/daemon.rb +23 -14
- data/modules/mu/mommacat/naming.rb +110 -3
- data/modules/mu/mommacat/search.rb +497 -0
- data/modules/mu/mommacat/storage.rb +252 -194
- data/modules/mu/{clouds → providers}/README.md +1 -1
- data/modules/mu/{clouds → providers}/aws.rb +258 -57
- data/modules/mu/{clouds → providers}/aws/alarm.rb +3 -3
- data/modules/mu/{clouds → providers}/aws/bucket.rb +275 -41
- data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +14 -50
- data/modules/mu/providers/aws/cdn.rb +782 -0
- data/modules/mu/{clouds → providers}/aws/collection.rb +5 -5
- data/modules/mu/{clouds → providers}/aws/container_cluster.rb +95 -84
- data/modules/mu/providers/aws/database.rb +1744 -0
- data/modules/mu/{clouds → providers}/aws/dnszone.rb +26 -12
- data/modules/mu/providers/aws/endpoint.rb +1072 -0
- data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +39 -32
- data/modules/mu/{clouds → providers}/aws/folder.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/function.rb +289 -134
- data/modules/mu/{clouds → providers}/aws/group.rb +18 -20
- data/modules/mu/{clouds → providers}/aws/habitat.rb +3 -3
- data/modules/mu/providers/aws/job.rb +466 -0
- data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +77 -47
- data/modules/mu/{clouds → providers}/aws/log.rb +5 -5
- data/modules/mu/{clouds → providers}/aws/msg_queue.rb +14 -11
- data/modules/mu/{clouds → providers}/aws/nosqldb.rb +96 -5
- data/modules/mu/{clouds → providers}/aws/notifier.rb +135 -63
- data/modules/mu/{clouds → providers}/aws/role.rb +76 -48
- data/modules/mu/{clouds → providers}/aws/search_domain.rb +172 -41
- data/modules/mu/{clouds → providers}/aws/server.rb +66 -98
- data/modules/mu/{clouds → providers}/aws/server_pool.rb +42 -60
- data/modules/mu/{clouds → providers}/aws/storage_pool.rb +21 -38
- data/modules/mu/{clouds → providers}/aws/user.rb +12 -16
- data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +5 -4
- data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/vpc.rb +143 -74
- data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
- data/modules/mu/{clouds → providers}/azure.rb +13 -0
- data/modules/mu/{clouds → providers}/azure/container_cluster.rb +1 -5
- data/modules/mu/{clouds → providers}/azure/firewall_rule.rb +8 -1
- data/modules/mu/{clouds → providers}/azure/habitat.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/loadbalancer.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/role.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/server.rb +32 -24
- data/modules/mu/{clouds → providers}/azure/user.rb +1 -1
- data/modules/mu/{clouds → providers}/azure/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/vpc.rb +4 -6
- data/modules/mu/{clouds → providers}/cloudformation.rb +10 -0
- data/modules/mu/{clouds → providers}/cloudformation/alarm.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/cache_cluster.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/collection.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/database.rb +6 -17
- data/modules/mu/{clouds → providers}/cloudformation/dnszone.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/firewall_rule.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/loadbalancer.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/log.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/server.rb +7 -7
- data/modules/mu/{clouds → providers}/cloudformation/server_pool.rb +5 -5
- data/modules/mu/{clouds → providers}/cloudformation/vpc.rb +3 -3
- data/modules/mu/{clouds → providers}/docker.rb +0 -0
- data/modules/mu/{clouds → providers}/google.rb +29 -6
- data/modules/mu/{clouds → providers}/google/bucket.rb +4 -4
- data/modules/mu/{clouds → providers}/google/container_cluster.rb +38 -20
- data/modules/mu/{clouds → providers}/google/database.rb +5 -12
- data/modules/mu/{clouds → providers}/google/firewall_rule.rb +5 -5
- data/modules/mu/{clouds → providers}/google/folder.rb +5 -9
- data/modules/mu/{clouds → providers}/google/function.rb +6 -6
- data/modules/mu/{clouds → providers}/google/group.rb +9 -17
- data/modules/mu/{clouds → providers}/google/habitat.rb +4 -8
- data/modules/mu/{clouds → providers}/google/loadbalancer.rb +5 -5
- data/modules/mu/{clouds → providers}/google/role.rb +50 -31
- data/modules/mu/{clouds → providers}/google/server.rb +41 -24
- data/modules/mu/{clouds → providers}/google/server_pool.rb +14 -14
- data/modules/mu/{clouds → providers}/google/user.rb +34 -24
- data/modules/mu/{clouds → providers}/google/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/google/vpc.rb +45 -14
- data/modules/tests/aws-jobs-functions.yaml +46 -0
- data/modules/tests/centos6.yaml +15 -0
- data/modules/tests/centos7.yaml +15 -0
- data/modules/tests/centos8.yaml +12 -0
- data/modules/tests/ecs.yaml +2 -2
- data/modules/tests/eks.yaml +1 -1
- data/modules/tests/functions/node-function/lambda_function.js +10 -0
- data/modules/tests/functions/python-function/lambda_function.py +12 -0
- data/modules/tests/microservice_app.yaml +288 -0
- data/modules/tests/rds.yaml +108 -0
- data/modules/tests/regrooms/rds.yaml +123 -0
- data/modules/tests/server-with-scrub-muisms.yaml +1 -1
- data/modules/tests/super_complex_bok.yml +2 -2
- data/modules/tests/super_simple_bok.yml +3 -5
- data/spec/mu/clouds/azure_spec.rb +2 -2
- metadata +122 -92
- data/modules/mu/clouds/aws/database.rb +0 -1974
- data/modules/mu/clouds/aws/endpoint.rb +0 -596
data/bin/mu-node-manage
CHANGED
|
@@ -29,9 +29,9 @@ Usage:
|
|
|
29
29
|
opt :all, "Operate on all nodes/deploys. Use with caution.", :require => false, :default => false, :type => :boolean
|
|
30
30
|
opt :platform, "Operate exclusively on one nodes of a particular operating system. Can be used in conjunction with -a or -d. Valid platforms: linux, windows", :require => false, :type => :string
|
|
31
31
|
opt :environment, "Operate exclusively on one nodes with a particular environment (e.g. dev, prod). Can be used in conjunction with -a or -d.", :require => false, :type => :string
|
|
32
|
-
opt :override_chef_runlist, "An alternate runlist to pass to Chef, in
|
|
32
|
+
opt :override_chef_runlist, "An alternate runlist to pass to Chef, in groomeronly mode.", :require => false, :type => :string
|
|
33
33
|
opt :xecute, "Run a shell command on matching nodes. Overrides --mode and suppresses some informational output in favor of scriptability.", :require => false, :type => :string
|
|
34
|
-
opt :mode, "Action to perform on matching nodes. Valid actions: groom,
|
|
34
|
+
opt :mode, "Action to perform on matching nodes. Valid actions: groom, groomeronly, awsmeta, vaults, certs, chefupgrade", :require => false, :default => "groomeronly", :type => :string
|
|
35
35
|
opt :verbose, "Show output from Chef runs, etc", :require => false, :default => false, :type => :boolean
|
|
36
36
|
opt :winrm, "Force WinRM connection. Disable SSH fallback", :require => false, :default => false, :type => :boolean
|
|
37
37
|
opt :info, "List a particular node attribute", :require => false, :default => 'nodename', :type => :string
|
|
@@ -39,8 +39,10 @@ end
|
|
|
39
39
|
|
|
40
40
|
MU.setLogging(MU::Logger::LOUD) if $opts[:verbose]
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
$opts[:mode] = "groomeronly" if $opts[:mode] == "chefrun"
|
|
43
|
+
|
|
44
|
+
if !["groom", "groomeronly", "vaults", "userdata", "awsmeta", "certs", "chefupgrade"].include?($opts[:mode])
|
|
45
|
+
Optimist::die(:mode, "--mode must be one of: groom, groomeronly, awsmeta, vaults, certs, chefupgrade")
|
|
44
46
|
end
|
|
45
47
|
if $opts[:platform] and !["linux", "windows"].include?($opts[:platform])
|
|
46
48
|
Optimist::die(:platform, "--platform must be one of: linux, windows")
|
|
@@ -176,7 +178,7 @@ end
|
|
|
176
178
|
exit 1 if !ok
|
|
177
179
|
|
|
178
180
|
|
|
179
|
-
def reGroom(deploys = MU::MommaCat.listDeploys, nodes = [], vaults_only: false)
|
|
181
|
+
def reGroom(deploys = MU::MommaCat.listDeploys, nodes = [], vaults_only: false, groomeronly: false)
|
|
180
182
|
badnodes = []
|
|
181
183
|
count = 0
|
|
182
184
|
deploys.each { |muid|
|
|
@@ -196,6 +198,8 @@ def reGroom(deploys = MU::MommaCat.listDeploys, nodes = [], vaults_only: false)
|
|
|
196
198
|
server.config["vault_access"].each { |v|
|
|
197
199
|
MU::Groomer::Chef.grantSecretAccess(mu_name, v['vault'], v['item'])
|
|
198
200
|
}
|
|
201
|
+
elsif groomeronly
|
|
202
|
+
server.groomer.run
|
|
199
203
|
else
|
|
200
204
|
mommacat.groomNode(server.cloud_id, nodeclass, type, mu_name: mu_name)
|
|
201
205
|
end
|
|
@@ -227,7 +231,7 @@ def reGroom(deploys = MU::MommaCat.listDeploys, nodes = [], vaults_only: false)
|
|
|
227
231
|
end
|
|
228
232
|
end
|
|
229
233
|
|
|
230
|
-
def runCommand(deploys = MU::MommaCat.listDeploys, nodes = [], cmd = nil, print_output: $opts[:verbose], noop: false
|
|
234
|
+
def runCommand(deploys = MU::MommaCat.listDeploys, nodes = [], cmd = nil, print_output: $opts[:verbose], noop: false)
|
|
231
235
|
badnodes = []
|
|
232
236
|
count = 0
|
|
233
237
|
deploys.each { |muid|
|
|
@@ -247,12 +251,6 @@ def runCommand(deploys = MU::MommaCat.listDeploys, nodes = [], cmd = nil, print_
|
|
|
247
251
|
next
|
|
248
252
|
end
|
|
249
253
|
|
|
250
|
-
# Generate the command if attemting a chef run
|
|
251
|
-
if chefrun
|
|
252
|
-
cmd = serverobj.windows? ? "powershell -Command chef-client" : "chef-client || sudo chef-client"
|
|
253
|
-
cmd += " -o '#{chef_runlist}'" if chef_runlist
|
|
254
|
-
end
|
|
255
|
-
|
|
256
254
|
MU.log "Running '#{cmd}' on #{nodename} (##{count})" if !print_output
|
|
257
255
|
|
|
258
256
|
# Set Variables to catch the output and exit code of the execution
|
|
@@ -363,7 +361,7 @@ def runCommand(deploys = MU::MommaCat.listDeploys, nodes = [], cmd = nil, print_
|
|
|
363
361
|
}
|
|
364
362
|
|
|
365
363
|
if badnodes.size > 0
|
|
366
|
-
cmd = "Chef" if $opts[:mode] == "
|
|
364
|
+
cmd = "Chef" if $opts[:mode] == "groomeronly"
|
|
367
365
|
if !print_output
|
|
368
366
|
MU.log "Not all `#{cmd}` runs exited cleanly", MU::WARN, details: badnodes
|
|
369
367
|
else
|
|
@@ -687,12 +685,13 @@ elsif $opts[:mode] == "vaults"
|
|
|
687
685
|
reGroom(do_deploys, do_nodes, vaults_only: true)
|
|
688
686
|
elsif $opts[:mode] == "chefupgrade"
|
|
689
687
|
chefUpgrade(do_deploys, do_nodes)
|
|
690
|
-
elsif $opts[:mode] == "
|
|
688
|
+
elsif $opts[:mode] == "groomeronly"
|
|
691
689
|
print_output = $opts[:verbose] || do_nodes.size == 1
|
|
692
690
|
if $opts[:override_chef_runlist]
|
|
693
|
-
runCommand(do_deploys, do_nodes, chef_runlist: $opts[:override_chef_runlist],
|
|
691
|
+
# runCommand(do_deploys, do_nodes, chef_runlist: $opts[:override_chef_runlist], groomeronly: true, print_output: print_output)
|
|
694
692
|
else
|
|
695
|
-
runCommand(do_deploys, do_nodes,
|
|
693
|
+
# runCommand(do_deploys, do_nodes, groomeronly: true, print_output: print_output)
|
|
694
|
+
reGroom(do_deploys, do_nodes, groomeronly: true)
|
|
696
695
|
end
|
|
697
696
|
elsif $opts[:mode] == "userdata" or $opts[:mode] == "awsmeta"
|
|
698
697
|
# Need Google equiv and to select nodes correctly based on what cloud they're in
|
data/bin/mu-run-tests
CHANGED
|
@@ -34,6 +34,7 @@ Usage:
|
|
|
34
34
|
#{$0} [-m <#>] [-f] [-v] [specific test BoK to run [...]]
|
|
35
35
|
EOS
|
|
36
36
|
opt :max_threads, "Environment to set on creation.", :require => false, :default => 3, :type => :integer
|
|
37
|
+
opt :max_retries, "Number of times to retry failed tests in --dryrun mode.", :require => false, :default => 2, :type => :integer
|
|
37
38
|
opt :full, "Actually run deploys, instead of --dryrun", :require => false, :default => false
|
|
38
39
|
opt :verbose, "Show more information while running", :require => false, :default => false
|
|
39
40
|
end
|
|
@@ -42,7 +43,7 @@ only = ARGV
|
|
|
42
43
|
|
|
43
44
|
files = Dir.glob("*.yaml", base: dir)
|
|
44
45
|
files.concat(Dir.glob("*.yml", base: dir))
|
|
45
|
-
baseclouds = MU::Cloud.
|
|
46
|
+
baseclouds = MU::Cloud.availableClouds.reject { |c| c == "CloudFormation" }
|
|
46
47
|
|
|
47
48
|
commands = {}
|
|
48
49
|
failures = []
|
|
@@ -56,20 +57,33 @@ end
|
|
|
56
57
|
|
|
57
58
|
files.each { |f|
|
|
58
59
|
clouds = baseclouds.dup
|
|
60
|
+
groomer_match = true
|
|
59
61
|
File.open(dir+"/"+f).readlines.each { |l|
|
|
60
62
|
l.chomp!
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
if l.match(/^\s*#\s*clouds: (.*)/)
|
|
64
|
+
clouds = []
|
|
65
|
+
cloudstr = Regexp.last_match[1]
|
|
66
|
+
cloudstr.split(/\s*,\s*/).each { |c|
|
|
67
|
+
baseclouds.each { |cloud|
|
|
68
|
+
if cloud.match(/^#{Regexp.quote(c)}$/i)
|
|
69
|
+
clouds << cloud
|
|
70
|
+
end
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
elsif l.match(/^\s*#\s*groomers: (.*)/)
|
|
74
|
+
groomerstr = Regexp.last_match[1]
|
|
75
|
+
groomerstr.split(/\s*,\s*/).each { |g|
|
|
76
|
+
if !MU::Groomer.availableGroomers.include?(g)
|
|
77
|
+
MU.log "#{f} requires groomer #{g}, which is not available. This test will be skipped.", MU::NOTICE
|
|
78
|
+
groomer_match = false
|
|
68
79
|
end
|
|
69
80
|
}
|
|
70
|
-
|
|
71
|
-
break
|
|
81
|
+
end
|
|
72
82
|
}
|
|
83
|
+
if !groomer_match
|
|
84
|
+
next
|
|
85
|
+
end
|
|
86
|
+
|
|
73
87
|
clouds.each { |cloud|
|
|
74
88
|
cmd = "mu-deploy #{f} --cloud #{cloud} #{$opts[:full] ? "" : "--dryrun"}"
|
|
75
89
|
commands[cmd] = {
|
|
@@ -108,8 +122,19 @@ def execCommand(cmd, results_stash)
|
|
|
108
122
|
}
|
|
109
123
|
|
|
110
124
|
ok = true
|
|
111
|
-
|
|
112
|
-
|
|
125
|
+
retries = 0
|
|
126
|
+
begin
|
|
127
|
+
output = %x{#{cmd} 2>&1}
|
|
128
|
+
if $?.exitstatus != 0
|
|
129
|
+
ok = false
|
|
130
|
+
retries += 1
|
|
131
|
+
if $opts[:verbose] and !$opts[:full] and retries <= $opts[:max_retries]
|
|
132
|
+
puts "#{cmd} RETRY #{retries.to_s}".light_red
|
|
133
|
+
end
|
|
134
|
+
else
|
|
135
|
+
ok = true
|
|
136
|
+
end
|
|
137
|
+
end while !ok and !$opts[:full] and retries <= $opts[:max_retries]
|
|
113
138
|
|
|
114
139
|
results_stash["output"] += output
|
|
115
140
|
|
data/cloud-mu.gemspec
CHANGED
|
@@ -17,8 +17,8 @@ end
|
|
|
17
17
|
|
|
18
18
|
Gem::Specification.new do |s|
|
|
19
19
|
s.name = 'cloud-mu'
|
|
20
|
-
s.version = '3.
|
|
21
|
-
s.date = '2020-
|
|
20
|
+
s.version = '3.3.2'
|
|
21
|
+
s.date = '2020-10-04'
|
|
22
22
|
s.require_paths = ['modules']
|
|
23
23
|
s.required_ruby_version = '>= 2.4'
|
|
24
24
|
s.summary = "The eGTLabs Mu toolkit for unified cloud deployments"
|
|
@@ -57,7 +57,7 @@ EOF
|
|
|
57
57
|
s.add_runtime_dependency 'rack', "~> 2.0"
|
|
58
58
|
s.add_runtime_dependency 'ruby-graphviz', "~> 1.2"
|
|
59
59
|
s.add_runtime_dependency 'rubocop', '~> 0.58'
|
|
60
|
-
s.add_runtime_dependency 'rubyzip', "~> 2.
|
|
60
|
+
s.add_runtime_dependency 'rubyzip', "~> 2.3"
|
|
61
61
|
s.add_runtime_dependency 'simple-password-gen', "~> 0.1"
|
|
62
62
|
s.add_runtime_dependency 'slack-notifier', "~> 2.3"
|
|
63
63
|
s.add_runtime_dependency 'solve', '~> 4.0'
|
|
@@ -19,7 +19,7 @@ attribute :domain_admin_password, :kind_of => String, :required => true
|
|
|
19
19
|
attribute :restore_mode_password, :kind_of => String, :required => true
|
|
20
20
|
attribute :site_name, :kind_of => String, :default => node['ad']['site_name'], :required => false
|
|
21
21
|
attribute :computer_name, :kind_of => String, :default => node['ad']['computer_name']
|
|
22
|
-
attribute :ntds_static_port, :kind_of =>
|
|
23
|
-
attribute :ntfrs_static_port, :kind_of =>
|
|
24
|
-
attribute :dfsr_static_port, :kind_of =>
|
|
25
|
-
attribute :netlogon_static_port, :kind_of =>
|
|
22
|
+
attribute :ntds_static_port, :kind_of => Integer, :default => node['ad']['ntds_static_port']
|
|
23
|
+
attribute :ntfrs_static_port, :kind_of => Integer, :default => node['ad']['ntfrs_static_port']
|
|
24
|
+
attribute :dfsr_static_port, :kind_of => Integer, :default => node['ad']['dfsr_static_port']
|
|
25
|
+
attribute :netlogon_static_port, :kind_of => Integer, :default => node['ad']['netlogon_static_port']
|
|
@@ -19,7 +19,7 @@ attribute :domain_admin_password, :kind_of => String, :required => true
|
|
|
19
19
|
attribute :restore_mode_password, :kind_of => String, :required => true
|
|
20
20
|
attribute :site_name, :kind_of => String, :default => node['ad']['site_name'], :required => false
|
|
21
21
|
attribute :computer_name, :kind_of => String, :default => node['ad']['computer_name']
|
|
22
|
-
attribute :ntds_static_port, :kind_of =>
|
|
23
|
-
attribute :ntfrs_static_port, :kind_of =>
|
|
24
|
-
attribute :dfsr_static_port, :kind_of =>
|
|
25
|
-
attribute :netlogon_static_port, :kind_of =>
|
|
22
|
+
attribute :ntds_static_port, :kind_of => Integer, :default => node['ad']['ntds_static_port']
|
|
23
|
+
attribute :ntfrs_static_port, :kind_of => Integer, :default => node['ad']['ntfrs_static_port']
|
|
24
|
+
attribute :dfsr_static_port, :kind_of => Integer, :default => node['ad']['dfsr_static_port']
|
|
25
|
+
attribute :netlogon_static_port, :kind_of => Integer, :default => node['ad']['netlogon_static_port']
|
|
@@ -252,21 +252,21 @@ if !node['application_attributes']['skip_recipes'].include?('apply_security')
|
|
|
252
252
|
# end
|
|
253
253
|
# 6.3 Configure PAM
|
|
254
254
|
# 6.3.2 Set Password Creation Requirement Parameters Using pam_cracklib
|
|
255
|
-
template "/etc/pam.d/password-auth-local" do
|
|
256
|
-
source "etc_pamd_password-auth.erb"
|
|
257
|
-
mode 0644
|
|
258
|
-
end
|
|
259
|
-
link "/etc/pam.d/password-auth" do
|
|
260
|
-
to "/etc/pam.d/password-auth-local"
|
|
261
|
-
end
|
|
255
|
+
# template "/etc/pam.d/password-auth-local" do
|
|
256
|
+
# source "etc_pamd_password-auth.erb"
|
|
257
|
+
# mode 0644
|
|
258
|
+
# end
|
|
259
|
+
# link "/etc/pam.d/password-auth" do
|
|
260
|
+
# to "/etc/pam.d/password-auth-local"
|
|
261
|
+
# end
|
|
262
262
|
#6.3.3 Set Lockout for Failed Password Attempts
|
|
263
|
-
template "/etc/pam.d/system-auth-local" do
|
|
264
|
-
source "etc_pamd_system-auth.erb"
|
|
265
|
-
mode 0644
|
|
266
|
-
end
|
|
267
|
-
link "/etc/pam.d/system-auth" do
|
|
268
|
-
to "/etc/pam.d/system-auth-local"
|
|
269
|
-
end
|
|
263
|
+
# template "/etc/pam.d/system-auth-local" do
|
|
264
|
+
# source "etc_pamd_system-auth.erb"
|
|
265
|
+
# mode 0644
|
|
266
|
+
# end
|
|
267
|
+
# link "/etc/pam.d/system-auth" do
|
|
268
|
+
# to "/etc/pam.d/system-auth-local"
|
|
269
|
+
# end
|
|
270
270
|
|
|
271
271
|
#SV-50303r1_rule/SV-50304r1_rule
|
|
272
272
|
execute "chown root:root /etc/shadow"
|
|
@@ -21,3 +21,12 @@ chef_gem "aws-sdk-core" do
|
|
|
21
21
|
version "2.11.24"
|
|
22
22
|
action :install
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
if platform_family?("rhel") or platform_family?("amazon")
|
|
26
|
+
if node['platform_version'].to_i == 6
|
|
27
|
+
package "python34-pip"
|
|
28
|
+
execute "/usr/bin/pip3 install awscli" do
|
|
29
|
+
not_if "test -x /usr/bin/aws"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -160,8 +160,8 @@ Environment='KUBELET_EXTRA_ARGS=$KUBELET_EXTRA_ARGS'
|
|
|
160
160
|
|
|
161
161
|
opento.uniq.each { |src|
|
|
162
162
|
[:tcp, :udp, :icmp].each { |proto|
|
|
163
|
-
execute "iptables -I INPUT -p #{proto} -s #{src}" do
|
|
164
|
-
not_if "iptables -L -n | tr -s ' ' | grep -- '#{proto} -- #{src.sub(/\/32$/, "")}' > /dev/null"
|
|
163
|
+
execute "iptables -w 30 -I INPUT -p #{proto} -s #{src}" do
|
|
164
|
+
not_if "iptables -w 30 -L -n | tr -s ' ' | grep -- '#{proto} -- #{src.sub(/\/32$/, "")}' > /dev/null"
|
|
165
165
|
end
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -26,20 +26,22 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
26
26
|
|
|
27
27
|
sshd_password = windows_vault[node['windows_sshd_password_field']]
|
|
28
28
|
|
|
29
|
+
admin_user = node['windows_admin_username'] || "Administrator"
|
|
30
|
+
|
|
29
31
|
windows_version = node['platform_version'].to_i
|
|
30
32
|
|
|
31
33
|
public_keys = Array.new
|
|
32
34
|
|
|
33
|
-
if windows_version
|
|
35
|
+
if windows_version >= 10
|
|
34
36
|
Chef::Log.info "version #{windows_version}, using openssh"
|
|
35
37
|
|
|
36
38
|
include_recipe 'chocolatey'
|
|
37
39
|
|
|
38
40
|
openssh_path = 'C:\Program Files\OpenSSH-Win64'
|
|
39
41
|
|
|
40
|
-
ssh_program_data = "#{ENV['ProgramData']}
|
|
42
|
+
ssh_program_data = "#{ENV['ProgramData']}\\ssh"
|
|
41
43
|
|
|
42
|
-
ssh_dir = "C:/Users
|
|
44
|
+
ssh_dir = "C:/Users/#{admin_user}/.ssh"
|
|
43
45
|
|
|
44
46
|
authorized_keys = "#{ssh_dir}/authorized_keys"
|
|
45
47
|
|
|
@@ -86,7 +88,8 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
86
88
|
path ssh_program_data
|
|
87
89
|
owner sshd_user
|
|
88
90
|
rights :full_control, sshd_user
|
|
89
|
-
rights :full_control,
|
|
91
|
+
rights :full_control, admin_user
|
|
92
|
+
notifies :run, 'ruby[find files to change ownership of]', :immediately
|
|
90
93
|
notifies :run, 'powershell_script[Generate Host Key]', :immediately
|
|
91
94
|
end
|
|
92
95
|
|
|
@@ -97,22 +100,22 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
97
100
|
notifies :create, "template[#{ssh_program_data}/sshd_config]", :immediately
|
|
98
101
|
end
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
directory "set file ownership" do
|
|
101
104
|
action :nothing
|
|
105
|
+
path ssh_program_data
|
|
102
106
|
owner sshd_user
|
|
103
|
-
source "sshd_config.erb"
|
|
104
107
|
mode '0600'
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
rights :full_control, sshd_user
|
|
109
|
+
deny_rights :full_control, admin_user
|
|
107
110
|
end
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
template "#{ssh_program_data}/sshd_config" do
|
|
110
113
|
action :nothing
|
|
111
|
-
path ssh_program_data
|
|
112
114
|
owner sshd_user
|
|
115
|
+
source "sshd_config.erb"
|
|
113
116
|
mode '0600'
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
cookbook "mu-tools"
|
|
118
|
+
notifies :run, 'ruby[find files to change ownership of]', :immediately
|
|
116
119
|
end
|
|
117
120
|
|
|
118
121
|
windows_service 'sshd' do
|
|
@@ -120,26 +123,26 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
120
123
|
end
|
|
121
124
|
|
|
122
125
|
group 'sshusers' do
|
|
123
|
-
members [sshd_user,
|
|
126
|
+
members [sshd_user, admin_user]
|
|
124
127
|
end
|
|
125
128
|
|
|
126
129
|
ruby 'find files to change ownership of' do
|
|
127
130
|
action :nothing
|
|
128
131
|
code <<-EOH
|
|
129
|
-
files = Dir.entries ssh_program_data
|
|
132
|
+
files = Dir.entries '#{ssh_program_data}'
|
|
130
133
|
puts files
|
|
131
134
|
EOH
|
|
132
135
|
end
|
|
133
136
|
|
|
134
|
-
log 'files in ssh' do
|
|
135
|
-
message files.join
|
|
136
|
-
level :info
|
|
137
|
-
end
|
|
138
|
-
|
|
137
|
+
# log 'files in ssh' do
|
|
138
|
+
# message files.join
|
|
139
|
+
# level :info
|
|
140
|
+
# end
|
|
141
|
+
#
|
|
139
142
|
files.each do |file|
|
|
140
143
|
file "#{ssh_program_data}#{file}" do
|
|
141
144
|
owner sshd_user
|
|
142
|
-
deny_rights :full_control,
|
|
145
|
+
deny_rights :full_control, admin_user
|
|
143
146
|
end
|
|
144
147
|
end
|
|
145
148
|
|
|
@@ -150,7 +153,7 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
150
153
|
end
|
|
151
154
|
|
|
152
155
|
file authorized_keys do
|
|
153
|
-
owner
|
|
156
|
+
owner admin_user
|
|
154
157
|
content public_key
|
|
155
158
|
end
|
|
156
159
|
|
|
@@ -323,7 +326,7 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
323
326
|
# sensitive true
|
|
324
327
|
# end
|
|
325
328
|
# end
|
|
326
|
-
|
|
329
|
+
|
|
327
330
|
end
|
|
328
331
|
|
|
329
332
|
else
|
data/extras/clean-stock-amis
CHANGED
|
@@ -18,37 +18,43 @@ require 'json'
|
|
|
18
18
|
require File.realpath(File.expand_path(File.dirname(__FILE__)+"/../bin/mu-load-config.rb"))
|
|
19
19
|
require 'mu'
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
$opts = Optimist::options do
|
|
22
|
+
banner <<-EOS
|
|
23
|
+
#{$0} [-c credentials] [-i imagename]
|
|
24
|
+
EOS
|
|
25
|
+
opt :credentials, "Use these AWS credentials from mu.yaml instead of the default set", :required => false, :type => :string
|
|
26
|
+
opt :image, "Purge a specific image, instead of just scrubing old ones", :required => false, :type => :string
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
filters = [
|
|
28
30
|
{
|
|
29
31
|
name: "owner-id",
|
|
30
|
-
values: [MU::Cloud::AWS.credToAcct(credentials)]
|
|
32
|
+
values: [MU::Cloud::AWS.credToAcct($opts[:credentials])]
|
|
31
33
|
}
|
|
32
34
|
]
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
MU::Cloud::AWS.listRegions.each { | r|
|
|
36
|
-
images = MU::Cloud::AWS.ec2(region: r, credentials: credentials).describe_images(
|
|
38
|
+
images = MU::Cloud::AWS.ec2(region: r, credentials: $opts[:credentials]).describe_images(
|
|
37
39
|
filters: filters + [{ "name" => "state", "values" => ["available"]}]
|
|
38
40
|
).images
|
|
39
41
|
images.each { |ami|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
if ($opts[:image] and ami.name == $opts[:image]) or
|
|
43
|
+
((DateTime.now.to_time - DateTime.parse(ami.creation_date).to_time) > 15552000 and ami.name.match(/^MU-(PROD|DEV)/))
|
|
44
|
+
snaps = []
|
|
45
|
+
ami.block_device_mappings.each { |dev|
|
|
46
|
+
if !dev.ebs.nil?
|
|
47
|
+
snaps << dev.ebs.snapshot_id
|
|
48
|
+
end
|
|
49
|
+
}
|
|
50
|
+
MU.log "Deregistering #{ami.name}, #{r} (#{ami.creation_date})", MU::WARN, details: snaps
|
|
51
|
+
begin
|
|
52
|
+
MU::Cloud::AWS.ec2(region: r, credentials: $opts[:credentials]).deregister_image(image_id: ami.image_id)
|
|
53
|
+
rescue Aws::EC2::Errors::InvalidAMIIDUnavailable
|
|
54
|
+
end
|
|
55
|
+
snaps.each { |snap_id|
|
|
56
|
+
MU::Cloud::AWS.ec2(region: r, credentials: $opts[:credentials]).delete_snapshot(snapshot_id: snap_id)
|
|
57
|
+
}
|
|
58
|
+
end
|
|
53
59
|
}
|
|
54
60
|
}
|