-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/no-ohpc
- Loading branch information
Showing
59 changed files
with
856 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Use ONE of the following tags on this playbook: | ||
# - retrieve: copies keytabs out of the state volume to the environment | ||
# - deploy: copies keytabs from the environment to the state volume | ||
|
||
- hosts: freeipa_client | ||
become: yes | ||
gather_facts: no | ||
tasks: | ||
- import_role: | ||
name: freeipa | ||
tasks_from: backup-keytabs.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- hosts: openhpc | ||
gather_facts: no | ||
become: yes | ||
tasks: | ||
- import_role: | ||
name: cve-2023-41914 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
- hosts: basic_users | ||
- hosts: freeipa_client | ||
tags: | ||
- freeipa | ||
- freeipa_server # as this is only relevant if using freeipa_server | ||
- freeipa_host | ||
gather_facts: no | ||
become: yes | ||
tasks: | ||
- name: Ensure FreeIPA client hosts are added to the FreeIPA server | ||
import_role: | ||
name: freeipa | ||
tasks_from: addhost.yml | ||
when: groups['freeipa_server'] | length > 0 | ||
|
||
- hosts: freeipa_client | ||
tags: | ||
- basic_users | ||
- freeipa | ||
- freeipa_client | ||
gather_facts: yes | ||
become: yes | ||
tasks: | ||
- name: Install FreeIPA client | ||
import_role: | ||
name: freeipa | ||
tasks_from: client-install.yml | ||
- name: Enrol FreeIPA client | ||
import_role: | ||
name: freeipa | ||
tasks_from: enrol.yml | ||
|
||
- hosts: freeipa_server | ||
tags: | ||
- freeipa | ||
- freeipa_server | ||
- users | ||
gather_facts: yes | ||
become: yes | ||
tasks: | ||
- import_role: | ||
name: basic_users | ||
- name: Add FreeIPA users | ||
import_role: | ||
name: freeipa | ||
tasks_from: users.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# cve-2023-41914 | ||
|
||
This role fixes [Slurm CVE-2023-41914](https://lists.schedmd.com/pipermail/slurm-announce/2023/000100.html): | ||
|
||
> A number of race conditions have been identified within the slurmd/slurmstepd processes that can lead to the user taking ownership of an arbitrary file on the system. A related issue can lead to the user overwriting an arbitrary file on the compute node (although with data that is not directly under their control). A related issue can also lead to the user deleting all files and sub-directories of an arbitrary target directory on the compute node. | ||
**NB:** It is only suitable for use on systems installed from OpenHPC v2.6.1 (Slurm v22.05). | ||
|
||
At the time of writing, new OpenHPC packages have been built but are not available from the respositories (reference), hence `dnf update ...` is not available. | ||
|
||
This role can be run in two ways: | ||
|
||
1. To remediate an existing system, run `tasks/main.yml`, e.g. using the playbook `ansible/adhoc/cve-2023-41914.yml`. This will: | ||
- Stop all Slurm services | ||
- Backup the slurmdbd mysql database to the volume-backed directory `/var/lib/state/mysql-backups/` on the control node (by default). | ||
- Uninstall the affected packages and install updated rpms from the OpenHPC build system. | ||
- Restart Slurm services. | ||
|
||
**NB**: This playbook will ALWAYS stop and restart Slurm, even if no updates are actually required. | ||
|
||
2. To remediate images during build (i.e no Slurm services are running, no slurm database exists), run `tasks/install-rpms.yml`, e.g. using the following in an environment pre-hook: | ||
|
||
```yaml | ||
- hosts: builder | ||
gather_facts: no | ||
become: yes | ||
tasks: | ||
- name: Apply fixes for cve-2023-41914 | ||
import_role: | ||
name: cve-2023-41914 | ||
tasks_from: install-rpms.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# _cve_2023_41814_installed_slurm: [] | ||
cve_2023_41914_mysql_backup_path: "{{ mysql_datadir }}-backups/{{ lookup('pipe', 'date --iso-8601=seconds') }}.sql" | ||
|
||
cve_2023_41914_rpm_url: http://obs.openhpc.community:82/OpenHPC:/2.6.2:/Factory/EL_8/x86_64 | ||
cve_2023_41914_rpms: # see cve_2023_41914_rpm_url | ||
- slurm-ohpc # has to be first as dependency | ||
- slurm-contribs-ohpc | ||
- slurm-devel-ohpc | ||
- slurm-example-configs-ohpc | ||
- slurm-libpmi-ohpc | ||
- slurm-ohpc-slurmrestd | ||
- slurm-openlava-ohpc | ||
- slurm-pam_slurm-ohpc | ||
- slurm-perlapi-ohpc | ||
- slurm-slurmctld-ohpc | ||
- slurm-slurmd-ohpc | ||
- slurm-slurmdbd-ohpc | ||
- slurm-sview-ohpc | ||
- slurm-torque-ohpc | ||
cve_2023_41914_rpm_fix_ver: '22.05.10' | ||
cve_2023_41914_rpm_fix_release: '2.1.ohpc.2.6.2' | ||
_cve_2023_41814_updates: [] | ||
cve_2023_41914_pkglist_path: "{{ appliances_environment_root }}/{{ inventory_hostname }}-cve_2023_41814_updates" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
- name: Validate suitability | ||
include_tasks: validate.yml | ||
when: _cve_2023_41814_installed_pkgs is undefined | ||
|
||
- name: Identify packages to update | ||
set_fact: | ||
_cve_2023_41814_updates: "{{ _cve_2023_41814_updates + [item] }}" | ||
loop: "{{ cve_2023_41914_rpms }}" | ||
when: | ||
- item in ansible_facts.packages | ||
- cve_2023_41914_rpm_fix_ver is version(ansible_facts.packages[item][0].version, '>') | ||
|
||
- name: Write packages to be modified to a file | ||
# allows recovery from failures in subsequent package deletion/rpm install | ||
copy: | ||
dest: "{{ cve_2023_41914_pkglist_path }}" | ||
content: "{{ _cve_2023_41814_updates | to_nice_yaml }}" | ||
when: _cve_2023_41814_updates | length > 0 | ||
delegate_to: localhost | ||
|
||
- name: Read packages to modify | ||
set_fact: | ||
_cve_2023_41814_updates: "{{ lookup('file', cve_2023_41914_pkglist_path) | from_yaml }}" | ||
|
||
- name: Identify architecture | ||
setup: | ||
gather_subset: architecture | ||
|
||
- name: Remove installed packages | ||
dnf: | ||
name: "{{ _cve_2023_41814_updates }}" | ||
state: absent | ||
|
||
- name: Install rpms | ||
dnf: | ||
name: "{{ cve_2023_41914_rpm_url }}/{{ item }}-{{ cve_2023_41914_rpm_fix_ver }}-{{ cve_2023_41914_rpm_fix_release }}.{{ ansible_architecture }}.rpm" | ||
loop: "{{ _cve_2023_41814_updates }}" | ||
register: _cve_2023_41814_rpm_installs | ||
|
||
- name: Reload systemd units | ||
command: systemctl daemon-reload | ||
when: _cve_2023_41814_rpm_installs.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- include_tasks: validate.yml | ||
- include_tasks: pre-upgrade.yml | ||
- include_tasks: install-rpms.yml | ||
- include_tasks: post-upgrade.yml |
Oops, something went wrong.