@@ -10,35 +10,263 @@ The configuration uses the :kayobe-doc:`firewall
10
10
functionality of Kayobe.
11
11
12
12
The firewall configuration is provided in
13
- ``etc/kayobe/inventory/group_vars/all/firewall ``. This allows configuration
14
- variables to be overridden on a per-group or per-host basis (which would not be
15
- possible for an "extra variable" in ``etc/kayobe/*.yml ``). This configuration
16
- is not used by default, and must be actively opted into. This can be done as
17
- follows:
13
+ ``etc/kayobe/inventory/group_vars/all/firewall ``.
14
+
15
+ Enabling StackHPC firewalld rules
16
+ =================================
17
+
18
+ The standardised firewalld configuration is not used by default and must be
19
+ actively opted into. This can be done as follows:
20
+
21
+ Controller firewalld Configuration
22
+ ----------------------------------
18
23
19
24
.. code-block :: yaml
20
25
:caption : ` ` etc/kayobe/controllers.yml``
21
26
27
+ # ##############################################################################
28
+ # Controller node firewalld configuration.
29
+
30
+ # Whether to install and enable firewalld.
22
31
controller_firewalld_enabled : true
23
- controller_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
32
+
33
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
24
34
controller_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
35
+
36
+ # A firewalld zone to set as the default. Default is unset, in which case
37
+ # the default zone will not be changed.
38
+ # Predefined zones are listed here:
39
+ # https://firewalld.org/documentation/zone/predefined-zones.html
40
+ controller_firewalld_default_zone : trusted
41
+
42
+ # A list of firewall rules to apply. Each item is a dict containing
43
+ # arguments to pass to the firewalld module. Arguments are omitted if not
44
+ # provided, with the following exceptions:
45
+ # - offline: true
46
+ # - permanent: true
47
+ # - state: enabled
48
+ controller_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
49
+
50
+ Compute firewalld Configuration
51
+ -------------------------------
52
+
53
+ .. code-block :: yaml
54
+ :caption : ` ` etc/kayobe/compute.yml``
55
+
56
+ # ##############################################################################
57
+ # Compute node firewalld configuration.
58
+
59
+ # Whether to install and enable firewalld.
60
+ compute_firewalld_enabled : true
61
+
62
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
63
+ compute_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
64
+
65
+ # A firewalld zone to set as the default. Default is unset, in which case
66
+ # the default zone will not be changed.
25
67
# Predefined zones are listed here:
26
68
# https://firewalld.org/documentation/zone/predefined-zones.html
27
- # Unset to leave the default zone unchanged
28
- controller_firewalld_default_zone : drop
29
-
30
- This will configure the standard set of firewalld rules on controller hosts.
31
- Rule definitions are automatically added according to group membership. Rule
32
- sets exist for the following groups:
33
-
34
- * Controllers - ``stackhpc_controller_firewalld_rules ``
35
- * Compute - ``stackhpc_compute_firewalld_rules ``
36
- * Storage - ``stackhpc_storage_firewalld_rules ``
37
- * Monitoring - ``stackhpc_monitoring_firewalld_rules ``
38
- * Wazuh Manager Infrastructure VM - ``stackhpc_wazuh_manager_infra_vm_firewalld_rules ``
39
- * Ansible Control host Infrastructure VM - ``stackhpc_ansible_control_infra_vm_firewalld_rules ``
40
- * Seed - ``stackhpc_seed_firewalld_rules ``
41
- * Seed Hypervisor - ``stackhpc_seed_hypervisor_firewalld_rules ``
69
+ compute_firewalld_default_zone : trusted
70
+
71
+ # A list of firewall rules to apply. Each item is a dict containing
72
+ # arguments to pass to the firewalld module. Arguments are omitted if not
73
+ # provided, with the following exceptions:
74
+ # - offline: true
75
+ # - permanent: true
76
+ # - state: enabled
77
+ compute_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
78
+
79
+ Storage firewalld Configuration
80
+ -------------------------------
81
+
82
+ .. code-block :: yaml
83
+ :caption : ` ` etc/kayobe/storage.yml``
84
+
85
+ # ##############################################################################
86
+ # storage node firewalld configuration.
87
+
88
+ # Whether to install and enable firewalld.
89
+ storage_firewalld_enabled : true
90
+
91
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
92
+ storage_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
93
+
94
+ # A firewalld zone to set as the default. Default is unset, in which case
95
+ # the default zone will not be changed.
96
+ # Predefined zones are listed here:
97
+ # https://firewalld.org/documentation/zone/predefined-zones.html
98
+ storage_firewalld_default_zone : trusted
99
+
100
+ # A list of firewall rules to apply. Each item is a dict containing
101
+ # arguments to pass to the firewalld module. Arguments are omitted if not
102
+ # provided, with the following exceptions:
103
+ # - offline: true
104
+ # - permanent: true
105
+ # - state: enabled
106
+ storage_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
107
+
108
+ Monitoring firewalld Configuration
109
+ ----------------------------------
110
+
111
+ .. code-block :: yaml
112
+ :caption : ` ` etc/kayobe/monitoring.yml``
113
+
114
+ # ##############################################################################
115
+ # monitoring node firewalld configuration.
116
+
117
+ # Whether to install and enable firewalld.
118
+ monitoring_firewalld_enabled : true
119
+
120
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
121
+ monitoring_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
122
+
123
+ # A firewalld zone to set as the default. Default is unset, in which case
124
+ # the default zone will not be changed.
125
+ # Predefined zones are listed here:
126
+ # https://firewalld.org/documentation/zone/predefined-zones.html
127
+ monitoring_firewalld_default_zone : trusted
128
+
129
+ # A list of firewall rules to apply. Each item is a dict containing
130
+ # arguments to pass to the firewalld module. Arguments are omitted if not
131
+ # provided, with the following exceptions:
132
+ # - offline: true
133
+ # - permanent: true
134
+ # - state: enabled
135
+ monitoring_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
136
+
137
+ Infrastructure VM firewalld Configuration
138
+ -----------------------------------------
139
+
140
+ The standard firewalld configuration has rules for wazuh-manager and Ansible
141
+ control host Infrastructure VMs.
142
+
143
+ .. code-block :: yaml
144
+ :caption : ` ` etc/kayobe/infra-vms.yml``
145
+
146
+ # ##############################################################################
147
+ # Infrastructure VM node firewalld configuration
148
+
149
+ # Whether to install and enable firewalld.
150
+ infra_vm_firewalld_enabled : true
151
+
152
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
153
+ infra_vm_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
154
+
155
+ # A firewalld zone to set as the default. Default is unset, in which case
156
+ # the default zone will not be changed.
157
+ # Predefined zones are listed here:
158
+ # https://firewalld.org/documentation/zone/predefined-zones.html
159
+ infra_vm_firewalld_default_zone : trusted
160
+
161
+ # A list of firewall rules to apply. Each item is a dict containing
162
+ # arguments to pass to the firewalld module. Arguments are omitted if not
163
+ # provided, with the following exceptions:
164
+ # - offline: true
165
+ # - permanent: true
166
+ # - state: enabled
167
+ infra_vm_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
168
+
169
+ Seed firewalld Configuration
170
+ ----------------------------
171
+
172
+ .. code-block :: yaml
173
+ :caption : ` ` etc/kayobe/seed.yml``
174
+
175
+ # ##############################################################################
176
+ # seed node firewalld configuration.
177
+
178
+ # Whether to install and enable firewalld.
179
+ seed_firewalld_enabled : true
180
+
181
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
182
+ seed_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
183
+
184
+ # A firewalld zone to set as the default. Default is unset, in which case
185
+ # the default zone will not be changed.
186
+ # Predefined zones are listed here:
187
+ # https://firewalld.org/documentation/zone/predefined-zones.html
188
+ seed_firewalld_default_zone : trusted
189
+
190
+ # A list of firewall rules to apply. Each item is a dict containing
191
+ # arguments to pass to the firewalld module. Arguments are omitted if not
192
+ # provided, with the following exceptions:
193
+ # - offline: true
194
+ # - permanent: true
195
+ # - state: enabled
196
+ seed_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
197
+
198
+ Seed Hypervisor firewalld Configuration
199
+ ---------------------------------------
200
+
201
+ .. code-block :: yaml
202
+ :caption : ` ` etc/kayobe/seed_hypervisor.yml``
203
+
204
+ # ##############################################################################
205
+ # seed_hypervisor node firewalld configuration.
206
+
207
+ # Whether to install and enable firewalld.
208
+ seed_hypervisor_firewalld_enabled : true
209
+
210
+ # A list of zones to create. Each item is a dict containing a 'zone' item.
211
+ seed_hypervisor_firewalld_zones : " {{ stackhpc_firewalld_zones }}"
212
+
213
+ # A firewalld zone to set as the default. Default is unset, in which case
214
+ # the default zone will not be changed.
215
+ # Predefined zones are listed here:
216
+ # https://firewalld.org/documentation/zone/predefined-zones.html
217
+ seed_hypervisor_firewalld_default_zone : trusted
218
+
219
+ # A list of firewall rules to apply. Each item is a dict containing
220
+ # arguments to pass to the firewalld module. Arguments are omitted if not
221
+ # provided, with the following exceptions:
222
+ # - offline: true
223
+ # - permanent: true
224
+ # - state: enabled
225
+ seed_hypervisor_firewalld_rules : " {{ stackhpc_firewalld_rules }}"
226
+
227
+ Custom rules
228
+ ------------
229
+
230
+ Custom firewalld rules can be added for any of the following groups using their
231
+ corresponding variables:
232
+
233
+ * Controllers - ``stackhpc_controller_firewalld_rules_extra ``
234
+ * Compute - ``stackhpc_compute_firewalld_rules_extra ``
235
+ * Storage - ``stackhpc_storage_firewalld_rules_extra ``
236
+ * Monitoring - ``stackhpc_monitoring_firewalld_rules_extra ``
237
+ * Wazuh Manager Infrastructure VM - ``stackhpc_wazuh_manager_infra_vm_firewalld_rules_extra ``
238
+ * Ansible Control host Infrastructure VM - ``stackhpc_ansible_control_infra_vm_firewalld_rules_extra ``
239
+ * Seed - ``stackhpc_seed_firewalld_rules_extra ``
240
+ * Seed Hypervisor - ``stackhpc_seed_hypervisor_firewalld_rules_extra ``
241
+
242
+ Each variable is a list of firewall rules to apply. Each item is a dict
243
+ containing arguments to pass to the firewalld module.
244
+
245
+ The example below would enable SSH on the ``provision_oc `` network, and disable
246
+ UDP port 1000 on the ``admin_oc `` network for the Wazuh manager Infrastructure
247
+ VM:
248
+
249
+ .. code-block :: yaml
250
+ :caption : ` ` etc/kayobe/inventory/group_vars/wazuh_manager/firewall``
251
+
252
+ stackhpc_wazuh_manager_infra_vm_firewalld_rules_extra :
253
+ - service : ssh
254
+ network : " {{ provision_oc_net_name }}"
255
+ zone : " {{ provision_oc_net_name | net_zone }}"
256
+ state : enabled
257
+ - port : 1000/udp
258
+ network : " {{ admin_oc_net_name }}"
259
+ zone : " {{ admin_oc_net_name | net_zone }}"
260
+ state : disabled
261
+
262
+ Beware that if any rules are found that directly conflict (a service or port is
263
+ both enabled and disabled) the configuration will fail. There is currently no
264
+ way to override rules in the standard configuration, other than to find the
265
+ rule and delete it manually. If you find a standard rule that does not work for
266
+ your deployment, please consider merging your changes back in to upstream SKC.
267
+
268
+ Applying changes
269
+ ----------------
42
270
43
271
The ``kayobe configuration dump `` command can be used to view all the rules
44
272
that will be applied to a host.
@@ -50,7 +278,8 @@ that will be applied to a host.
50
278
If the command above prints a template, rather than a clean list of rules, the
51
279
configuration is invalid. The kayobe configuration dump command can be used on
52
280
other variables such as ``stackhpc_firewalld_rules_unverified `` or
53
- ``stackhpc_*_firewalld_rules `` to debug the configuration.
281
+ ``stackhpc_*_firewalld_rules `` to debug the configuration. See the `How it
282
+ works `_ section for more details.
54
283
55
284
Ensure Kolla Ansible opens up ports in firewalld for services on the public
56
285
API network:
@@ -65,3 +294,57 @@ Ensure every network in ``networks.yml`` has a zone defined. The standard
65
294
configuration is to set the internal network zone to ``trusted `` and every
66
295
other zone to the name of the network. See
67
296
``etc/kayobe/environments/ci-multinode/networks.yml `` for a practical example.
297
+
298
+ Apply the changes:
299
+
300
+ .. code-block :: bash
301
+
302
+ # For Seed Hypervisor hosts
303
+ kayobe seed hypervisor host configure -t network,firewall
304
+ # For Seed hosts
305
+ kayobe seed host configure -t network,firewall
306
+ # For Infrastructure VM hosts
307
+ kayobe infra vm host configure -t network,firewall
308
+ # For Overcloud hosts
309
+ kayobe overcloud host configure -t network,firewall
310
+
311
+ How it works
312
+ ============
313
+
314
+ The standard firewall rule configuration is stored in
315
+ ``etc/kayobe/inventory/group_vars/all/firewall ``.
316
+
317
+ The file contains sections for different host groups. There are sections for:
318
+
319
+ * Common (all hosts)
320
+ * Controllers
321
+ * Compute
322
+ * Storage
323
+ * Monitoring
324
+ * Wazuh Manager Infrastructure VM
325
+ * Ansible Control host Infrastructure VM
326
+ * Seed
327
+ * Seed Hypervisor
328
+
329
+ Each of these sections contains a template. The template is made of sets of
330
+ rules. The rules can then be enabled and disabled in sets, based on properties
331
+ of the cloud. For example, if ``kolla_enable_designate `` is true, a set of
332
+ rules will be enabled in ``stackhpc_controller_firewalld_rules_template ``.
333
+
334
+ The rules are then formatted into a single list of the enabled default rules
335
+ for a group e.g. ``stackhpc_controller_firewalld_rules_default `` for
336
+ controllers. It is worth noting that the rules are also manipulated to reduce
337
+ duplication. When no zone is specified in a rule template, it is inferred from
338
+ the network.
339
+
340
+ The default rules are combined with any extra rules defined for the deployment.
341
+ For controllers, these are ``stackhpc_controller_firewalld_rules_extra ``. The
342
+ complete set of controller firewalld rules is
343
+ ``stackhpc_controller_firewalld_rules ``.
344
+
345
+ Each group-specific list of rules is combined into
346
+ ``stackhpc_firewalld_rules_unverified `` based on the host's group membership,
347
+ as well as a set of common rules, which is enabled for all hosts.
348
+
349
+ ``stackhpc_firewalld_rules `` is the final list of rules that have been verified
350
+ for correctness.
0 commit comments