2022-01-07 09:06:18 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
- name: "PRELIM | 5.5.2 | 6.2.7 | 6.2.8 | 6.2.20 | Parse /etc/passwd"
|
2024-12-04 11:45:13 +00:00
|
|
|
tags: always
|
2022-01-07 09:06:18 +00:00
|
|
|
block:
|
2024-07-19 17:01:23 +01:00
|
|
|
- name: "PRELIM | 5.5.2 | 6.2.7 | 6.2.8 | 6.2.20 | Parse /etc/passwd"
|
2024-12-11 11:20:19 +00:00
|
|
|
ansible.builtin.command: cat /etc/passwd
|
2024-07-19 17:01:23 +01:00
|
|
|
changed_when: false
|
|
|
|
|
check_mode: false
|
2024-12-11 12:06:45 +00:00
|
|
|
register: prelim_passwd_file_audit
|
2022-01-07 09:06:18 +00:00
|
|
|
|
2024-07-19 17:01:23 +01:00
|
|
|
- name: "PRELIM | 5.5.2 | 6.2.7 | 6.2.8 | 6.2.20 | Split passwd entries"
|
|
|
|
|
ansible.builtin.set_fact:
|
2024-12-11 12:06:45 +00:00
|
|
|
rhel9cis_passwd: "{{ prelim_passwd_file_audit.stdout_lines | map('regex_replace', ld_passwd_regex, ld_passwd_yaml) | map('from_yaml') | list }}"
|
|
|
|
|
loop: "{{ prelim_passwd_file_audit.stdout_lines }}"
|
2024-07-19 17:01:23 +01:00
|
|
|
vars:
|
|
|
|
|
ld_passwd_regex: >-
|
|
|
|
|
^(?P<id>[^:]*):(?P<password>[^:]*):(?P<uid>[^:]*):(?P<gid>[^:]*):(?P<gecos>[^:]*):(?P<dir>[^:]*):(?P<shell>[^:]*)
|
2024-08-09 13:47:38 +01:00
|
|
|
ld_passwd_yaml: | # pragma: allowlist secret
|
2024-07-19 17:01:23 +01:00
|
|
|
id: >-4
|
|
|
|
|
\g<id>
|
|
|
|
|
password: >-4
|
|
|
|
|
\g<password>
|
|
|
|
|
uid: \g<uid>
|
|
|
|
|
gid: \g<gid>
|
|
|
|
|
gecos: >-4
|
|
|
|
|
\g<gecos>
|
|
|
|
|
dir: >-4
|
|
|
|
|
\g<dir>
|
|
|
|
|
shell: >-4
|
|
|
|
|
\g<shell>
|