cloud-mu 3.5.0 → 3.6.3

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.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +5 -2
  3. data/Berksfile.lock +135 -0
  4. data/ansible/roles/mu-base/README.md +33 -0
  5. data/ansible/roles/mu-base/defaults/main.yml +2 -0
  6. data/ansible/roles/mu-base/files/check_apm.cfg +1 -0
  7. data/ansible/roles/mu-base/files/check_apm.sh +18 -0
  8. data/ansible/roles/mu-base/files/check_disk.cfg +1 -0
  9. data/ansible/roles/mu-base/files/check_elastic_shards.cfg +1 -0
  10. data/ansible/roles/mu-base/files/check_elastic_shards.sh +12 -0
  11. data/ansible/roles/mu-base/files/check_logstash.cfg +1 -0
  12. data/ansible/roles/mu-base/files/check_logstash.sh +14 -0
  13. data/ansible/roles/mu-base/files/check_mem.cfg +1 -0
  14. data/ansible/roles/mu-base/files/check_updates.cfg +1 -0
  15. data/ansible/roles/mu-base/files/logrotate.conf +35 -0
  16. data/ansible/roles/mu-base/files/nrpe-apm-sudo +1 -0
  17. data/ansible/roles/mu-base/files/nrpe-elasticshards-sudo +2 -0
  18. data/ansible/roles/mu-base/handlers/main.yml +5 -0
  19. data/ansible/roles/mu-base/meta/main.yml +53 -0
  20. data/ansible/roles/mu-base/tasks/main.yml +113 -0
  21. data/ansible/roles/mu-base/templates/nrpe.cfg.j2 +231 -0
  22. data/ansible/roles/mu-base/tests/inventory +2 -0
  23. data/ansible/roles/mu-base/tests/test.yml +5 -0
  24. data/ansible/roles/mu-base/vars/main.yml +1 -0
  25. data/ansible/roles/mu-compliance/README.md +33 -0
  26. data/ansible/roles/mu-compliance/defaults/main.yml +2 -0
  27. data/ansible/roles/mu-compliance/files/U_MS_Windows_Server_2016_V2R1_STIG_SCAP_1-2_Benchmark.xml +15674 -0
  28. data/ansible/roles/mu-compliance/files/U_MS_Windows_Server_2019_V2R1_STIG_SCAP_1-2_Benchmark.xml +17553 -0
  29. data/ansible/roles/mu-compliance/handlers/main.yml +2 -0
  30. data/ansible/roles/mu-compliance/meta/main.yml +53 -0
  31. data/ansible/roles/mu-compliance/tasks/main.yml +45 -0
  32. data/ansible/roles/mu-compliance/tests/inventory +2 -0
  33. data/ansible/roles/mu-compliance/tests/test.yml +5 -0
  34. data/ansible/roles/mu-compliance/vars/main.yml +4 -0
  35. data/ansible/roles/mu-elastic/README.md +51 -0
  36. data/ansible/roles/mu-elastic/defaults/main.yml +2 -0
  37. data/ansible/roles/mu-elastic/files/jvm.options +93 -0
  38. data/ansible/roles/mu-elastic/handlers/main.yml +10 -0
  39. data/ansible/roles/mu-elastic/meta/main.yml +52 -0
  40. data/ansible/roles/mu-elastic/tasks/main.yml +186 -0
  41. data/ansible/roles/mu-elastic/templates/elasticsearch.yml.j2 +110 -0
  42. data/ansible/roles/mu-elastic/templates/kibana.yml.j2 +131 -0
  43. data/ansible/roles/mu-elastic/templates/password_set.expect.j2 +19 -0
  44. data/ansible/roles/mu-elastic/tests/inventory +2 -0
  45. data/ansible/roles/mu-elastic/tests/test.yml +5 -0
  46. data/ansible/roles/mu-elastic/vars/main.yml +2 -0
  47. data/ansible/roles/mu-logstash/README.md +51 -0
  48. data/ansible/roles/mu-logstash/defaults/main.yml +2 -0
  49. data/ansible/roles/mu-logstash/files/02-beats-input.conf +5 -0
  50. data/ansible/roles/mu-logstash/files/10-rails-filter.conf +16 -0
  51. data/ansible/roles/mu-logstash/files/jvm.options +84 -0
  52. data/ansible/roles/mu-logstash/files/logstash.yml +304 -0
  53. data/ansible/roles/mu-logstash/handlers/main.yml +20 -0
  54. data/ansible/roles/mu-logstash/meta/main.yml +52 -0
  55. data/ansible/roles/mu-logstash/tasks/main.yml +254 -0
  56. data/ansible/roles/mu-logstash/templates/20-cloudtrail.conf.j2 +28 -0
  57. data/ansible/roles/mu-logstash/templates/30-elasticsearch-output.conf.j2 +19 -0
  58. data/ansible/roles/mu-logstash/templates/apm-server.yml.j2 +33 -0
  59. data/ansible/roles/mu-logstash/templates/heartbeat.yml.j2 +29 -0
  60. data/ansible/roles/mu-logstash/templates/nginx/apm.conf.j2 +25 -0
  61. data/ansible/roles/mu-logstash/templates/nginx/default.conf.j2 +56 -0
  62. data/ansible/roles/mu-logstash/templates/nginx/elastic.conf.j2 +27 -0
  63. data/ansible/roles/mu-logstash/tests/inventory +2 -0
  64. data/ansible/roles/mu-logstash/tests/test.yml +5 -0
  65. data/ansible/roles/mu-logstash/vars/main.yml +2 -0
  66. data/ansible/roles/mu-rdp/README.md +33 -0
  67. data/ansible/roles/mu-rdp/meta/main.yml +53 -0
  68. data/ansible/roles/mu-rdp/tasks/main.yml +9 -0
  69. data/ansible/roles/mu-rdp/tests/inventory +2 -0
  70. data/ansible/roles/mu-rdp/tests/test.yml +5 -0
  71. data/ansible/roles/mu-windows/tasks/main.yml +3 -0
  72. data/bin/mu-ansible-secret +1 -1
  73. data/bin/mu-aws-setup +4 -3
  74. data/bin/mu-azure-setup +5 -5
  75. data/bin/mu-configure +25 -17
  76. data/bin/mu-firewall-allow-clients +1 -0
  77. data/bin/mu-gcp-setup +3 -3
  78. data/bin/mu-load-config.rb +1 -0
  79. data/bin/mu-node-manage +66 -33
  80. data/bin/mu-self-update +2 -2
  81. data/bin/mu-upload-chef-artifacts +6 -1
  82. data/bin/mu-user-manage +1 -1
  83. data/cloud-mu.gemspec +25 -23
  84. data/cookbooks/firewall/CHANGELOG.md +417 -224
  85. data/cookbooks/firewall/LICENSE +202 -0
  86. data/cookbooks/firewall/README.md +153 -126
  87. data/cookbooks/firewall/TODO.md +6 -0
  88. data/cookbooks/firewall/attributes/firewalld.rb +7 -0
  89. data/cookbooks/firewall/attributes/iptables.rb +3 -3
  90. data/cookbooks/firewall/chefignore +115 -0
  91. data/cookbooks/firewall/libraries/helpers.rb +5 -0
  92. data/cookbooks/firewall/libraries/helpers_firewalld.rb +1 -1
  93. data/cookbooks/firewall/libraries/helpers_firewalld_dbus.rb +72 -0
  94. data/cookbooks/firewall/libraries/helpers_iptables.rb +3 -3
  95. data/cookbooks/firewall/libraries/helpers_nftables.rb +170 -0
  96. data/cookbooks/firewall/libraries/helpers_ufw.rb +7 -0
  97. data/cookbooks/firewall/libraries/helpers_windows.rb +8 -9
  98. data/cookbooks/firewall/libraries/provider_firewall_firewalld.rb +9 -9
  99. data/cookbooks/firewall/libraries/provider_firewall_iptables.rb +7 -7
  100. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu.rb +12 -8
  101. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu1404.rb +13 -9
  102. data/cookbooks/firewall/libraries/provider_firewall_rule.rb +1 -1
  103. data/cookbooks/firewall/libraries/provider_firewall_ufw.rb +5 -5
  104. data/cookbooks/firewall/libraries/provider_firewall_windows.rb +4 -4
  105. data/cookbooks/firewall/libraries/resource_firewall_rule.rb +3 -3
  106. data/cookbooks/firewall/metadata.json +40 -1
  107. data/cookbooks/firewall/metadata.rb +15 -0
  108. data/cookbooks/firewall/recipes/default.rb +7 -7
  109. data/cookbooks/firewall/recipes/disable_firewall.rb +1 -1
  110. data/cookbooks/firewall/recipes/firewalld.rb +87 -0
  111. data/cookbooks/firewall/renovate.json +18 -0
  112. data/cookbooks/firewall/resources/firewalld.rb +28 -0
  113. data/cookbooks/firewall/resources/firewalld_config.rb +39 -0
  114. data/cookbooks/firewall/resources/firewalld_helpers.rb +106 -0
  115. data/cookbooks/firewall/resources/firewalld_icmptype.rb +88 -0
  116. data/cookbooks/firewall/resources/firewalld_ipset.rb +104 -0
  117. data/cookbooks/firewall/resources/firewalld_policy.rb +115 -0
  118. data/cookbooks/firewall/resources/firewalld_service.rb +98 -0
  119. data/cookbooks/firewall/resources/firewalld_zone.rb +118 -0
  120. data/cookbooks/firewall/resources/nftables.rb +71 -0
  121. data/cookbooks/firewall/resources/nftables_rule.rb +113 -0
  122. data/cookbooks/mu-activedirectory/Berksfile +1 -1
  123. data/cookbooks/mu-activedirectory/metadata.rb +1 -1
  124. data/cookbooks/mu-firewall/metadata.rb +2 -2
  125. data/cookbooks/mu-master/Berksfile +4 -3
  126. data/cookbooks/mu-master/attributes/default.rb +5 -2
  127. data/cookbooks/mu-master/files/default/check_elastic.sh +761 -0
  128. data/cookbooks/mu-master/files/default/check_kibana.rb +45 -0
  129. data/cookbooks/mu-master/libraries/mu.rb +24 -0
  130. data/cookbooks/mu-master/metadata.rb +5 -5
  131. data/cookbooks/mu-master/recipes/default.rb +31 -20
  132. data/cookbooks/mu-master/recipes/firewall-holes.rb +5 -0
  133. data/cookbooks/mu-master/recipes/init.rb +58 -19
  134. data/cookbooks/mu-master/recipes/update_nagios_only.rb +251 -178
  135. data/cookbooks/mu-master/templates/default/nagios.conf.erb +5 -11
  136. data/cookbooks/mu-master/templates/default/web_app.conf.erb +3 -0
  137. data/cookbooks/mu-php54/Berksfile +1 -1
  138. data/cookbooks/mu-php54/metadata.rb +2 -2
  139. data/cookbooks/mu-tools/Berksfile +2 -3
  140. data/cookbooks/mu-tools/attributes/default.rb +3 -4
  141. data/cookbooks/mu-tools/files/amazon/etc/bashrc +90 -0
  142. data/cookbooks/mu-tools/files/amazon/etc/login.defs +292 -0
  143. data/cookbooks/mu-tools/files/amazon/etc/profile +77 -0
  144. data/cookbooks/mu-tools/files/amazon/etc/security/limits.conf +63 -0
  145. data/cookbooks/mu-tools/files/amazon/etc/sysconfig/init +19 -0
  146. data/cookbooks/mu-tools/files/amazon/etc/sysctl.conf +82 -0
  147. data/cookbooks/mu-tools/files/amazon-2023/etc/login.defs +294 -0
  148. data/cookbooks/mu-tools/files/default/logrotate.conf +35 -0
  149. data/cookbooks/mu-tools/files/default/nrpe_conf_d.pp +0 -0
  150. data/cookbooks/mu-tools/libraries/helper.rb +21 -9
  151. data/cookbooks/mu-tools/metadata.rb +4 -4
  152. data/cookbooks/mu-tools/recipes/apply_security.rb +3 -2
  153. data/cookbooks/mu-tools/recipes/aws_api.rb +23 -5
  154. data/cookbooks/mu-tools/recipes/base_repositories.rb +4 -1
  155. data/cookbooks/mu-tools/recipes/gcloud.rb +56 -56
  156. data/cookbooks/mu-tools/recipes/nagios.rb +1 -1
  157. data/cookbooks/mu-tools/recipes/nrpe.rb +20 -2
  158. data/cookbooks/mu-tools/recipes/rsyslog.rb +12 -1
  159. data/cookbooks/mu-tools/recipes/set_local_fw.rb +1 -1
  160. data/data_bags/nagios_services/apm_backend_connect.json +5 -0
  161. data/data_bags/nagios_services/apm_listen.json +5 -0
  162. data/data_bags/nagios_services/elastic_shards.json +5 -0
  163. data/data_bags/nagios_services/logstash.json +5 -0
  164. data/data_bags/nagios_services/rhel7_updates.json +8 -0
  165. data/extras/image-generators/AWS/centos7.yaml +1 -0
  166. data/extras/image-generators/AWS/rhel7.yaml +21 -0
  167. data/extras/image-generators/AWS/win2k12r2.yaml +1 -0
  168. data/extras/image-generators/AWS/win2k16.yaml +1 -0
  169. data/extras/image-generators/AWS/win2k19.yaml +1 -0
  170. data/extras/list-stock-amis +0 -0
  171. data/extras/ruby_rpm/muby.spec +8 -5
  172. data/extras/vault_tools/export_vaults.sh +1 -1
  173. data/extras/vault_tools/recreate_vaults.sh +0 -0
  174. data/extras/vault_tools/test_vaults.sh +0 -0
  175. data/install/deprecated-bash-library.sh +1 -1
  176. data/install/installer +4 -2
  177. data/modules/mommacat.ru +3 -1
  178. data/modules/mu/adoption.rb +1 -1
  179. data/modules/mu/cloud/dnszone.rb +2 -2
  180. data/modules/mu/cloud/machine_images.rb +26 -25
  181. data/modules/mu/cloud/resource_base.rb +213 -182
  182. data/modules/mu/cloud/server_pool.rb +1 -1
  183. data/modules/mu/cloud/ssh_sessions.rb +7 -5
  184. data/modules/mu/cloud/wrappers.rb +2 -2
  185. data/modules/mu/cloud.rb +1 -1
  186. data/modules/mu/config/bucket.rb +1 -1
  187. data/modules/mu/config/function.rb +6 -1
  188. data/modules/mu/config/loadbalancer.rb +24 -2
  189. data/modules/mu/config/ref.rb +12 -0
  190. data/modules/mu/config/role.rb +1 -1
  191. data/modules/mu/config/schema_helpers.rb +42 -9
  192. data/modules/mu/config/server.rb +43 -27
  193. data/modules/mu/config/tail.rb +19 -10
  194. data/modules/mu/config.rb +6 -5
  195. data/modules/mu/defaults/AWS.yaml +78 -114
  196. data/modules/mu/deploy.rb +9 -2
  197. data/modules/mu/groomer.rb +12 -4
  198. data/modules/mu/groomers/ansible.rb +104 -20
  199. data/modules/mu/groomers/chef.rb +15 -6
  200. data/modules/mu/master.rb +9 -4
  201. data/modules/mu/mommacat/daemon.rb +4 -2
  202. data/modules/mu/mommacat/naming.rb +1 -2
  203. data/modules/mu/mommacat/storage.rb +7 -2
  204. data/modules/mu/mommacat.rb +33 -6
  205. data/modules/mu/providers/aws/database.rb +161 -8
  206. data/modules/mu/providers/aws/dnszone.rb +11 -6
  207. data/modules/mu/providers/aws/endpoint.rb +81 -6
  208. data/modules/mu/providers/aws/firewall_rule.rb +254 -172
  209. data/modules/mu/providers/aws/function.rb +65 -3
  210. data/modules/mu/providers/aws/loadbalancer.rb +39 -28
  211. data/modules/mu/providers/aws/log.rb +2 -1
  212. data/modules/mu/providers/aws/role.rb +25 -7
  213. data/modules/mu/providers/aws/server.rb +36 -12
  214. data/modules/mu/providers/aws/server_pool.rb +237 -127
  215. data/modules/mu/providers/aws/storage_pool.rb +7 -1
  216. data/modules/mu/providers/aws/user.rb +1 -1
  217. data/modules/mu/providers/aws/userdata/linux.erb +6 -2
  218. data/modules/mu/providers/aws/userdata/windows.erb +7 -5
  219. data/modules/mu/providers/aws/vpc.rb +49 -25
  220. data/modules/mu/providers/aws.rb +13 -8
  221. data/modules/mu/providers/azure/container_cluster.rb +1 -1
  222. data/modules/mu/providers/azure/loadbalancer.rb +2 -2
  223. data/modules/mu/providers/azure/server.rb +5 -2
  224. data/modules/mu/providers/azure/userdata/linux.erb +1 -1
  225. data/modules/mu/providers/azure.rb +11 -8
  226. data/modules/mu/providers/cloudformation/dnszone.rb +1 -1
  227. data/modules/mu/providers/google/container_cluster.rb +15 -2
  228. data/modules/mu/providers/google/folder.rb +2 -1
  229. data/modules/mu/providers/google/function.rb +130 -4
  230. data/modules/mu/providers/google/habitat.rb +2 -1
  231. data/modules/mu/providers/google/loadbalancer.rb +407 -160
  232. data/modules/mu/providers/google/role.rb +16 -3
  233. data/modules/mu/providers/google/server.rb +5 -1
  234. data/modules/mu/providers/google/user.rb +25 -18
  235. data/modules/mu/providers/google/userdata/linux.erb +1 -1
  236. data/modules/mu/providers/google/vpc.rb +53 -7
  237. data/modules/mu/providers/google.rb +39 -39
  238. data/modules/mu.rb +8 -8
  239. data/modules/tests/elk.yaml +46 -0
  240. data/test/mu-master-test/controls/all_in_one.rb +1 -1
  241. metadata +207 -112
  242. data/cookbooks/firewall/CONTRIBUTING.md +0 -2
  243. data/cookbooks/firewall/MAINTAINERS.md +0 -19
  244. data/cookbooks/firewall/libraries/matchers.rb +0 -30
  245. data/extras/image-generators/AWS/rhel71.yaml +0 -17
@@ -0,0 +1,2 @@
1
+ ---
2
+ # handlers file for mu-windows
@@ -0,0 +1,53 @@
1
+ galaxy_info:
2
+ author: your name
3
+ description: your description
4
+ company: your company (optional)
5
+
6
+ # If the issue tracker for your role is not on github, uncomment the
7
+ # next line and provide a value
8
+ # issue_tracker_url: http://example.com/issue/tracker
9
+
10
+ # Choose a valid license ID from https://spdx.org - some suggested licenses:
11
+ # - BSD-3-Clause (default)
12
+ # - MIT
13
+ # - GPL-2.0-or-later
14
+ # - GPL-3.0-only
15
+ # - Apache-2.0
16
+ # - CC-BY-4.0
17
+ license: license (GPL-2.0-or-later, MIT, etc)
18
+
19
+ min_ansible_version: 2.4
20
+
21
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
22
+ # min_ansible_container_version:
23
+
24
+ #
25
+ # Provide a list of supported platforms, and for each platform a list of versions.
26
+ # If you don't wish to enumerate all versions for a particular platform, use 'all'.
27
+ # To view available platforms and versions (or releases), visit:
28
+ # https://galaxy.ansible.com/api/v1/platforms/
29
+ #
30
+ # platforms:
31
+ # - name: Fedora
32
+ # versions:
33
+ # - all
34
+ # - 25
35
+ # - name: SomePlatform
36
+ # versions:
37
+ # - all
38
+ # - 1.0
39
+ # - 7
40
+ # - 99.99
41
+
42
+ galaxy_tags: []
43
+ # List tags for your role here, one per line. A tag is a keyword that describes
44
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
45
+ # remove the '[]' above, if you add tags to this list.
46
+ #
47
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
48
+ # Maximum 20 tags per role.
49
+
50
+ dependencies: []
51
+ # List your role dependencies here, one per line. Be sure to remove the '[]' above,
52
+ # if you add dependencies to this list.
53
+
@@ -0,0 +1,45 @@
1
+ ---
2
+ - name: Ensure existence of c:/temp
3
+ win_file:
4
+ path: c:/temp
5
+ state: directory
6
+
7
+ - name: Check for existence of OpenSCAP
8
+ win_shell: Get-ChildItem -Name "c:/Program Files (x86)/OpenSCAP {{ OSCAP_VERSION }}/"
9
+ ignore_errors: true
10
+ no_log: true
11
+ register: openscap_exists
12
+
13
+ - name: Install vcredist
14
+ win_package:
15
+ path: https://aka.ms/vs/16/release/vc_redist.x86.exe
16
+ arguments:
17
+ - /install
18
+ - /passive
19
+ - /norestart
20
+
21
+ - name: Download OpenSCAP installer
22
+ when: openscap_exists is failed
23
+ win_get_url:
24
+ url: "{{ OSCAP_URL }}"
25
+ dest: "c:/temp/{{ OSCAP_INSTALLER }}"
26
+
27
+ - name: "Install OpenSCAP"
28
+ when: openscap_exists is failed
29
+ win_package:
30
+ path: "c:/temp/{{ OSCAP_INSTALLER }}"
31
+ arguments:
32
+ - /quiet
33
+ - /norestart
34
+
35
+ - name: "Copy scan benchmarks"
36
+ win_copy:
37
+ src: U_MS_Windows_Server_2016_V2R1_STIG_SCAP_1-2_Benchmark.xml
38
+ dest: "c:/temp"
39
+
40
+ - debug: var=ansible_facts
41
+
42
+ - name: "run a scan, why not {{ ansible_distribution }} -- {{ ansible_distribution_version }} -- {{ ansible_distribution_major_version }} -- {{ ansible_distribution_release }}"
43
+ win_shell: |
44
+ cd c:/temp
45
+ oscap --report report.txt xccdf eval U_MS_Windows_Server_2016_V2R1_STIG_SCAP_1-2_Benchmark.xml
@@ -0,0 +1,2 @@
1
+ localhost
2
+
@@ -0,0 +1,5 @@
1
+ ---
2
+ - hosts: localhost
3
+ remote_user: root
4
+ roles:
5
+ - mu-compliance
@@ -0,0 +1,4 @@
1
+ ---
2
+ OSCAP_VERSION: "1.3.0"
3
+ OSCAP_INSTALLER: "OpenSCAP-{{ OSCAP_VERSION }}-win32.msi"
4
+ OSCAP_URL: "https://github.com/OpenSCAP/openscap/releases/download/{{ OSCAP_VERSION }}/{{ OSCAP_INSTALLER }}"
@@ -0,0 +1,51 @@
1
+ Role Name
2
+ =========
3
+
4
+ Set up an Elastic & Kibana front with an Nginx proxy. Assumes Logstash and APM exist somewhere.
5
+
6
+ Requirements
7
+ ------------
8
+
9
+ Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
10
+
11
+ Role Variables
12
+ --------------
13
+
14
+ A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
15
+
16
+ Dependencies
17
+ ------------
18
+
19
+ A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
20
+
21
+ Example Playbook
22
+ ----------------
23
+
24
+ Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25
+
26
+ - hosts: servers
27
+ roles:
28
+ - { role: username.rolename, x: 42 }
29
+
30
+ License
31
+ -------
32
+
33
+ Copyright:: Copyright (c) 2020 eGlobalTech, Inc., all rights reserved
34
+
35
+ Licensed under the BSD-3 license (the "License");
36
+ you may not use this file except in compliance with the License.
37
+ You may obtain a copy of the License in the root of the project or at
38
+
39
+ http://egt-labs.com/mu/LICENSE.html
40
+
41
+ Unless required by applicable law or agreed to in writing, software
42
+ distributed under the License is distributed on an "AS IS" BASIS,
43
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
+ See the License for the specific language governing permissions and
45
+ limitations under the License.
46
+
47
+
48
+ Author Information
49
+ ------------------
50
+
51
+ An optional section for the role authors to include contact information, or a website (HTML is not allowed).
@@ -0,0 +1,2 @@
1
+ ---
2
+ # defaults file for mu-elastic
@@ -0,0 +1,93 @@
1
+ ################################################################
2
+ ##
3
+ ## JVM configuration
4
+ ##
5
+ ################################################################
6
+ ##
7
+ ## WARNING: DO NOT EDIT THIS FILE. If you want to override the
8
+ ## JVM options in this file, or set any additional options, you
9
+ ## should create one or more files in the jvm.options.d
10
+ ## directory containing your adjustments.
11
+ ##
12
+ ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html
13
+ ## for more information.
14
+ ##
15
+ ################################################################
16
+
17
+ # CVE-2021-44228
18
+ -Dlog4j2.formatMsgNoLookups=true
19
+
20
+ ################################################################
21
+ ## IMPORTANT: JVM heap size
22
+ ################################################################
23
+ ##
24
+ ## The heap size is automatically configured by Elasticsearch
25
+ ## based on the available memory in your system and the roles
26
+ ## each node is configured to fulfill. If specifying heap is
27
+ ## required, it should be done through a file in jvm.options.d,
28
+ ## and the min and max should be set to the same value. For
29
+ ## example, to set the heap to 4 GB, create a new file in the
30
+ ## jvm.options.d directory containing these lines:
31
+ ##
32
+ -Xms5g
33
+ -Xmx5g
34
+ ##
35
+ ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
36
+ ## for more information
37
+ ##
38
+ ################################################################
39
+
40
+
41
+ ################################################################
42
+ ## Expert settings
43
+ ################################################################
44
+ ##
45
+ ## All settings below here are considered expert settings. Do
46
+ ## not adjust them unless you understand what you are doing. Do
47
+ ## not edit them in this file; instead, create a new file in the
48
+ ## jvm.options.d directory containing your adjustments.
49
+ ##
50
+ ################################################################
51
+
52
+ ## GC configuration
53
+ 8-13:-XX:+UseConcMarkSweepGC
54
+ 8-13:-XX:CMSInitiatingOccupancyFraction=75
55
+ 8-13:-XX:+UseCMSInitiatingOccupancyOnly
56
+
57
+ ## G1GC Configuration
58
+ # NOTE: G1 GC is only supported on JDK version 10 or later
59
+ # to use G1GC, uncomment the next two lines and update the version on the
60
+ # following three lines to your version of the JDK
61
+ # 10-13:-XX:-UseConcMarkSweepGC
62
+ # 10-13:-XX:-UseCMSInitiatingOccupancyOnly
63
+ 14-:-XX:+UseG1GC
64
+
65
+ ## JVM temporary directory
66
+ -Djava.io.tmpdir=${ES_TMPDIR}
67
+
68
+ ## heap dumps
69
+
70
+ # generate a heap dump when an allocation from the Java heap fails; heap dumps
71
+ # are created in the working directory of the JVM unless an alternative path is
72
+ # specified
73
+ -XX:+HeapDumpOnOutOfMemoryError
74
+
75
+ # specify an alternative path for heap dumps; ensure the directory exists and
76
+ # has sufficient space
77
+ -XX:HeapDumpPath=/var/lib/elasticsearch
78
+
79
+ # specify an alternative path for JVM fatal error logs
80
+ -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log
81
+
82
+ ## JDK 8 GC logging
83
+ 8:-XX:+PrintGCDetails
84
+ 8:-XX:+PrintGCDateStamps
85
+ 8:-XX:+PrintTenuringDistribution
86
+ 8:-XX:+PrintGCApplicationStoppedTime
87
+ 8:-Xloggc:/var/log/elasticsearch/gc.log
88
+ 8:-XX:+UseGCLogFileRotation
89
+ 8:-XX:NumberOfGCLogFiles=32
90
+ 8:-XX:GCLogFileSize=64m
91
+
92
+ # JDK 9+ GC logging
93
+ 9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
@@ -0,0 +1,10 @@
1
+ ---
2
+ - name: Restart elasticsearch
3
+ service:
4
+ name: elasticsearch
5
+ state: restarted
6
+
7
+ - name: Restart kibana
8
+ service:
9
+ name: kibana
10
+ state: restarted
@@ -0,0 +1,52 @@
1
+ galaxy_info:
2
+ author: your name
3
+ description: your role description
4
+ company: your company (optional)
5
+
6
+ # If the issue tracker for your role is not on github, uncomment the
7
+ # next line and provide a value
8
+ # issue_tracker_url: http://example.com/issue/tracker
9
+
10
+ # Choose a valid license ID from https://spdx.org - some suggested licenses:
11
+ # - BSD-3-Clause (default)
12
+ # - MIT
13
+ # - GPL-2.0-or-later
14
+ # - GPL-3.0-only
15
+ # - Apache-2.0
16
+ # - CC-BY-4.0
17
+ license: license (GPL-2.0-or-later, MIT, etc)
18
+
19
+ min_ansible_version: 2.1
20
+
21
+ # If this a Container Enabled role, provide the minimum Ansible Container version.
22
+ # min_ansible_container_version:
23
+
24
+ #
25
+ # Provide a list of supported platforms, and for each platform a list of versions.
26
+ # If you don't wish to enumerate all versions for a particular platform, use 'all'.
27
+ # To view available platforms and versions (or releases), visit:
28
+ # https://galaxy.ansible.com/api/v1/platforms/
29
+ #
30
+ # platforms:
31
+ # - name: Fedora
32
+ # versions:
33
+ # - all
34
+ # - 25
35
+ # - name: SomePlatform
36
+ # versions:
37
+ # - all
38
+ # - 1.0
39
+ # - 7
40
+ # - 99.99
41
+
42
+ galaxy_tags: []
43
+ # List tags for your role here, one per line. A tag is a keyword that describes
44
+ # and categorizes the role. Users find roles by searching for tags. Be sure to
45
+ # remove the '[]' above, if you add tags to this list.
46
+ #
47
+ # NOTE: A tag is limited to a single word comprised of alphanumeric characters.
48
+ # Maximum 20 tags per role.
49
+
50
+ dependencies: []
51
+ # List your role dependencies here, one per line. Be sure to remove the '[]' above,
52
+ # if you add dependencies to this list.
@@ -0,0 +1,186 @@
1
+ ---
2
+
3
+ - name: remove firewalld
4
+ package:
5
+ name: firewalld
6
+ state: absent
7
+
8
+ - name: make sure iptables is available
9
+ package:
10
+ name: iptables-services
11
+ state: present
12
+
13
+ - name: allow inbound for internal services
14
+ iptables:
15
+ chain: INPUT
16
+ source: "0.0.0.0/0"
17
+ destination_port: "{{ item }}"
18
+ protocol: tcp
19
+ jump: ACCEPT
20
+ with_items:
21
+ - "5601" # Kibana
22
+ - "8200" # APM
23
+ - "9200" # Elastic
24
+ - "9300" # Elastic
25
+
26
+ - name: add yum repo for ElasticSearch
27
+ yum_repository:
28
+ name: elasticsearch
29
+ gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch
30
+ baseurl: https://artifacts.elastic.co/packages/7.x/yum
31
+ description: Elasticsearch repository for 7.x packages
32
+
33
+ - name: install elasticsearch and related packages
34
+ package:
35
+ name: "{{ item }}"
36
+ state: present
37
+ with_items:
38
+ - elasticsearch
39
+ - kibana
40
+ - filebeat
41
+ - httpd-tools
42
+ - expect
43
+
44
+ # XXX (this insecure convolution belongs in some kind of shared library)
45
+ # We have to go through this tempfile dance because jinja doesn't actually see
46
+ # decrypted vault data, apparently, so as soon as we try to do anything other
47
+ # than write the whole decrypted blob to a file it fails to decrypt. That's
48
+ # even if we try the various workarounds from:
49
+ # https://github.com/ansible/ansible/issues/24425
50
+ - name: create Elastic password temp file (ugh)
51
+ tempfile:
52
+ state: file
53
+ suffix: temp
54
+ register: elasticpw_tmpfile
55
+ - name: "Write Elastic password to temp file"
56
+ copy:
57
+ dest: "{{ elasticpw_tmpfile.path }}"
58
+ content: "{{ mu_vaults[mu_deploy_id]['elasticpw'] }}"
59
+ - name: "Load Elastic password from temp file"
60
+ slurp:
61
+ src: "{{ elasticpw_tmpfile.path }}"
62
+ register: elasticpw_yaml
63
+ - name: From tmp YAML to dict
64
+ set_fact:
65
+ elasticpw_dict: "{{ elasticpw_yaml.content | b64decode | from_yaml }}"
66
+
67
+ - name: decrypt elastic password
68
+ set_fact:
69
+ elasticpw: "{{ elasticpw_dict['password'] }}"
70
+
71
+ - name: ElasticSearch config files in /etc/elasticsearch
72
+ copy:
73
+ dest: "/etc/elasticsearch/{{ item }}"
74
+ src: "{{ item }}"
75
+ mode: 0660
76
+ owner: root
77
+ group: elasticsearch
78
+ become: yes
79
+ with_items:
80
+ - jvm.options
81
+ notify:
82
+ - Restart elasticsearch
83
+
84
+ - name: /etc/elasticsearch/elasticsearch.yml
85
+ template:
86
+ src: elasticsearch.yml.j2
87
+ dest: /etc/elasticsearch/elasticsearch.yml
88
+ mode: 0660
89
+ owner: root
90
+ group: elasticsearch
91
+ become: yes
92
+ notify:
93
+ - Restart elasticsearch
94
+
95
+ - name: Copy ElasticSearch certificate store into place
96
+ copy:
97
+ dest: "/etc/elasticsearch/{{ item }}"
98
+ src: "/opt/mu/var/ssl/{{ inventory_hostname }}.pfx"
99
+ mode: 0640
100
+ group: elasticsearch
101
+ become: yes
102
+ with_items:
103
+ - elastic-certificates.p12
104
+ - http.p12
105
+ notify:
106
+ - Restart elasticsearch
107
+
108
+ - name: "Enable and start ElasticSearch"
109
+ service:
110
+ name: elasticsearch
111
+ state: started
112
+
113
+ - name: see if Elastic system passwords have been set
114
+ shell:
115
+ cmd: "/usr/share/elasticsearch/bin/elasticsearch-setup-passwords -s interactive 2>&1 | grep 'user has already been changed'"
116
+ ignore_errors: true
117
+ async: 30
118
+ poll: 5
119
+ no_log: true
120
+ register: passwords_set
121
+
122
+ - name: Create password-setter script
123
+ template:
124
+ src: password_set.expect.j2
125
+ dest: "/root/password_set.expect"
126
+ mode: 0700
127
+ owner: root
128
+ become: yes
129
+ when: passwords_set is failed
130
+
131
+ - name: set elastic system passwords
132
+ command:
133
+ cmd: "/root/password_set.expect"
134
+ no_log: true
135
+ become: yes
136
+ when: passwords_set is failed
137
+
138
+ - name: Remove password-setter scripts
139
+ file:
140
+ path: /root/password_set.expect
141
+ state: absent
142
+
143
+ - name: Copy Mu's CA
144
+ copy:
145
+ dest: "/etc/{{ item }}/elasticsearch-ca.pem"
146
+ src: /opt/mu/var/ssl/Mu_CA.pem
147
+ mode: 0644
148
+ become: yes
149
+ notify:
150
+ - Restart kibana
151
+ with_items:
152
+ - kibana
153
+
154
+ - name: Kibana config files in /etc/kibana
155
+ template:
156
+ dest: /etc/kibana/kibana.yml
157
+ src: kibana.yml.j2
158
+ mode: 0640
159
+ become: yes
160
+ notify:
161
+ - Restart kibana
162
+
163
+ - name: "Enable and start Kibana"
164
+ service:
165
+ name: kibana
166
+ state: started
167
+
168
+ - name: Check whether ElasticSearch S3 backup plugin is installed
169
+ shell: |
170
+ /usr/share/elasticsearch/bin/elasticsearch-plugin list | grep '^repository-s3$'
171
+ ignore_errors: true
172
+ register: s3_present
173
+ no_log: true
174
+ become: yes
175
+
176
+ - name: Install ElasticSearch S3 backup plugin
177
+ shell: "/usr/share/elasticsearch/bin/elasticsearch-plugin install -b repository-s3"
178
+ become: yes
179
+ when: s3_present is failed
180
+ notify:
181
+ - Restart elasticsearch
182
+
183
+ - name: "Force set a reasonable number of shards {{ mu_deployment['servers']['backend'] | json_query('[*].private_ip_address') }}"
184
+ shell: |
185
+ /bin/curl --user "elastic:{{ mu_vaults[mu_deploy_id]['elasticpw'] }}" -k -X PUT "https://{{ mu_deployment['servers']['backend'][inventory_hostname]['private_ip_address'] }}:9200/_cluster/settings" -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "10000" } }'
186
+ become: yes
@@ -0,0 +1,110 @@
1
+ # ======================== Elasticsearch Configuration =========================
2
+ #
3
+ # NOTE: Elasticsearch comes with reasonable defaults for most settings.
4
+ # Before you set out to tweak and tune the configuration, make sure you
5
+ # understand what are you trying to accomplish and the consequences.
6
+ #
7
+ # The primary way of configuring a node is via this file. This template lists
8
+ # the most important settings you may want to configure for a production cluster.
9
+ #
10
+ # Please consult the documentation for further information on configuration options:
11
+ # https://www.elastic.co/guide/en/elasticsearch/reference/index.html
12
+ #
13
+ # ---------------------------------- Cluster -----------------------------------
14
+ #
15
+ # Use a descriptive name for your cluster:
16
+ #
17
+ #cluster.name: icras-elastic
18
+ #
19
+ # ------------------------------------ Node ------------------------------------
20
+ #
21
+ # Use a descriptive name for the node:
22
+ #
23
+ #node.name: 0
24
+ #
25
+ # Add custom attributes to the node:
26
+ #
27
+ #node.attr.rack: r1
28
+ #
29
+ # ----------------------------------- Paths ------------------------------------
30
+ #
31
+ # Path to directory where to store the data (separate multiple locations by comma):
32
+ #
33
+ path.data: /var/lib/elasticsearch
34
+ #
35
+ # Path to log files:
36
+ #
37
+ path.logs: /var/log/elasticsearch
38
+ #
39
+ # ----------------------------------- Memory -----------------------------------
40
+ #
41
+ # Lock the memory on startup:
42
+ #
43
+ #bootstrap.memory_lock: true
44
+ #
45
+ # Make sure that the heap size is set to about half the memory available
46
+ # on the system and that the owner of the process is allowed to use this
47
+ # limit.
48
+ #
49
+ # Elasticsearch performs poorly when the system is swapping the memory.
50
+ #
51
+ # ---------------------------------- Network -----------------------------------
52
+ #
53
+ # Set the bind address to a specific IP (IPv4 or IPv6):
54
+ #
55
+ #network.host: 0
56
+ #
57
+ # Set a custom port for HTTP:
58
+ #
59
+ #http.port: 9200
60
+ #
61
+ # For more information, consult the network module documentation.
62
+ #
63
+ # --------------------------------- Discovery ----------------------------------
64
+ #
65
+ # Pass an initial list of hosts to perform discovery when this node is started:
66
+ # The default list of hosts is ["127.0.0.1", "[::1]"]
67
+ #
68
+ #discovery.seed_hosts: ["host1", "host2"]
69
+ #
70
+ # Bootstrap the cluster using an initial set of master-eligible nodes:
71
+ #
72
+ #cluster.initial_master_nodes: ["node-1", "node-2"]
73
+ #
74
+ # For more information, consult the discovery and cluster formation module documentation.
75
+ #
76
+ # ---------------------------------- Gateway -----------------------------------
77
+ #
78
+ # Block initial recovery after a full cluster restart until N nodes are started:
79
+ #
80
+ #gateway.recover_after_nodes: 3
81
+ #
82
+ # For more information, consult the gateway module documentation.
83
+ #
84
+ # ---------------------------------- Various -----------------------------------
85
+ #
86
+ # Require explicit names when deleting indices:
87
+ #
88
+ #action.destructive_requires_name: true
89
+
90
+ cluster.initial_master_nodes: {% for node,meta in mu_deployment['servers']['backend'].items() %}
91
+ {%- for k,v in meta.items() %}
92
+ {%- if k in ["private_ip_address"] %}
93
+ {{ v }}
94
+ {%- endif %}
95
+ {%- endfor %}
96
+ {%- if not loop.last %},{%- endif %}
97
+ {%- endfor %}
98
+
99
+ xpack.security.enabled: true
100
+ #discovery.type: single-node
101
+ xpack.security.transport.ssl.enabled: true
102
+ xpack.security.transport.ssl.verification_mode: certificate
103
+ xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
104
+ xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
105
+ xpack.security.http.ssl.enabled: true
106
+ xpack.security.http.ssl.keystore.path: "http.p12"
107
+ #xpack.license.self_generated.type: basic
108
+ #xpack.security.http.ssl.enabled: true
109
+ #xpack.security.http.ssl.keystore.path: "/etc/elasticsearch/config/certs/elasticsearch/http.p12"
110
+ network.host: _site_