2022-03-30 11:02:30 +01:00
---
- name : "1.1.2.1 | PATCH | Ensure /tmp is a separate partition"
2022-07-20 17:13:33 +01:00
block :
- name : "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | Absent"
2023-01-09 16:29:47 +00:00
ansible.builtin.debug :
2023-01-13 11:05:25 +00:00
msg : "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
2022-07-20 17:13:33 +01:00
2023-01-19 10:07:14 +00:00
- name : "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | Present"
2023-09-21 15:07:52 +01:00
ansible.builtin.import_tasks :
file : warning_facts.yml
2022-07-20 17:13:33 +01:00
vars :
2023-01-13 11:05:25 +00:00
warn_control_id : '1.1.2.1'
2022-07-20 17:13:33 +01:00
required_mount : '/tmp'
2022-03-30 11:02:30 +01:00
when :
2023-01-13 11:05:25 +00:00
- required_mount not in mount_names
2022-03-30 11:22:30 +01:00
- rhel9cis_rule_1_1_2_1
2022-03-30 11:02:30 +01:00
tags :
- level1-server
- level1-workstation
- audit
- mounts
- rule_1.1.2.1
# via fstab
- name : |
"1.1.2.2 | PATCH | Ensure nodev option set on /tmp partition"
"1.1.2.3 | PATCH | Ensure noexec option set on /tmp partition"
"1.1.2.4 | PATCH | Ensure nosuid option set on /tmp partition"
2023-04-10 13:48:47 -04:00
ansible.posix.mount :
2022-03-30 11:02:30 +01:00
name : /tmp
src : "{{ item.device }}"
fstype : "{{ item.fstype }}"
state : present
2024-11-11 15:43:44 +00:00
opts : "{{ item.options }}{% if ('nodev' not in item.options and rhel9cis_rule_1_1_2_2) %},nodev{% endif %}{% if ('noexec' not in item.options and rhel9cis_rule_1_1_2_3) %},noexec{% endif %}{% if ('nosuid' not in item.options and rhel9cis_rule_1_1_2_4) %},nosuid{% endif %}"
2023-01-13 12:10:18 +00:00
notify : Remount tmp
2023-09-06 08:44:23 +01:00
loop : "{{ ansible_facts.mounts }}"
2022-03-30 11:02:30 +01:00
loop_control :
label : "{{ item.device }}"
when :
- item.mount == "/tmp"
2022-03-30 11:22:30 +01:00
- not rhel9cis_tmp_svc
- rhel9cis_rule_1_1_2_2 or
rhel9cis_rule_1_1_2_3 or
rhel9cis_rule_1_1_2_4
2022-03-30 11:02:30 +01:00
tags :
- level1-server
- level1-workstation
- patch
- mounts
- rule_1.1.2.2
- rule_1.1.2.3
- rule_1.1.2.4
# via systemd
- name : |
"1.1.2.1 | PATCH | Ensure /tmp is configured"
"1.1.2.2 | PATCH | Ensure nodev option set on /tmp partition"
"1.1.2.3 | PATCH | Ensure noexec option set on /tmp partition"
"1.1.2.4 | PATCH | Ensure nosuid option set on /tmp partition"
2023-01-09 16:29:47 +00:00
ansible.builtin.template :
2022-03-30 11:02:30 +01:00
src : etc/systemd/system/tmp.mount.j2
dest : /etc/systemd/system/tmp.mount
owner : root
group : root
2023-09-21 16:25:59 +01:00
mode : '0644'
2023-01-13 12:10:18 +00:00
notify : Systemd restart tmp.mount
2022-03-30 11:02:30 +01:00
when :
2022-03-30 11:22:30 +01:00
- rhel9cis_tmp_svc
- rhel9cis_rule_1_1_2_1 or
rhel9cis_rule_1_1_2_2 or
rhel9cis_rule_1_1_2_3 or
rhel9cis_rule_1_1_2_4
2022-03-30 11:02:30 +01:00
tags :
- level1-server
- level1-workstation
- patch
- mounts
- rule_1.1.2.1
- rule_1.1.2.2
- rule_1.1.2.3
- rule_1.1.2.4