cloud-mu 3.6.10 → 3.6.12

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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -3
  3. data/Berksfile.lock +11 -14
  4. data/bin/mu-aws-setup +16 -4
  5. data/bin/mu-configure +2 -1
  6. data/cloud-mu.gemspec +3 -3
  7. data/cookbooks/mu-firewall/Berksfile +1 -1
  8. data/cookbooks/mu-firewall/attributes/default.rb +2 -2
  9. data/cookbooks/mu-firewall/metadata.rb +3 -3
  10. data/cookbooks/mu-firewall/recipes/default.rb +11 -2
  11. data/cookbooks/mu-master/Berksfile +1 -1
  12. data/cookbooks/mu-master/attributes/default.rb +14 -1
  13. data/cookbooks/mu-master/files/default/389ds-perl/ASDialogs.pm +173 -0
  14. data/cookbooks/mu-master/files/default/389ds-perl/AdminMigration.pm +569 -0
  15. data/cookbooks/mu-master/files/default/389ds-perl/AdminServer.pm +952 -0
  16. data/cookbooks/mu-master/files/default/389ds-perl/AdminUtil.pm +983 -0
  17. data/cookbooks/mu-master/files/default/389ds-perl/ConfigDSDialogs.pm +449 -0
  18. data/cookbooks/mu-master/files/default/389ds-perl/DSCreate.pm +1551 -0
  19. data/cookbooks/mu-master/files/default/389ds-perl/DSDialogs.pm +233 -0
  20. data/cookbooks/mu-master/files/default/389ds-perl/DSMigration.pm +1175 -0
  21. data/cookbooks/mu-master/files/default/389ds-perl/DSUpdate.pm +534 -0
  22. data/cookbooks/mu-master/files/default/389ds-perl/DSUpdateDialogs.pm +152 -0
  23. data/cookbooks/mu-master/files/default/389ds-perl/DSUtil.pm +1710 -0
  24. data/cookbooks/mu-master/files/default/389ds-perl/Dialog.pm +249 -0
  25. data/cookbooks/mu-master/files/default/389ds-perl/DialogManager.pm +212 -0
  26. data/cookbooks/mu-master/files/default/389ds-perl/FileConn.pm +461 -0
  27. data/cookbooks/mu-master/files/default/389ds-perl/Inf.pm +268 -0
  28. data/cookbooks/mu-master/files/default/389ds-perl/Migration.pm +327 -0
  29. data/cookbooks/mu-master/files/default/389ds-perl/RegDSDialogs.pm +94 -0
  30. data/cookbooks/mu-master/files/default/389ds-perl/Resource.pm +137 -0
  31. data/cookbooks/mu-master/files/default/389ds-perl/Setup.pm +240 -0
  32. data/cookbooks/mu-master/files/default/389ds-perl/SetupDialogs.pm +243 -0
  33. data/cookbooks/mu-master/files/default/389ds-perl/SetupLog.pm +82 -0
  34. data/cookbooks/mu-master/files/default/setCertName.ldif +4 -0
  35. data/cookbooks/mu-master/libraries/mu.rb +2 -2
  36. data/cookbooks/mu-master/metadata.rb +1 -1
  37. data/cookbooks/mu-master/recipes/389ds.rb +71 -32
  38. data/cookbooks/mu-master/recipes/basepackages.rb +5 -0
  39. data/cookbooks/mu-master/recipes/default.rb +16 -5
  40. data/cookbooks/mu-master/recipes/init.rb +36 -3
  41. data/cookbooks/mu-master/recipes/ssl-certs.rb +6 -0
  42. data/cookbooks/mu-master/recipes/sssd.rb +85 -62
  43. data/cookbooks/mu-master/recipes/update_nagios_only.rb +7 -1
  44. data/cookbooks/mu-master/templates/default/389-directory-setup.inf.erb +11 -26
  45. data/cookbooks/mu-master/templates/default/sssd.conf.erb +18 -8
  46. data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
  47. data/cookbooks/mu-tools/metadata.rb +0 -1
  48. data/cookbooks/mu-tools/recipes/set_local_fw.rb +7 -1
  49. data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +5 -1
  50. data/cookbooks/nagios/CHANGELOG.md +679 -0
  51. data/cookbooks/nagios/LICENSE +201 -0
  52. data/cookbooks/nagios/README.md +340 -0
  53. data/cookbooks/nagios/attributes/config.rb +163 -0
  54. data/cookbooks/nagios/attributes/default.rb +204 -0
  55. data/cookbooks/nagios/libraries/base.rb +311 -0
  56. data/cookbooks/nagios/libraries/command.rb +68 -0
  57. data/cookbooks/nagios/libraries/contact.rb +229 -0
  58. data/cookbooks/nagios/libraries/contactgroup.rb +111 -0
  59. data/cookbooks/{firewall/recipes/disable_firewall.rb → nagios/libraries/custom_option.rb} +20 -7
  60. data/cookbooks/nagios/libraries/data_bag_helper.rb +23 -0
  61. data/cookbooks/nagios/libraries/default.rb +90 -0
  62. data/cookbooks/nagios/libraries/helpers.rb +229 -0
  63. data/cookbooks/nagios/libraries/host.rb +410 -0
  64. data/cookbooks/nagios/libraries/hostdependency.rb +178 -0
  65. data/cookbooks/nagios/libraries/hostescalation.rb +170 -0
  66. data/cookbooks/nagios/libraries/hostgroup.rb +117 -0
  67. data/cookbooks/nagios/libraries/nagios.rb +277 -0
  68. data/cookbooks/nagios/libraries/resource.rb +59 -0
  69. data/cookbooks/nagios/libraries/service.rb +449 -0
  70. data/cookbooks/nagios/libraries/servicedependency.rb +213 -0
  71. data/cookbooks/nagios/libraries/serviceescalation.rb +193 -0
  72. data/cookbooks/nagios/libraries/servicegroup.rb +142 -0
  73. data/cookbooks/nagios/libraries/timeperiod.rb +159 -0
  74. data/cookbooks/nagios/libraries/users_helper.rb +54 -0
  75. data/cookbooks/nagios/metadata.json +44 -0
  76. data/cookbooks/nagios/metadata.rb +22 -0
  77. data/cookbooks/nagios/recipes/_load_databag_config.rb +153 -0
  78. data/cookbooks/nagios/recipes/_load_default_config.rb +241 -0
  79. data/cookbooks/nagios/recipes/apache.rb +114 -0
  80. data/cookbooks/nagios/recipes/default.rb +41 -0
  81. data/cookbooks/nagios/recipes/nginx.rb +114 -0
  82. data/cookbooks/nagios/recipes/pagerduty.rb +95 -0
  83. data/cookbooks/nagios/recipes/server.rb +182 -0
  84. data/cookbooks/nagios/recipes/server_package.rb +85 -0
  85. data/cookbooks/nagios/recipes/server_source.rb +137 -0
  86. data/cookbooks/nagios/resources/command.rb +34 -0
  87. data/cookbooks/nagios/resources/conf.rb +52 -0
  88. data/cookbooks/nagios/resources/contact.rb +34 -0
  89. data/cookbooks/nagios/resources/contactgroup.rb +35 -0
  90. data/cookbooks/nagios/resources/host.rb +35 -0
  91. data/cookbooks/nagios/resources/hostdependency.rb +35 -0
  92. data/cookbooks/nagios/resources/hostescalation.rb +36 -0
  93. data/cookbooks/nagios/resources/hostgroup.rb +35 -0
  94. data/cookbooks/nagios/resources/resource.rb +34 -0
  95. data/cookbooks/nagios/resources/service.rb +35 -0
  96. data/cookbooks/nagios/resources/servicedependency.rb +35 -0
  97. data/cookbooks/nagios/resources/serviceescalation.rb +35 -0
  98. data/cookbooks/nagios/resources/servicegroup.rb +35 -0
  99. data/cookbooks/nagios/resources/timeperiod.rb +35 -0
  100. data/cookbooks/nagios/templates/apache2.conf.erb +102 -0
  101. data/cookbooks/nagios/templates/cgi.cfg.erb +266 -0
  102. data/cookbooks/nagios/templates/commands.cfg.erb +13 -0
  103. data/cookbooks/nagios/templates/contacts.cfg.erb +37 -0
  104. data/cookbooks/nagios/templates/hostgroups.cfg.erb +25 -0
  105. data/cookbooks/nagios/templates/hosts.cfg.erb +15 -0
  106. data/cookbooks/nagios/templates/htpasswd.users.erb +6 -0
  107. data/cookbooks/nagios/templates/nagios.cfg.erb +22 -0
  108. data/cookbooks/nagios/templates/nginx.conf.erb +80 -0
  109. data/cookbooks/nagios/templates/pagerduty.cgi.erb +185 -0
  110. data/cookbooks/nagios/templates/resource.cfg.erb +27 -0
  111. data/cookbooks/nagios/templates/servicedependencies.cfg.erb +15 -0
  112. data/cookbooks/nagios/templates/servicegroups.cfg.erb +14 -0
  113. data/cookbooks/nagios/templates/services.cfg.erb +14 -0
  114. data/cookbooks/nagios/templates/spawn-fcgi.erb +10 -0
  115. data/cookbooks/nagios/templates/templates.cfg.erb +31 -0
  116. data/cookbooks/nagios/templates/timeperiods.cfg.erb +13 -0
  117. data/extras/platform_berksfile_base +3 -3
  118. data/extras/python_rpm/build.sh +4 -4
  119. data/extras/python_rpm/muthon.spec +2 -4
  120. data/extras/vault_tools/export_vaults.sh +11 -1
  121. data/install/installer +1 -1
  122. data/modules/mu/kittens.rb +27523 -0
  123. data/modules/mu/master/ldap.rb +48 -31
  124. data/modules/mu/master.rb +69 -0
  125. data/modules/mu/mu.yaml.rb +351 -0
  126. data/modules/mu/providers/aws/firewall_rule.rb +3 -1
  127. data/modules/mu/providers/aws.rb +11 -5
  128. data/modules/mu.rb +5 -4
  129. metadata +99 -68
  130. data/cookbooks/firewall/CHANGELOG.md +0 -488
  131. data/cookbooks/firewall/LICENSE +0 -202
  132. data/cookbooks/firewall/README.md +0 -366
  133. data/cookbooks/firewall/TODO.md +0 -6
  134. data/cookbooks/firewall/attributes/default.rb +0 -5
  135. data/cookbooks/firewall/attributes/firewalld.rb +0 -8
  136. data/cookbooks/firewall/attributes/iptables.rb +0 -17
  137. data/cookbooks/firewall/attributes/ufw.rb +0 -12
  138. data/cookbooks/firewall/attributes/windows.rb +0 -8
  139. data/cookbooks/firewall/libraries/helpers.rb +0 -105
  140. data/cookbooks/firewall/libraries/helpers_firewalld.rb +0 -116
  141. data/cookbooks/firewall/libraries/helpers_firewalld_dbus.rb +0 -72
  142. data/cookbooks/firewall/libraries/helpers_iptables.rb +0 -112
  143. data/cookbooks/firewall/libraries/helpers_nftables.rb +0 -170
  144. data/cookbooks/firewall/libraries/helpers_ufw.rb +0 -142
  145. data/cookbooks/firewall/libraries/helpers_windows.rb +0 -129
  146. data/cookbooks/firewall/libraries/provider_firewall_firewalld.rb +0 -179
  147. data/cookbooks/firewall/libraries/provider_firewall_iptables.rb +0 -171
  148. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu.rb +0 -200
  149. data/cookbooks/firewall/libraries/provider_firewall_iptables_ubuntu1404.rb +0 -200
  150. data/cookbooks/firewall/libraries/provider_firewall_rule.rb +0 -34
  151. data/cookbooks/firewall/libraries/provider_firewall_ufw.rb +0 -138
  152. data/cookbooks/firewall/libraries/provider_firewall_windows.rb +0 -126
  153. data/cookbooks/firewall/libraries/resource_firewall.rb +0 -26
  154. data/cookbooks/firewall/libraries/resource_firewall_rule.rb +0 -52
  155. data/cookbooks/firewall/metadata.json +0 -40
  156. data/cookbooks/firewall/metadata.rb +0 -15
  157. data/cookbooks/firewall/recipes/default.rb +0 -76
  158. data/cookbooks/firewall/recipes/firewalld.rb +0 -87
  159. data/cookbooks/firewall/resources/firewalld.rb +0 -28
  160. data/cookbooks/firewall/resources/firewalld_config.rb +0 -39
  161. data/cookbooks/firewall/resources/firewalld_helpers.rb +0 -106
  162. data/cookbooks/firewall/resources/firewalld_icmptype.rb +0 -88
  163. data/cookbooks/firewall/resources/firewalld_ipset.rb +0 -104
  164. data/cookbooks/firewall/resources/firewalld_policy.rb +0 -115
  165. data/cookbooks/firewall/resources/firewalld_service.rb +0 -98
  166. data/cookbooks/firewall/resources/firewalld_zone.rb +0 -118
  167. data/cookbooks/firewall/resources/nftables.rb +0 -71
  168. data/cookbooks/firewall/resources/nftables_rule.rb +0 -113
  169. data/cookbooks/firewall/templates/default/ufw/default.erb +0 -13
  170. /data/cookbooks/{firewall → nagios}/chefignore +0 -0
  171. /data/cookbooks/{firewall → nagios}/renovate.json +0 -0
@@ -1,76 +0,0 @@
1
- #
2
- # Cookbook:: firewall
3
- # Recipe:: default
4
- #
5
- # Copyright:: 2011-2019, Chef Software, Inc.
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- firewall 'default' do
21
- ipv6_enabled node['firewall']['ipv6_enabled']
22
- action :install
23
- end
24
-
25
- # create a variable to use as a condition on some rules that follow
26
- iptables_firewall = rhel? || amazon_linux? || node['firewall']['ubuntu_iptables']
27
-
28
- firewall_rule 'allow loopback' do
29
- interface 'lo'
30
- protocol :none
31
- command :allow
32
- only_if { linux? && node['firewall']['allow_loopback'] }
33
- end
34
-
35
- firewall_rule 'allow icmp' do
36
- protocol :icmp
37
- command :allow
38
- # debian ufw doesn't allow 'icmp' protocol, but does open
39
- # icmp by default, so we skip it in default recipe
40
- only_if { iptables_firewall && node['firewall']['allow_icmp'] }
41
- end
42
-
43
- firewall_rule 'allow world to ssh' do
44
- port 22
45
- source '0.0.0.0/0'
46
- only_if { linux? && node['firewall']['allow_ssh'] }
47
- end
48
-
49
- firewall_rule 'allow world to winrm' do
50
- port 5989
51
- source '0.0.0.0/0'
52
- only_if { windows? && node['firewall']['allow_winrm'] }
53
- end
54
-
55
- firewall_rule 'allow world to mosh' do
56
- protocol :udp
57
- port 60000..61000
58
- source '0.0.0.0/0'
59
- only_if { linux? && node['firewall']['allow_mosh'] }
60
- end
61
-
62
- # allow established connections, ufw defaults to this but iptables does not
63
- firewall_rule 'established' do
64
- stateful [:related, :established]
65
- protocol :none # explicitly don't specify protocol
66
- command :allow
67
- only_if { node['firewall']['allow_established'] && iptables_firewall }
68
- end
69
-
70
- # ipv6 needs ICMP to reliably work, so ensure it's enabled if ipv6
71
- # allow established connections, ufw defaults to this but iptables does not
72
- firewall_rule 'ipv6_icmp' do
73
- protocol :'ipv6-icmp'
74
- command :allow
75
- only_if { node['firewall']['ipv6_enabled'] && node['firewall']['allow_established'] && iptables_firewall }
76
- end
@@ -1,87 +0,0 @@
1
- #
2
- # Cookbook:: firewall
3
- # Recipe:: firewalld
4
- #
5
- # Copyright:: 2011-2016, Chef Software, Inc.
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- chef_sugar_cookbook_version = Gem::Version.new(run_context.cookbook_collection['chef-sugar'].metadata.version)
21
-
22
- include_recipe 'chef-sugar' if chef_sugar_cookbook_version < Gem::Version.new('4.0.0')
23
-
24
- firewall 'default' do
25
- ipv6_enabled node['firewall']['ipv6_enabled']
26
- enabled_zone node['firewall']['firewalld']['zone'].to_sym
27
- action :install
28
- end
29
-
30
- # create a variable to use as a condition on some rules that follow
31
- iptables_firewall = rhel? || node['firewall']['ubuntu_iptables']
32
-
33
- firewall_rule 'allow loopback' do
34
- interface 'lo'
35
- protocol :none
36
- command :allow
37
- zone node['firewall']['firewalld']['loopback_zone']
38
- only_if { linux? && node['firewall']['allow_loopback'] }
39
- end
40
-
41
- firewall_rule 'allow icmp' do
42
- protocol :icmp
43
- command :allow
44
- zone node['firewall']['firewalld']['icmp_zone']
45
- # debian ufw doesn't allow 'icmp' protocol, but does open
46
- # icmp by default, so we skip it in default recipe
47
- only_if { (!debian?(node) || iptables_firewall) && node['firewall']['allow_icmp'] }
48
- end
49
-
50
- firewall_rule 'allow world to ssh' do
51
- port 22
52
- source '0.0.0.0/0'
53
- zone node['firewall']['firewalld']['ssh_zone']
54
- only_if { linux? && node['firewall']['allow_ssh'] }
55
- end
56
-
57
- firewall_rule 'allow world to winrm' do
58
- port 5989
59
- source '0.0.0.0/0'
60
- only_if { windows? && node['firewall']['allow_winrm'] }
61
- end
62
-
63
- firewall_rule 'allow world to mosh' do
64
- protocol :udp
65
- port 60000..61000
66
- source '0.0.0.0/0'
67
- zone node['firewall']['firewalld']['mosh_zone']
68
- only_if { linux? && node['firewall']['allow_mosh'] }
69
- end
70
-
71
- # allow established connections, ufw defaults to this but iptables does not
72
- firewall_rule 'established' do
73
- stateful [:related, :established]
74
- protocol :none # explicitly don't specify protocol
75
- command :allow
76
- zone node['firewall']['firewalld']['established_zone']
77
- only_if { node['firewall']['allow_established'] && iptables_firewall }
78
- end
79
-
80
- # ipv6 needs ICMP to reliably work, so ensure it's enabled if ipv6
81
- # allow established connections, ufw defaults to this but iptables does not
82
- firewall_rule 'ipv6_icmp' do
83
- protocol :'ipv6-icmp'
84
- command :allow
85
- zone node['firewall']['firewalld']['icmp_zone']
86
- only_if { node['firewall']['ipv6_enabled'] && node['firewall']['allow_established'] && iptables_firewall }
87
- end
@@ -1,28 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld,
4
- os: 'linux'
5
-
6
- action :install do
7
- chef_gem 'ruby-dbus'
8
- require 'dbus'
9
- package 'firewalld'
10
- end
11
-
12
- action :reload do
13
- service 'firewalld' do
14
- action :reload
15
- end
16
- end
17
-
18
- action :restart do
19
- service 'firewalld' do
20
- action :restart
21
- end
22
- end
23
-
24
- action :disable do
25
- service 'firewalld' do
26
- action [:disable, :stop]
27
- end
28
- end
@@ -1,39 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld_config,
4
- os: 'linux'
5
-
6
- property :default_zone,
7
- String,
8
- description: 'Set default zone for connections and interfaces where no zone has been selected to zone. Setting the default zone changes the zone for the connections or interfaces, that are using the default zone.'
9
- property :log_denied,
10
- String,
11
- equal_to: %w(all unicast broadcast multicast off),
12
- description: 'Set LogDenied value to value. If LogDenied is enabled, then logging rules are added right before reject and drop rules in the INPUT, FORWARD and OUTPUT chains for the default rules and also final reject and drop rules in zones.'
13
-
14
- load_current_value do |_new_resource|
15
- sysbus = DBus.system_bus
16
- firewalld_service = sysbus['org.fedoraproject.FirewallD1']
17
- firewalld_object = firewalld_service['/org/fedoraproject/FirewallD1']
18
- interface = firewalld_object['org.fedoraproject.FirewallD1']
19
-
20
- default_zone interface.getDefaultZone
21
- log_denied interface.getLogDenied
22
- end
23
-
24
- action :update do
25
- dbus = DBus.system_bus
26
- fw = firewalld_interface(dbus)
27
-
28
- converge_if_changed :default_zone do
29
- fw.setDefaultZone new_resource.default_zone
30
- end
31
-
32
- converge_if_changed :log_denied do
33
- fw.setLogDenied new_resource.log_denied
34
- end
35
- end
36
-
37
- action_class do
38
- include FirewallCookbook::Helpers::FirewalldDBus
39
- end
@@ -1,106 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld_helper,
4
- os: 'linux'
5
-
6
- property :version,
7
- String,
8
- default: '',
9
- description: 'see version attribute of helper tag in firewalld.helper(5).'
10
- property :short,
11
- String,
12
- name_property: true,
13
- description: 'see short tag in firewalld.helper(5).'
14
- property :description,
15
- String,
16
- description: 'see description tag in firewalld.helper(5).'
17
- property :family,
18
- String,
19
- equal_to: %w(ipv4 ipv6),
20
- default: 'ipv4',
21
- description: 'see family tag in firewalld.helper(5).'
22
- property :nf_module,
23
- String,
24
- description: 'see module tag in firewalld.helper(5).'
25
- property :ports,
26
- [Array, String],
27
- default: [],
28
- description: 'array of port and protocol pairs. See port tag in firewalld.helper(5).',
29
- coerce: proc { |o| Array(o) }
30
-
31
- load_current_value do |new_resource|
32
- dbus = DBus.system_bus
33
- firewalld_service = dbus['org.fedoraproject.FirewallD1']
34
- firewalld_object = firewalld_service['/org/fedoraproject/FirewallD1/config']
35
- fw_config = firewalld_object['org.fedoraproject.FirewallD1.config']
36
- if fw_config.getHelperNames.include?(new_resource.short)
37
- helper_path = fw_config.getHelperByName(new_resource.short)
38
- object = firewalld_service[helper_path]
39
- config_helper = object['org.fedoraproject.FirewallD1.config.helper']
40
- settings = config_helper.getSettings
41
- version settings[0]
42
- # short settings[1]
43
- description settings[2]
44
- family settings[3]
45
- nf_module settings[4]
46
- ports settings[5]
47
- else
48
- Chef::Log.info "Helper #{new_resource.short} does not exist. Will be created."
49
- end
50
- end
51
-
52
- action :update do
53
- dbus = DBus.system_bus
54
- fw = firewalld_interface(dbus)
55
- fw_config = config_interface(dbus)
56
- helper_names = fw_config.getHelperNames
57
- reload = false
58
- if !helper_names.include?(new_resource.short)
59
- values = [
60
- new_resource.version,
61
- new_resource.short,
62
- default_description(new_resource),
63
- new_resource.family,
64
- new_resource.nf_module,
65
- new_resource.ports.map { |e| e.split('/') },
66
- ]
67
- converge_by "Add Helper #{new_resource.short}" do
68
- fw_config.addHelper(new_resource.short, values)
69
- end
70
- reload = true
71
- else
72
- helper_path = fw_config.getHelperByName(new_resource.short)
73
- helper = helper_interface(dbus, helper_path)
74
- converge_if_changed :version do
75
- helper.setVersion new_resource.version
76
- reload = true
77
- end
78
- converge_if_changed :description do
79
- helper.setDescription default_description(new_resource)
80
- reload = true
81
- end
82
- converge_if_changed :family do
83
- helper.setFamily new_resource.family
84
- reload = true
85
- end
86
- converge_if_changed :nf_module do
87
- helper.setModule new_resource.nf_module
88
- reload = true
89
- end
90
- converge_if_changed :ports do
91
- helper.setPorts new_resource.ports.map { |e| e.split('/') }
92
- reload = true
93
- end
94
- end
95
-
96
- if reload
97
- converge_by ['reload permanent configuration of firewalld'] do
98
- fw.reload
99
- end
100
- end
101
- end
102
-
103
- action_class do
104
- include FirewallCookbook::Helpers
105
- include FirewallCookbook::Helpers::FirewalldDBus
106
- end
@@ -1,88 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld_icmptype,
4
- os: 'linux'
5
-
6
- property :version,
7
- String,
8
- default: '',
9
- description: 'see version attribute of icmptype tag in firewalld.icmptype(5).'
10
- property :short,
11
- String,
12
- name_property: true,
13
- description: 'see short tag in firewalld.icmptype(5).'
14
- property :description,
15
- String,
16
- description: 'see description tag in firewalld.icmptype(5).'
17
- property :destinations,
18
- Array,
19
- equal_to: [['ipv4'], ['ipv6'], %w(ipv4 ipv6)],
20
- default: 'ipv4',
21
- description: 'array, either empty or containing strings \'ipv4\' and/or \'ipv6\', see destination tag in firewalld.icmptype(5).',
22
- coerce: proc { |o| Array(o) }
23
-
24
- load_current_value do |new_resource|
25
- sysbus = DBus.system_bus
26
- firewalld_service = sysbus['org.fedoraproject.FirewallD1']
27
- firewalld_object = firewalld_service['/org/fedoraproject/FirewallD1/config']
28
- fw_config = firewalld_object['org.fedoraproject.FirewallD1.config']
29
- if fw_config.getIcmpTypeNames.include?(new_resource.short)
30
- icmptype_path = fw_config.getIcmpTypeByName(new_resource.short)
31
- object = firewalld_service[icmptype_path]
32
- config_icmptype = object['org.fedoraproject.FirewallD1.config.icmptype']
33
- settings = config_icmptype.getSettings
34
- version settings[0]
35
- # short settings[1]
36
- description settings[2]
37
- destinations settings[3]
38
- else
39
- Chef::Log.info "IcmpType #{new_resource.short} does not exist. Will be created."
40
- end
41
- end
42
-
43
- action :update do
44
- dbus = DBus.system_bus
45
- fw_config = config_interface(dbus)
46
- fw = firewalld_interface(dbus)
47
- reload = false
48
- icmptype_names = fw_config.getIcmpTypeNames
49
- if !icmptype_names.include?(new_resource.short)
50
- values = [
51
- new_resource.version,
52
- new_resource.short,
53
- default_description(new_resource),
54
- new_resource.destinations,
55
- ]
56
-
57
- converge_by "Add IcmpType #{new_resource.short}" do
58
- fw_config.addIcmpType(new_resource.short, values)
59
- end
60
- reload = true
61
- else
62
- icmptype_path = fw_config.getIcmpTypeByName(new_resource.short)
63
- icmptype = icmptype_interface(dbus, icmptype_path)
64
- converge_if_changed :version do
65
- icmptype.setVersion new_resource.version
66
- reload = true
67
- end
68
- converge_if_changed :description do
69
- icmptype.setDescription default_description(new_resource)
70
- reload = true
71
- end
72
- converge_if_changed :destinations do
73
- icmptype.setDestinations new_resource.destinations
74
- reload = true
75
- end
76
- end
77
-
78
- if reload
79
- converge_by ['reload permanent configuration of firewalld'] do
80
- fw.reload
81
- end
82
- end
83
- end
84
-
85
- action_class do
86
- include FirewallCookbook::Helpers
87
- include FirewallCookbook::Helpers::FirewalldDBus
88
- end
@@ -1,104 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld_ipset,
4
- os: 'linux'
5
-
6
- property :version,
7
- String,
8
- description: 'see version attribute of ipset tag in firewalld.ipset(5).'
9
- property :short,
10
- String,
11
- name_property: true,
12
- description: 'see short tag in firewalld.ipset(5).'
13
- property :description,
14
- String,
15
- description: 'see description tag in firewalld.ipset(5).'
16
- property :type,
17
- String,
18
- default: 'hash:ip',
19
- description: 'see type attribute of ipset tag in firewalld.ipset(5).',
20
- equal_to:
21
- %w(hash:ip hash:ip,mark hash:ip,port hash:ip,port,ip hash:ip,port,net hash:mac hash:net hash:net,iface hash:net,net hash:net,port hash:net,port,net)
22
- property :options,
23
- Hash,
24
- description: 'hash of {option : value} . See options tag in firewalld.ipset(5).'
25
- property :entries,
26
- [Array, String],
27
- description: 'array of entries, see entry tag in firewalld.ipset(5).',
28
- coerce: proc { |o| Array(o) }
29
-
30
- load_current_value do |new_resource|
31
- sysbus = DBus.system_bus
32
- firewalld_service = sysbus['org.fedoraproject.FirewallD1']
33
- firewalld_object = firewalld_service['/org/fedoraproject/FirewallD1/config']
34
- fw_config = firewalld_object['org.fedoraproject.FirewallD1.config']
35
- if fw_config.getIPSetNames.include?(new_resource.short)
36
- ipset_path = fw_config.getIPSetByName(new_resource.short)
37
- object = firewalld_service[ipset_path]
38
- config_ipset = object['org.fedoraproject.FirewallD1.config.ipset']
39
- settings = config_ipset.getSettings
40
- version settings[0]
41
- # short settings[1]
42
- description settings[2]
43
- type settings[3]
44
- options settings[4]
45
- entries settings[5]
46
- else
47
- Chef::Log.info "Ipset #{new_resource.short} does not exist. Will be created."
48
- end
49
- end
50
-
51
- action :update do
52
- dbus = DBus.system_bus
53
- fw = firewalld_interface(dbus)
54
- fw_config = config_interface(dbus)
55
- reload = false
56
- if !fw_config.getIPSetNames.include?(new_resource.short)
57
- values = [
58
- new_resource.version || '',
59
- new_resource.short,
60
- default_description(new_resource),
61
- new_resource.type,
62
- new_resource.options || {},
63
- new_resource.entries,
64
- ]
65
- converge_by "Add ipset #{new_resource.short}" do
66
- fw_config.addIPSet(new_resource.short, values)
67
- end
68
- reload = true
69
- else
70
- ipset_path = fw_config.getIPSetByName(new_resource.short)
71
- ipset = ipset_interface(dbus, ipset_path)
72
- converge_if_changed :version do
73
- ipset.setVersion new_resource.version
74
- reload = true
75
- end
76
- converge_if_changed :description do
77
- ipset.setDescriptions default_description(new_resource)
78
- reload = true
79
- end
80
- converge_if_changed :type do
81
- ipset.setType new_resource.type
82
- reload = true
83
- end
84
- converge_if_changed :options do
85
- ipset.setOptions(new_resource.options || {})
86
- reload = true
87
- end
88
- converge_if_changed :entries do
89
- ipset.setEntries new_resource.entries
90
- reload = true
91
- end
92
- end
93
-
94
- if reload
95
- converge_by ['reload permanent configuration of firewalld'] do
96
- fw.reload
97
- end
98
- end
99
- end
100
-
101
- action_class do
102
- include FirewallCookbook::Helpers
103
- include FirewallCookbook::Helpers::FirewalldDBus
104
- end
@@ -1,115 +0,0 @@
1
- unified_mode true
2
-
3
- provides :firewalld_policy,
4
- os: 'linux'
5
-
6
- property :description,
7
- String,
8
- description: 'see description tag in firewalld.policy(5).'
9
- property :egress_zones,
10
- [Array, String],
11
- description: 'array of zone names. See egress-zone tag in firewalld.policy(5).',
12
- coerce: proc { |o| Array(o) }
13
- property :forward_ports,
14
- [Array, String],
15
- description: 'array of `portid[-portid]:proto=protocol[:toport=portid[-portid]][:toaddr=address[/mask]]`. See forward-port tag in firewalld.policy(5).',
16
- coerce: proc { |o| Array(o) }
17
- property :icmp_blocks,
18
- [Array, String],
19
- description: 'array of icmp-blocks. See icmp-block tag in firewalld.policy(5).'
20
- property :ingress_zones,
21
- [Array, String],
22
- description: 'array of zone names. See ingress-zone tag in firewalld.policy(5).',
23
- coerce: proc { |o| Array(o) }
24
- property :masquerade,
25
- [true, false],
26
- description: 'see masquerade tag in firewalld.policy(5).'
27
- property :ports,
28
- [Array, String],
29
- description: 'array of port and protocol pairs. See port tag in firewalld.policy(5).',
30
- coerce: proc { |o| Array(o) }
31
- property :priority,
32
- Integer,
33
- description: 'see priority tag in firewalld.policy(5).'
34
- property :protocols,
35
- [Array, String],
36
- description: 'array of protocols, see protocol tag in firewalld.policy(5).',
37
- coerce: proc { |o| Array(o) }
38
- property :rich_rules,
39
- [Array, String],
40
- description: 'array of rich-language rules. See rule tag in firewalld.policy(5).',
41
- coerce: proc { |o| Array(o) }
42
- property :services,
43
- [Array, String],
44
- description: 'array of service names, see service tag in firewalld.policy(5).',
45
- coerce: proc { |o| Array(o) }
46
- property :short,
47
- String,
48
- description: 'see short tag in firewalld.policy(5).',
49
- name_property: true
50
- property :source_ports,
51
- [Array, String],
52
- description: 'array of port and protocol pairs. See source-port tag in firewalld.policy(5).',
53
- coerce: proc { |o| Array(o) }
54
- property :target,
55
- String,
56
- description: 'see target attribute of policy tag in firewalld.policy(5).'
57
- property :version,
58
- String,
59
- description: 'see version attribute of policy tag in firewalld.policy(5).'
60
-
61
- load_current_value do |new_resource|
62
- sysbus = DBus.system_bus
63
- firewalld_service = sysbus['org.fedoraproject.FirewallD1']
64
- firewalld_object = firewalld_service['/org/fedoraproject/FirewallD1/config']
65
- fw_config = firewalld_object['org.fedoraproject.FirewallD1.config']
66
- if fw_config.getPolicyNames.include?(new_resource.short)
67
- policy_path = fw_config.getPolicyByName(new_resource.short)
68
- object = firewalld_service[policy_path]
69
- config_policy = object['org.fedoraproject.FirewallD1.config.policy']
70
- config_policy.getSettings.each do |k, v|
71
- send(k, v)
72
- end
73
- else
74
- Chef::Log.info "Zone #{new_resource.short} does not exist. Will be created."
75
- end
76
- end
77
-
78
- action :update do
79
- dbus = DBus.system_bus
80
- fw = firewalld_interface(dbus)
81
- fw_config = config_interface(dbus)
82
- reload = false
83
-
84
- unless fw_config.getPolicyNames.include?(new_resource.short)
85
- fw_config.addPolicy(new_resource.short, {})
86
- end
87
- policy_path = fw_config.getPolicyByName(new_resource.short)
88
- policy = policy_interface(dbus, policy_path)
89
- properties = new_resource.class.state_properties.map(&:name)
90
- properties.each do |property|
91
- new_value = new_resource.send(property)
92
- next if new_value.nil?
93
- if [:ports, :source_ports].include?(property)
94
- new_value = DBus.variant('a(ss)', new_value.map { |e| e.split('/') })
95
- elsif [:forward_ports].include?(property)
96
- new_value = forward_ports_to_dbus(new_resource)
97
- elsif [:priority].include?(property)
98
- new_value = DBus.variant('i', new_value)
99
- end
100
- converge_if_changed property do
101
- policy.update({ property.to_s => new_value })
102
- reload = true
103
- end
104
- end
105
-
106
- if reload
107
- converge_by ['reload permanent configuration of firewalld'] do
108
- fw.reload
109
- end
110
- end
111
- end
112
-
113
- action_class do
114
- include FirewallCookbook::Helpers::FirewalldDBus
115
- end