Skip to content

Commit 86db290

Browse files
committed
Refactor firewall config
1 parent 128da2e commit 86db290

File tree

4 files changed

+84
-216
lines changed

4 files changed

+84
-216
lines changed

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ jobs:
222222
admin_bootproto: dhcp
223223
admin_ips:
224224
controller0: "{{ access_ip_v4.value }}"
225-
admin_zone: drop
225+
admin_zone: admin
226226
EOF
227227
228228
- name: Write Terraform network interface config

doc/source/configuration/firewall.rst

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,11 @@ Seed Hypervisor firewalld Configuration
230230
Custom rules
231231
------------
232232

233-
Custom firewalld rules can be added for any of the following groups using their
234-
corresponding variables:
235-
236-
* All hosts - ``stackhpc_common_firewalld_rules_extra``
237-
* Controllers - ``stackhpc_controller_firewalld_rules_extra``
238-
* Compute - ``stackhpc_compute_firewalld_rules_extra``
239-
* Storage - ``stackhpc_storage_firewalld_rules_extra``
240-
* Monitoring - ``stackhpc_monitoring_firewalld_rules_extra``
241-
* Wazuh Manager Infrastructure VM - ``stackhpc_wazuh_manager_infra_vm_firewalld_rules_extra``
242-
* Ansible Control host Infrastructure VM - ``stackhpc_ansible_control_infra_vm_firewalld_rules_extra``
243-
* Seed - ``stackhpc_seed_firewalld_rules_extra``
244-
* Seed Hypervisor - ``stackhpc_seed_hypervisor_firewalld_rules_extra``
245-
246-
Each variable is a list of firewall rules to apply. Each item is a dict
247-
containing arguments to pass to the firewalld module. The variables can be
248-
defined as group vars, host vars, or in the extra vars files.
233+
Custom firewalld rules can be added to ``stackhpc_firewalld_rules_extra``
234+
235+
The variable is a list of firewall rules to apply. Each item is a dict
236+
containing arguments to pass to the firewalld module. The variable can be
237+
defined as a group var or host var in the kayobe inventory.
249238

250239
The example below would enable SSH on the ``provision_oc`` network, and disable
251240
UDP port 1000 on the ``admin_oc`` network for the Wazuh manager Infrastructure
@@ -254,7 +243,7 @@ VM:
254243
.. code-block:: yaml
255244
:caption: ``etc/kayobe/inventory/group_vars/wazuh_manager/firewall``
256245
257-
stackhpc_wazuh_manager_infra_vm_firewalld_rules_extra:
246+
stackhpc_firewalld_rules_extra:
258247
- service: ssh
259248
network: "{{ provision_oc_net_name }}"
260249
zone: "{{ provision_oc_net_name | net_zone }}"
@@ -264,11 +253,10 @@ VM:
264253
zone: "{{ admin_oc_net_name | net_zone }}"
265254
state: disabled
266255
267-
Beware that if any rules are found that directly conflict (a service or port is
268-
both enabled and disabled) the configuration will fail. There is currently no
269-
way to override rules in the standard configuration, other than to find the
270-
rule and delete it manually. If you find a standard rule that does not work for
271-
your deployment, please consider merging your changes back in to upstream SKC.
256+
Extra rules have higher precedence than the default rules, but are not
257+
validated before being applied. Use with caution. If you need to add a custom
258+
rule, consider adding it to the default rule list with an appropriate boolean
259+
condition, and where possible merge your changes back into upstream SKC.
272260

273261
Validation
274262
----------
@@ -282,9 +270,9 @@ that will be applied to a host.
282270
283271
If the command above prints a template, rather than a clean list of rules, the
284272
configuration is invalid. The kayobe configuration dump command can be used on
285-
other variables such as ``stackhpc_firewalld_rules_unverified`` or
286-
``stackhpc_*_firewalld_rules`` to debug the configuration. See the `How it
287-
works`_ section for more details.
273+
other variables such as ``stackhpc_firewalld_rules_default`` or
274+
``stackhpc_*_firewalld_rules_template`` to debug the configuration. See the
275+
`How it works`_ section for more details.
288276

289277
Kolla-Ansible configuration
290278
---------------------------
@@ -342,20 +330,17 @@ rules. The rules can then be enabled and disabled in sets, based on properties
342330
of the cloud. For example, if ``kolla_enable_designate`` is true, a set of
343331
rules will be enabled in ``stackhpc_controller_firewalld_rules_template``.
344332

345-
The rules are then formatted into a single list of the enabled default rules
346-
for a group e.g. ``stackhpc_controller_firewalld_rules_default`` for
347-
controllers. It is worth noting that the rules are also manipulated to reduce
333+
The templates are combined into a single list,
334+
``stackhpc_firewalld_rules_template``. Templates are selected according to the
335+
host's group membership, as well as a set of common rules, which is enabled for
336+
all hosts.
337+
338+
The rules are then formatted into a single list of the enabled default rules:
339+
``stackhpc_firewalld_rules_default``. The Rules are manipulated to reduce
348340
duplication. When no zone is specified in a rule template, it is inferred from
349-
the network.
341+
the network. They are also validated. Conflicting rules will result in an
342+
error. Non-applicable rules are dropped.
350343

351344
The default rules are combined with any extra rules defined for the deployment.
352-
For controllers, these are ``stackhpc_controller_firewalld_rules_extra``. The
353-
complete set of controller firewalld rules is
354-
``stackhpc_controller_firewalld_rules``.
355-
356-
Each group-specific list of rules is combined into
357-
``stackhpc_firewalld_rules_unverified`` based on the host's group membership,
358-
as well as a set of common rules, which is enabled for all hosts.
359-
360-
``stackhpc_firewalld_rules`` is the final list of rules that have been verified
361-
for correctness.
345+
The complete set of controller firewalld rules is
346+
``stackhpc_firewalld_rules``.

etc/kayobe/environments/ci-multinode/networks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ storage_mgmt_net_name: storage_mgmt
7272
# Network definitions.
7373

7474
# Admin overcloud network
75-
admin_oc_zone: "admin_oc"
75+
admin_oc_zone: "trusted"
7676

7777
# Internal network
7878
internal_cidr: 192.168.37.0/24

0 commit comments

Comments
 (0)