Skip to content

Commit 02eb8cd

Browse files
authored
Merge branch 'stackhpc/yoga' into DWPD
2 parents eec69ac + 0187d46 commit 02eb8cd

17 files changed

+494
-92
lines changed

doc/source/configuration/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ the various features provided.
1818
wazuh
1919
vault
2020
magnum-capi
21+
security-hardening

doc/source/configuration/release-train.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ apt repositories. This can be done on a host-by host basis by defining the
107107
variables as host or group vars under ``etc/kayobe/inventory/host_vars`` or
108108
``etc/kayobe/inventory/group_vars``.
109109

110+
For Ubuntu-based deployments, Pulp currently `lacks support
111+
<https://github.com/pulp/pulp_deb/issues/419>`_ for certain types of content,
112+
including i18n files and command-not-found indices. This breaks APT when the
113+
``command-not-found`` package is installed:
114+
115+
.. code:: console
116+
117+
E: Failed to fetch https://pulp.example.com/pulp/content/ubuntu/jammy-security/development/dists/jammy-security/main/cnf/Commands-amd64 404 Not Found
118+
119+
The ``purge-command-not-found.yml`` custom playbook can be used to uninstall
120+
the package, prior to running any other APT commands. It may be installed as a
121+
:kayobe-doc:`pre-hook <custom-ansible-playbooks.html#hooks>` to the ``host
122+
configure`` commands. Note that if used as a hook, this playbook matches all
123+
hosts, so will run against the seed, even when running ``overcloud host
124+
configure``. Depending on the stage of deployment, some hosts may be
125+
unreachable.
126+
110127
For CentOS and Rocky Linux based systems, package manager configuration is
111128
provided by ``stackhpc_dnf_repos`` in ``etc/kayobe/dnf.yml``, which points to
112129
package repositories on the local Pulp server. To use this configuration, the
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
==================
2+
Security Hardening
3+
==================
4+
5+
CIS Benchmark Hardening
6+
-----------------------
7+
8+
The roles from the `Ansible-Lockdown <https://github.com/ansible-lockdown>`_
9+
project are used to harden hosts in accordance with the CIS benchmark criteria.
10+
It won't get your benchmark score to 100%, but should provide a significant
11+
improvement over an unhardened system. A typical score would be 70%.
12+
13+
The following operating systems are supported:
14+
15+
- Rocky 8, RHEL 8, CentOS Stream 8
16+
- Ubuntu 22.04
17+
- Rocky 9
18+
19+
Configuration
20+
--------------
21+
22+
Some overrides to the role defaults are provided in
23+
``$KAYOBE_CONFIG_PATH/inventory/group_vars/overcloud/cis``. These may not be
24+
suitable for all deployments and so some fine tuning may be required. For
25+
instance, you may want different rules on a network node compared to a
26+
controller. It is best to consult the upstream role documentation for details
27+
about what each variable does. The documentation can be found here:
28+
29+
- `Rocky 8, RHEL 8, CentOS Stream 8 <https://github.com/ansible-lockdown/RHEL8-CIS/tree/1.3.0>`__
30+
- `Ubuntu 22.04 <https://github.com/ansible-lockdown/UBUNTU22-CIS>`__
31+
- `Rocky 9 <https://github.com/ansible-lockdown/RHEL9-CIS>`__
32+
33+
Running the playbooks
34+
---------------------
35+
36+
As there is potential for unintended side effects when applying the hardening
37+
playbooks, the playbooks are not currently enabled by default. It is recommended
38+
that they are first applied to a representative staging environment to determine
39+
whether or not workloads or API requests are affected by any configuration changes.
40+
41+
.. code-block:: console
42+
43+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/cis.yml
44+

doc/source/operations/rocky-linux-9.rst

Lines changed: 149 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Make the following changes to your Kayobe configuration:
6767
- Merge in the latest ``stackhpc-kayobe-config`` ``stackhpc/yoga`` branch.
6868
- Set ``os_distribution`` to ``rocky`` in ``etc/kayobe/globals.yml``.
6969
- Set ``os_release`` to ``"9"`` in ``etc/kayobe/globals.yml``.
70+
- Consider using a `prebuilt overcloud host image
71+
<../configuration/host-images.html#pulling-host-images>`_ or building an
72+
overcloud host image using the `standard configuration
73+
<../configuration/host-images.html#building-host-images>`_.
7074
- If you are using Kayobe multiple environments, add the following into
7175
``kayobe-config/etc/kayobe/environments/<env>/kolla/config/nova.conf``
7276
(as Kolla custom service config environment merging is not supported in
@@ -82,6 +86,30 @@ Make the following changes to your Kayobe configuration:
8286
This change does not need to be applied before migrating to Rocky Linux 9, but it should cause no harm to do so.
8387
Note that this will not affect existing VMs, only newly created VMs.
8488

89+
Routing rules
90+
-------------
91+
92+
Routing rules referencing tables by name may need adapting to be compatible with NetworkManager
93+
e.g:
94+
95+
.. code-block:: yaml
96+
97+
undercloud_prov_rules:
98+
- from {{ internal_net_name | net_cidr }} table ironic-api
99+
100+
will need to be updated to use numeric IDs:
101+
102+
.. code-block:: yaml
103+
104+
undercloud_prov_rules:
105+
- from {{ internal_net_name | net_cidr }} table 1
106+
107+
The error from NetworkManager was:
108+
109+
.. code-block:: shell
110+
111+
[1697192659.9611] keyfile: ipv4.routing-rules: invalid value for "routing-rule1": invalid value for "table"
112+
85113
Prerequisites
86114
=============
87115

@@ -602,7 +630,125 @@ Wazuh manager
602630

603631
TODO
604632

605-
In-place migrations
606-
===================
633+
In-place upgrades
634+
=================
607635

608-
TODO
636+
Sometimes it is necessary to upgrade a system in-place.
637+
This may be the case for the seed hypervisor or Ansible control host which are often installed manually onto bare metal.
638+
This procedure is not officially recommended, and can be risky, so be sure to back up all critical data and ensure serial console access is available (including password login) in case of getting locked out.
639+
640+
The procedure is performed in two stages:
641+
642+
1. Migrate from CentOS Stream 8 to Rocky Linux 8
643+
2. Upgrade from Rocky Linux 8 to Rocky Linux 9
644+
645+
Potential issues
646+
----------------
647+
648+
Full procedure
649+
--------------
650+
651+
- Inspect existing DNF packages and determine whether they are really required.
652+
653+
- Use the `migrate2rocky.sh
654+
<https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh>`__
655+
script to migrate to Rocky Linux 8.
656+
657+
- Disable all DNF modules - they're no longer used.
658+
659+
.. code-block:: console
660+
661+
sudo dnf module disable "*"
662+
663+
- Migrate to NetworkManager. This can be done using a manual process or with Kayobe.
664+
665+
The manual process is as follows:
666+
667+
- Ensure that all network interfaces are managed by Network Manager:
668+
669+
.. code:: console
670+
671+
sudo sed -i -e 's/NM_CONTROLLED=no/NM_CONTROLLED=yes/g' /etc/sysconfig/network-scripts/*
672+
673+
- Enable and start NetworkManager:
674+
675+
.. code:: console
676+
677+
sudo systemctl enable NetworkManager
678+
sudo systemctl start NetworkManager
679+
680+
- Migrate Ethernet connections to native NetworkManager configuration:
681+
682+
.. code:: console
683+
684+
sudo nmcli connection migrate
685+
686+
- Manually migrate non-Ethernet (bonds, bridges & VLAN subinterfaces) network interfaces to native NetworkManager.
687+
688+
- Look out for lost DNS configuration after migration to NetworkManager. This may be manually restored using something like this:
689+
690+
.. code:: console
691+
692+
nmcli con mod System\ brextmgmt.3003 ipv4.dns "10.41.4.4 10.41.4.5 10.41.4.6"
693+
694+
The following Kayobe process for migrating to NetworkManager has not yet been tested.
695+
696+
- Set ``interfaces_use_nmconnection: true`` as a host/group variable for the relevant hosts
697+
698+
- Run the appropriate host configure command. For example, for the seed hypervisor:
699+
700+
.. code:: console
701+
702+
kayobe seed hypervisor host configure -t network -kt none
703+
704+
- Make sure there are no funky udev rules left in
705+
``/etc/udev/rules.d/70-persistent-net.rules`` (e.g. from cloud-init run on
706+
Rocky 9.1).
707+
708+
- Inspect networking configuration at this point, ideally reboot to validate correctness.
709+
710+
- Upgrade to Rocky Linux 9
711+
712+
.. https://forums.rockylinux.org/t/dnf-warning-message-after-upgrade-from-rocky-8-to-rocky-9/8319/2
713+
714+
- Install Rocky Linux 9 repositories and GPG keys:
715+
716+
.. code:: console
717+
718+
sudo dnf install -y https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-gpg-keys-9.2-1.6.el9.noarch.rpm \
719+
https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-release-9.2-1.6.el9.noarch.rpm \
720+
https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-repos-9.2-1.6.el9.noarch.rpm
721+
722+
- Remove the RedHat logos package:
723+
724+
.. code:: console
725+
726+
sudo rm -rf /usr/share/redhat-logos
727+
728+
- Synchronise all packages with current versions
729+
730+
.. code:: console
731+
732+
sudo dnf --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync -y
733+
734+
- Rebuild RPB database:
735+
736+
.. code:: console
737+
738+
sudo rpm --rebuilddb
739+
740+
- Make a list of EL8 packages to remove:
741+
742+
.. code:: console
743+
744+
sudo rpm -qa | grep el8 > el8-packages
745+
746+
- Inspect the ``el8-packages`` list and ensure only expected packages are included.
747+
748+
- Remove the EL8 packages:
749+
750+
.. code:: console
751+
752+
cat el8-packages | xargs sudo dnf remove -y
753+
754+
- You will need to re-create *all* virtualenvs afterwards due to system Python version upgrade.

etc/kayobe/ansible/cis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,31 @@
44
hosts: overcloud
55
become: true
66
tasks:
7+
- name: Ensure the cron package is installed on ubuntu
8+
package:
9+
name: cron
10+
state: present
11+
when: ansible_facts.distribution == 'Ubuntu'
12+
713
- name: Remove /etc/motd
814
# See remediation in:
915
# https://github.com/wazuh/wazuh/blob/bfa4efcf11e288c0a8809dc0b45fdce42fab8e0d/ruleset/sca/centos/8/cis_centos8_linux.yml#L777
1016
file:
1117
path: /etc/motd
1218
state: absent
19+
when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8'
1320

1421
- include_role:
1522
name: ansible-lockdown.rhel8_cis
23+
when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '8'
24+
tags: always
25+
26+
- include_role:
27+
name: ansible-lockdown.rhel9_cis
28+
when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_major_version == '9'
29+
tags: always
30+
31+
- include_role:
32+
name: ansible-lockdown.ubuntu22_cis
33+
when: ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version == '22'
34+
tags: always

etc/kayobe/ansible/requirements.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ roles:
1515
- name: ansible-lockdown.rhel8_cis
1616
src: https://github.com/ansible-lockdown/RHEL8-CIS
1717
version: 1.3.0
18+
- name: ansible-lockdown.ubuntu22_cis
19+
src: https://github.com/ansible-lockdown//UBUNTU22-CIS
20+
#FIXME: Waiting for https://github.com/ansible-lockdown/UBUNTU22-CIS/pull/132
21+
# to be in a tagged release
22+
version: c91a1038fd218f727075d21b2d0880751322b162
23+
- name: ansible-lockdown.rhel9_cis
24+
src: https://github.com/ansible-lockdown/RHEL9-CIS
25+
#FIXME: Waiting for https://github.com/ansible-lockdown/RHEL9-CIS/pull/54
26+
# to be in a tagged release.
27+
version: 3525cb6aab12a3d1e34aa8432ed77dd76be6a44a
1828
- name: wazuh-ansible
1929
src: https://github.com/stackhpc/wazuh-ansible
2030
version: stackhpc

etc/kayobe/cephadm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cephadm_ceph_release: "{{ 'quincy' if (ansible_facts['distribution_release'] ==
1212
cephadm_image: "{{ stackhpc_docker_registry if stackhpc_sync_ceph_images | bool else 'quay.io' }}/ceph/ceph:{{ cephadm_image_tag }}"
1313

1414
# Ceph container image tag.
15-
cephadm_image_tag: "{{ 'v17.2.6' if os_release == 'jammy' else 'v16.2.11' }}"
15+
cephadm_image_tag: "{{ 'v17.2.7' if os_release == 'jammy' else 'v16.2.14' }}"
1616

1717
# Ceph custom repo workaround for Ubuntu Jammy as there are no official ceph repos for jammy.
1818
cephadm_custom_repos: "{{ ansible_facts['distribution_release'] == 'jammy' }}"

0 commit comments

Comments
 (0)