mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2026-03-25 22:37:11 +00:00
Interactive user discovery improve thanks to @polski-g
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
4357f132a9
commit
cc48a0d0b5
5 changed files with 19 additions and 18 deletions
|
|
@ -23,18 +23,16 @@
|
|||
- name: "PRELIM | AUDIT | Interactive Users"
|
||||
tags: always
|
||||
ansible.builtin.shell: >
|
||||
grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '(!index($7, "sbin/nologin") && $7 != "/bin/nologin" && $7 != "/bin/false" && $7 != "/dev/null") { print $1 }'
|
||||
grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '(!index($7, "sbin/nologin") && $7 != "/bin/nologin" && $7 != "/bin/false" && $7 != "/dev/null") { print $1":"$3":"$6 }'
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: prelim_interactive_usernames
|
||||
register: prelim_interactive_users_raw
|
||||
|
||||
- name: "PRELIM | AUDIT | Interactive User accounts home directories"
|
||||
- name: "PRELIM | AUDIT | Interactive Users (reformat)"
|
||||
tags: always
|
||||
ansible.builtin.shell: >
|
||||
grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '(!index($7, "sbin/nologin") && $7 != "/bin/nologin" && $7 != "/bin/false") { print $6 }'
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: prelim_interactive_users_home
|
||||
ansible.builtin.set_fact:
|
||||
prelim_interactive_usernames: "{{ prelim_interactive_users | default([]) + [dict([('username', item.split(':')[0]), ('uid', item.split(':')[1]), ('home', item.split(':')[2])])] }}"
|
||||
loop: "{{ prelim_interactive_users_raw.stdout_lines }}"
|
||||
|
||||
- name: "PRELIM | AUDIT | Interactive UIDs"
|
||||
tags: always
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue