cloud-mu 3.1.4 → 3.3.1
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/README.md +33 -0
- data/ansible/roles/mu-windows/defaults/main.yml +2 -0
- 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/handlers/main.yml +2 -0
- data/ansible/roles/mu-windows/meta/main.yml +53 -0
- data/ansible/roles/mu-windows/tasks/main.yml +36 -0
- data/ansible/roles/mu-windows/tests/inventory +2 -0
- data/ansible/roles/mu-windows/tests/test.yml +5 -0
- data/ansible/roles/mu-windows/vars/main.yml +2 -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 +5 -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/selinux.rb +2 -1
- data/cookbooks/mu-tools/recipes/windows-client.rb +163 -164
- data/cookbooks/mu-tools/resources/windows_users.rb +44 -43
- data/extras/clean-stock-amis +25 -19
- data/extras/generate-stock-images +1 -0
- data/extras/image-generators/AWS/win2k12.yaml +18 -13
- data/extras/image-generators/AWS/win2k16.yaml +18 -13
- data/extras/image-generators/AWS/win2k19.yaml +21 -0
- data/modules/mommacat.ru +1 -1
- data/modules/mu.rb +158 -107
- data/modules/mu/adoption.rb +386 -59
- data/modules/mu/cleanup.rb +214 -303
- data/modules/mu/cloud.rb +128 -1632
- 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 +926 -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 +135 -82
- 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.yml +1 -0
- 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 +91 -68
- data/modules/mu/defaults/Azure.yaml +1 -0
- data/modules/mu/defaults/Google.yaml +1 -0
- data/modules/mu/deploy.rb +33 -19
- data/modules/mu/groomer.rb +16 -1
- data/modules/mu/groomers/ansible.rb +123 -21
- data/modules/mu/groomers/chef.rb +64 -11
- data/modules/mu/logger.rb +120 -144
- data/modules/mu/master.rb +97 -4
- data/modules/mu/master/ssl.rb +0 -1
- data/modules/mu/mommacat.rb +154 -867
- data/modules/mu/mommacat/daemon.rb +23 -14
- data/modules/mu/mommacat/naming.rb +110 -3
- data/modules/mu/mommacat/search.rb +495 -0
- data/modules/mu/mommacat/storage.rb +225 -192
- data/modules/mu/{clouds → providers}/README.md +1 -1
- data/modules/mu/{clouds → providers}/aws.rb +281 -64
- 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 +708 -749
- data/modules/mu/providers/aws/database.rb +1744 -0
- data/modules/mu/{clouds → providers}/aws/dnszone.rb +75 -57
- data/modules/mu/providers/aws/endpoint.rb +1072 -0
- data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +212 -242
- 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 +50 -41
- 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 +94 -57
- data/modules/mu/{clouds → providers}/aws/search_domain.rb +173 -42
- data/modules/mu/{clouds → providers}/aws/server.rb +782 -1107
- data/modules/mu/{clouds → providers}/aws/server_pool.rb +36 -46
- 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 +2 -1
- data/modules/mu/{clouds → providers}/aws/vpc.rb +429 -849
- data/modules/mu/providers/aws/vpc_subnet.rb +286 -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 +5 -5
- data/modules/mu/{clouds → providers}/google/container_cluster.rb +59 -37
- 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 +14 -8
- 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 +142 -55
- 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 +46 -15
- 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 +23 -0
- 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/includes-and-params.yaml +2 -1
- 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 +2 -1
- data/modules/tests/super_complex_bok.yml +2 -2
- data/modules/tests/super_simple_bok.yml +3 -5
- data/modules/tests/win2k12.yaml +25 -0
- data/modules/tests/win2k16.yaml +25 -0
- data/modules/tests/win2k19.yaml +25 -0
- data/requirements.txt +1 -0
- data/spec/mu/clouds/azure_spec.rb +2 -2
- metadata +169 -93
- data/extras/image-generators/AWS/windows.yaml +0 -18
- data/modules/mu/clouds/aws/database.rb +0 -1974
- data/modules/mu/clouds/aws/endpoint.rb +0 -596
- data/modules/tests/needwork/win2k12.yaml +0 -13
data/bin/mu-deploy
CHANGED
|
@@ -105,7 +105,7 @@ if $opts[:dryrun]
|
|
|
105
105
|
Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :never) {
|
|
106
106
|
begin
|
|
107
107
|
Thread.handle_interrupt(MU::Cloud::MuCloudResourceNotImplemented => :immediate) {
|
|
108
|
-
MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::
|
|
108
|
+
MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::NOTICE, verbosity: MU::Logger::NORMAL
|
|
109
109
|
Thread.current.exit
|
|
110
110
|
}
|
|
111
111
|
ensure
|
|
@@ -124,7 +124,7 @@ if $opts[:dryrun]
|
|
|
124
124
|
)
|
|
125
125
|
cost_dummy_deploy.run
|
|
126
126
|
rescue MU::Cloud::MuCloudResourceNotImplemented, MU::Cloud::MuCloudFlagNotImplemented
|
|
127
|
-
MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::
|
|
127
|
+
MU.log "Cost calculator not available for this stack, as it uses a resource not implemented in Mu's CloudFormation layer.", MU::NOTICE, verbosity: MU::Logger::NORMAL
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
exit
|
|
@@ -135,7 +135,7 @@ if $opts[:update]
|
|
|
135
135
|
# TODO consider whether this is useful/valid
|
|
136
136
|
# old_conf = JSON.parse(File.read(deploy.deploy_dir+"/basket_of_kittens.json"))
|
|
137
137
|
# stack_conf = old_conf.merge(stack_conf)
|
|
138
|
-
deploy.updateBasketofKittens(stack_conf)
|
|
138
|
+
deploy.updateBasketofKittens(stack_conf, skip_validation: true)
|
|
139
139
|
deployer = MU::Deploy.new(
|
|
140
140
|
deploy.environment,
|
|
141
141
|
verbosity: verbosity,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/local/ruby-current/bin/ruby
|
|
2
|
+
# Copyright:: Copyright (c) 2014 eGlobalTech, Inc., all rights reserved
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the BSD-3 license (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License in the root of the project or at
|
|
7
|
+
#
|
|
8
|
+
# http://egt-labs.com/mu/LICENSE.html
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
require 'rubygems'
|
|
17
|
+
require 'bundler/setup'
|
|
18
|
+
require 'json'
|
|
19
|
+
require 'erb'
|
|
20
|
+
require 'optimist'
|
|
21
|
+
require 'json-schema'
|
|
22
|
+
require File.realpath(File.expand_path(File.dirname(__FILE__)+"/mu-load-config.rb"))
|
|
23
|
+
require 'mu'
|
|
24
|
+
|
|
25
|
+
MU::MommaCat.findStray("AWS", "firewall_rule", region: MU.myRegion, dummy_ok: true, debug: true)
|
data/bin/mu-gen-docs
CHANGED
|
@@ -79,8 +79,7 @@ EOF
|
|
|
79
79
|
impl_counts[type] ||= 0
|
|
80
80
|
[a, b].each { |cloud|
|
|
81
81
|
begin
|
|
82
|
-
|
|
83
|
-
case myclass.quality
|
|
82
|
+
case MU::Cloud.resourceClass(cloud, type).quality
|
|
84
83
|
when MU::Cloud::RELEASE
|
|
85
84
|
cloud_is_useful[cloud] = true
|
|
86
85
|
counts[cloud] += 4
|
|
@@ -114,8 +113,7 @@ EOF
|
|
|
114
113
|
cloudlist.each { |cloud|
|
|
115
114
|
readme += "<td><center>"
|
|
116
115
|
begin
|
|
117
|
-
|
|
118
|
-
case myclass.quality
|
|
116
|
+
case MU::Cloud.resourceClass(cloud, type).quality
|
|
119
117
|
when MU::Cloud::RELEASE
|
|
120
118
|
readme += "<img src='release.png' style='#{icon_style}' title='Release Quality' alt='[Release Quality]'>"
|
|
121
119
|
when MU::Cloud::BETA
|
data/bin/mu-load-config.rb
CHANGED
|
@@ -134,7 +134,7 @@ def loadMuConfig(default_cfg_overrides = nil)
|
|
|
134
134
|
}
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
global_cfg = { "config_files" => [] }
|
|
137
|
+
global_cfg = { "config_files" => [], "overridden_keys" => [] }
|
|
138
138
|
if File.exist?(cfgPath)
|
|
139
139
|
global_cfg = YAML.load(File.read(cfgPath))
|
|
140
140
|
global_cfg["config_files"] = [cfgPath]
|
|
@@ -147,6 +147,7 @@ def loadMuConfig(default_cfg_overrides = nil)
|
|
|
147
147
|
if localfile
|
|
148
148
|
global_cfg.merge!(localfile)
|
|
149
149
|
global_cfg["config_files"] << "#{home}/.mu.yaml"
|
|
150
|
+
global_cfg["overridden_keys"] = localfile.keys
|
|
150
151
|
end
|
|
151
152
|
end
|
|
152
153
|
if !global_cfg.has_key?("installdir")
|
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.1
|
|
21
|
-
s.date = '2020-
|
|
20
|
+
s.version = '3.3.1'
|
|
21
|
+
s.date = '2020-09-29'
|
|
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"
|
|
@@ -52,14 +52,16 @@ EOF
|
|
|
52
52
|
s.add_runtime_dependency 'net-ssh-multi', '~> 1.2', '>= 1.2.1'
|
|
53
53
|
s.add_runtime_dependency 'netaddr', '~> 2.0'
|
|
54
54
|
s.add_runtime_dependency 'nokogiri', "~> 1.10"
|
|
55
|
+
s.add_runtime_dependency 'openssl-oaep', "~> 0.1"
|
|
55
56
|
s.add_runtime_dependency 'optimist', "~> 3.0"
|
|
56
57
|
s.add_runtime_dependency 'rack', "~> 2.0"
|
|
57
58
|
s.add_runtime_dependency 'ruby-graphviz', "~> 1.2"
|
|
58
59
|
s.add_runtime_dependency 'rubocop', '~> 0.58'
|
|
59
|
-
s.add_runtime_dependency 'rubyzip', "~> 2.
|
|
60
|
+
s.add_runtime_dependency 'rubyzip', "~> 2.3"
|
|
60
61
|
s.add_runtime_dependency 'simple-password-gen', "~> 0.1"
|
|
61
62
|
s.add_runtime_dependency 'slack-notifier', "~> 2.3"
|
|
62
63
|
s.add_runtime_dependency 'solve', '~> 4.0'
|
|
63
64
|
s.add_runtime_dependency 'thin', "~> 1.7"
|
|
65
|
+
s.add_runtime_dependency 'winrm', "~> 2.3", ">= 2.3.4"
|
|
64
66
|
s.add_runtime_dependency 'yard', "~> 0.9"
|
|
65
67
|
end
|
|
@@ -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
|
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Copyright:: 2019, The Authors, All Rights Reserved.
|
|
6
6
|
|
|
7
|
-
if !node['application_attributes']['skip_recipes'].include?('selinux')
|
|
7
|
+
if !node['application_attributes']['skip_recipes'].include?('selinux') and
|
|
8
|
+
(platform_family?("rhel") or platform_family?("amazon"))
|
|
8
9
|
|
|
9
10
|
selinux_state "SELinux Enforcing" do
|
|
10
11
|
action :enforcing
|
|
@@ -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
|
|
|
@@ -184,153 +187,149 @@ if !node['application_attributes']['skip_recipes'].include?('windows-client')
|
|
|
184
187
|
# end
|
|
185
188
|
# }
|
|
186
189
|
|
|
187
|
-
reboot "Cygwin LSA" do
|
|
188
|
-
action :nothing
|
|
189
|
-
reason "Enabling Cygwin LSA support"
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
powershell_script "Configuring Cygwin LSA support" do
|
|
193
|
-
code <<-EOH
|
|
194
|
-
Invoke-Expression '& #{cygwindir}/bin/bash.exe --login -c "echo yes | /bin/cyglsa-config"'
|
|
195
|
-
EOH
|
|
196
|
-
not_if {
|
|
197
|
-
lsa_found = false
|
|
198
|
-
if registry_key_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa")
|
|
199
|
-
registry_get_values("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa").each { |val|
|
|
200
|
-
if val[:name] == "Authentication Packages"
|
|
201
|
-
lsa_found = true if val[:data].grep(/cyglsa64\.dll/)
|
|
202
|
-
break
|
|
203
|
-
end
|
|
204
|
-
}
|
|
205
|
-
end
|
|
206
|
-
lsa_found
|
|
207
|
-
}
|
|
208
|
-
notifies :reboot_now, "reboot[Cygwin LSA]", :immediately
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
powershell_script "enable Cygwin sshd" do
|
|
212
|
-
code <<-EOH
|
|
213
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "ssh-host-config -y -c ntsec -w ''#{sshd_password}'' -u #{sshd_user}"'
|
|
214
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "sed -i.bak ''s/#.*StrictModes.*yes/StrictModes no/'' /etc/sshd_config"'
|
|
215
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "sed -i.bak ''s/#.*PasswordAuthentication.*yes/PasswordAuthentication no/'' /etc/sshd_config"'
|
|
216
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "chown #{sshd_user} /var/empty /var/log/sshd.log /etc/ssh*; chmod 755 /var/empty"'
|
|
217
|
-
EOH
|
|
218
|
-
sensitive true
|
|
219
|
-
not_if %Q{Get-Service "sshd"}
|
|
220
|
-
end
|
|
221
|
-
powershell_script "set unix-style Cygwin sshd permissions" do
|
|
222
|
-
code <<-EOH
|
|
223
|
-
if((Get-WmiObject win32_computersystem).partofdomain){
|
|
224
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkpasswd -d > /etc/passwd"'
|
|
225
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkgroup -l -d > /etc/group"'
|
|
226
|
-
} else {
|
|
227
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkpasswd -l > /etc/passwd"'
|
|
228
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkgroup -l > /etc/group"'
|
|
229
|
-
}
|
|
230
|
-
Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "chown #{sshd_user} /var/empty /var/log/sshd.log /etc/ssh*; chmod 755 /var/empty"'
|
|
231
|
-
EOH
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
include_recipe 'mu-activedirectory'
|
|
235
|
-
|
|
236
|
-
::Chef::Recipe.send(:include, Chef::Mixin::PowershellOut)
|
|
237
|
-
|
|
238
|
-
template "c:/bin/cygwin/etc/sshd_config" do
|
|
239
|
-
source "sshd_config.erb"
|
|
240
|
-
mode 0644
|
|
241
|
-
cookbook "mu-tools"
|
|
242
|
-
ignore_failure true
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
ec2config_user= windows_vault[node['windows_ec2config_username_field']]
|
|
246
|
-
ec2config_password = windows_vault[node['windows_ec2config_password_field']]
|
|
247
|
-
login_dom = "."
|
|
248
|
-
|
|
249
|
-
if in_domain?
|
|
250
|
-
|
|
251
|
-
ad_vault = chef_vault_item(node['ad']['domain_admin_vault'], node['ad']['domain_admin_item'])
|
|
252
|
-
login_dom = node['ad']['netbios_name']
|
|
253
|
-
|
|
254
|
-
windows_users node['ad']['computer_name'] do
|
|
255
|
-
username ad_vault[node['ad']['domain_admin_username_field']]
|
|
256
|
-
password ad_vault[node['ad']['domain_admin_password_field']]
|
|
257
|
-
domain_name node['ad']['domain_name']
|
|
258
|
-
netbios_name node['ad']['netbios_name']
|
|
259
|
-
dc_ips node['ad']['dc_ips']
|
|
260
|
-
ssh_user sshd_user
|
|
261
|
-
ssh_password sshd_password
|
|
262
|
-
ec2config_user ec2config_user
|
|
263
|
-
ec2config_password ec2config_password
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
aws_windows "ec2" do
|
|
267
|
-
username ec2config_user
|
|
268
|
-
service_username "#{node['ad']['netbios_name']}\\#{ec2config_user}"
|
|
269
|
-
password ec2config_password
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
scheduled_tasks "tasks" do
|
|
273
|
-
username ad_vault[node['ad']['domain_admin_username_field']]
|
|
274
|
-
password ad_vault[node['ad']['domain_admin_password_field']]
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
sshd_service "sshd" do
|
|
278
|
-
service_username "#{node['ad']['netbios_name']}\\#{sshd_user}"
|
|
279
|
-
username sshd_user
|
|
280
|
-
password sshd_password
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
begin
|
|
284
|
-
resources('service[sshd]')
|
|
285
|
-
escue Chef::Exceptions::ResourceNotFound
|
|
286
|
-
service "sshd" do
|
|
287
|
-
action [:enable, :start]
|
|
288
|
-
sensitive true
|
|
289
|
-
end
|
|
290
|
-
end
|
|
291
|
-
else
|
|
292
|
-
windows_users node['hostname'] do
|
|
293
|
-
username node['windows_admin_username']
|
|
294
|
-
password windows_vault[node['windows_auth_password_field']]
|
|
295
|
-
ssh_user sshd_user
|
|
296
|
-
ssh_password sshd_password
|
|
297
|
-
ec2config_user ec2config_user
|
|
298
|
-
ec2config_password ec2config_password
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
aws_windows "ec2" do
|
|
302
|
-
username ec2config_user
|
|
303
|
-
service_username ".\\#{ec2config_user}"
|
|
304
|
-
password ec2config_password
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
scheduled_tasks "tasks" do
|
|
308
|
-
username node['windows_admin_username']
|
|
309
|
-
password windows_vault[node['windows_auth_password_field']]
|
|
310
|
-
end
|
|
190
|
+
# reboot "Cygwin LSA" do
|
|
191
|
+
# action :nothing
|
|
192
|
+
# reason "Enabling Cygwin LSA support"
|
|
193
|
+
# end
|
|
194
|
+
#
|
|
195
|
+
# powershell_script "Configuring Cygwin LSA support" do
|
|
196
|
+
# code <<-EOH
|
|
197
|
+
# Invoke-Expression '& #{cygwindir}/bin/bash.exe --login -c "echo yes | /bin/cyglsa-config"'
|
|
198
|
+
# EOH
|
|
199
|
+
# not_if {
|
|
200
|
+
# lsa_found = false
|
|
201
|
+
# if registry_key_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa")
|
|
202
|
+
# registry_get_values("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Lsa").each { |val|
|
|
203
|
+
# if val[:name] == "Authentication Packages"
|
|
204
|
+
# lsa_found = true if val[:data].grep(/cyglsa64\.dll/)
|
|
205
|
+
# break
|
|
206
|
+
# end
|
|
207
|
+
# }
|
|
208
|
+
# end
|
|
209
|
+
# lsa_found
|
|
210
|
+
# }
|
|
211
|
+
# notifies :reboot_now, "reboot[Cygwin LSA]", :immediately
|
|
212
|
+
# end
|
|
213
|
+
#
|
|
214
|
+
# powershell_script "enable Cygwin sshd" do
|
|
215
|
+
# code <<-EOH
|
|
216
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "ssh-host-config -y -c ntsec -w ''#{sshd_password}'' -u #{sshd_user}"'
|
|
217
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "sed -i.bak ''s/#.*StrictModes.*yes/StrictModes no/'' /etc/sshd_config"'
|
|
218
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash.exe --login -c "sed -i.bak ''s/#.*PasswordAuthentication.*yes/PasswordAuthentication no/'' /etc/sshd_config"'
|
|
219
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "chown #{sshd_user} /var/empty /var/log/sshd.log /etc/ssh*; chmod 755 /var/empty"'
|
|
220
|
+
# EOH
|
|
221
|
+
# sensitive true
|
|
222
|
+
# not_if %Q{Get-Service "sshd"}
|
|
223
|
+
# end
|
|
224
|
+
# powershell_script "set unix-style Cygwin sshd permissions" do
|
|
225
|
+
# code <<-EOH
|
|
226
|
+
# if((Get-WmiObject win32_computersystem).partofdomain){
|
|
227
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkpasswd -d > /etc/passwd"'
|
|
228
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkgroup -l -d > /etc/group"'
|
|
229
|
+
# } else {
|
|
230
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkpasswd -l > /etc/passwd"'
|
|
231
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "mkgroup -l > /etc/group"'
|
|
232
|
+
# }
|
|
233
|
+
# Invoke-Expression -Debug '& #{cygwindir}/bin/bash --login -c "chown #{sshd_user} /var/empty /var/log/sshd.log /etc/ssh*; chmod 755 /var/empty"'
|
|
234
|
+
# EOH
|
|
235
|
+
# end
|
|
236
|
+
#
|
|
237
|
+
# include_recipe 'mu-activedirectory'
|
|
238
|
+
#
|
|
239
|
+
# ::Chef::Recipe.send(:include, Chef::Mixin::PowershellOut)
|
|
240
|
+
#
|
|
241
|
+
# template "c:/bin/cygwin/etc/sshd_config" do
|
|
242
|
+
# source "sshd_config.erb"
|
|
243
|
+
# mode 0644
|
|
244
|
+
# cookbook "mu-tools"
|
|
245
|
+
# ignore_failure true
|
|
246
|
+
# end
|
|
247
|
+
#
|
|
248
|
+
# ec2config_user= windows_vault[node['windows_ec2config_username_field']]
|
|
249
|
+
# ec2config_password = windows_vault[node['windows_ec2config_password_field']]
|
|
250
|
+
# login_dom = "."
|
|
251
|
+
#
|
|
252
|
+
# if in_domain?
|
|
253
|
+
#
|
|
254
|
+
# ad_vault = chef_vault_item(node['ad']['domain_admin_vault'], node['ad']['domain_admin_item'])
|
|
255
|
+
# login_dom = node['ad']['netbios_name']
|
|
256
|
+
#
|
|
257
|
+
# windows_users node['ad']['computer_name'] do
|
|
258
|
+
# username ad_vault[node['ad']['domain_admin_username_field']]
|
|
259
|
+
# password ad_vault[node['ad']['domain_admin_password_field']]
|
|
260
|
+
# domain_name node['ad']['domain_name']
|
|
261
|
+
# netbios_name node['ad']['netbios_name']
|
|
262
|
+
# dc_ips node['ad']['dc_ips']
|
|
263
|
+
# ssh_user sshd_user
|
|
264
|
+
# ssh_password sshd_password
|
|
265
|
+
# ec2config_user ec2config_user
|
|
266
|
+
# ec2config_password ec2config_password
|
|
267
|
+
# end
|
|
268
|
+
#
|
|
269
|
+
# aws_windows "ec2" do
|
|
270
|
+
# username ec2config_user
|
|
271
|
+
# service_username "#{node['ad']['netbios_name']}\\#{ec2config_user}"
|
|
272
|
+
# password ec2config_password
|
|
273
|
+
# end
|
|
274
|
+
#
|
|
275
|
+
# scheduled_tasks "tasks" do
|
|
276
|
+
# username ad_vault[node['ad']['domain_admin_username_field']]
|
|
277
|
+
# password ad_vault[node['ad']['domain_admin_password_field']]
|
|
278
|
+
# end
|
|
279
|
+
#
|
|
280
|
+
# sshd_service "sshd" do
|
|
281
|
+
# service_username "#{node['ad']['netbios_name']}\\#{sshd_user}"
|
|
282
|
+
# username sshd_user
|
|
283
|
+
# password sshd_password
|
|
284
|
+
# end
|
|
285
|
+
#
|
|
286
|
+
# begin
|
|
287
|
+
# resources('service[sshd]')
|
|
288
|
+
# escue Chef::Exceptions::ResourceNotFound
|
|
289
|
+
# service "sshd" do
|
|
290
|
+
# action [:enable, :start]
|
|
291
|
+
# sensitive true
|
|
292
|
+
# end
|
|
293
|
+
# end
|
|
294
|
+
# else
|
|
295
|
+
# windows_users node['hostname'] do
|
|
296
|
+
# username node['windows_admin_username']
|
|
297
|
+
# password windows_vault[node['windows_auth_password_field']]
|
|
298
|
+
# ssh_user sshd_user
|
|
299
|
+
# ssh_password sshd_password
|
|
300
|
+
# ec2config_user ec2config_user
|
|
301
|
+
# ec2config_password ec2config_password
|
|
302
|
+
# end
|
|
303
|
+
#
|
|
304
|
+
# aws_windows "ec2" do
|
|
305
|
+
# username ec2config_user
|
|
306
|
+
# service_username ".\\#{ec2config_user}"
|
|
307
|
+
# password ec2config_password
|
|
308
|
+
# end
|
|
309
|
+
#
|
|
310
|
+
# scheduled_tasks "tasks" do
|
|
311
|
+
# username node['windows_admin_username']
|
|
312
|
+
# password windows_vault[node['windows_auth_password_field']]
|
|
313
|
+
# end
|
|
314
|
+
#
|
|
315
|
+
# sshd_service "sshd" do
|
|
316
|
+
# username sshd_user
|
|
317
|
+
# service_username ".\\#{sshd_user}"
|
|
318
|
+
# password sshd_password
|
|
319
|
+
# end
|
|
320
|
+
# begin
|
|
321
|
+
# resources('service[sshd]')
|
|
322
|
+
# rescue Chef::Exceptions::ResourceNotFound
|
|
323
|
+
# service "Cygwin sshd as '#{sshd_user}'" do
|
|
324
|
+
# service_name "sshd"
|
|
325
|
+
# action [:enable, :start]
|
|
326
|
+
# sensitive true
|
|
327
|
+
# end
|
|
328
|
+
# end
|
|
311
329
|
|
|
312
|
-
sshd_service "sshd" do
|
|
313
|
-
username sshd_user
|
|
314
|
-
service_username ".\\#{sshd_user}"
|
|
315
|
-
password sshd_password
|
|
316
|
-
end
|
|
317
|
-
begin
|
|
318
|
-
resources('service[sshd]')
|
|
319
|
-
rescue Chef::Exceptions::ResourceNotFound
|
|
320
|
-
service "Cygwin sshd as '#{sshd_user}'" do
|
|
321
|
-
service_name "sshd"
|
|
322
|
-
action [:enable, :start]
|
|
323
|
-
sensitive true
|
|
324
|
-
end
|
|
325
|
-
end
|
|
326
|
-
end
|
|
327
330
|
end
|
|
328
331
|
|
|
329
332
|
else
|
|
330
333
|
Chef::Log.info("mu-tools::windows-client: Unsupported platform #{node['platform']}")
|
|
331
334
|
end
|
|
332
335
|
end
|
|
333
|
-
# Copyright:: Copyright (c) 2014 eGlobalTech, Inc., all rights reserved
|
|
334
|
-
#
|
|
335
|
-
# Cookbook Name:: mu-tools
|
|
336
|
-
# Recipe:: windows-client
|