Skip to content

Commit 7e6ca37

Browse files
authored
Merge pull request #185 from whitehat237/devel
Adds default variables and task to modify getent user enumeration com…
2 parents 7a7fafa + bb7578c commit 7e6ca37

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

defaults/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,17 @@ rhel8stig_smartcard: false
477477
# Configure your smartcard driver
478478
rhel8stig_smartcarddriver: cackey
479479

480+
#Whether or not system uses remote automounted home directories via autofs
481+
rhel8stig_autofs_remote_home_dirs: false
482+
483+
#The local mount point used by autofs to mount remote home directory to. This location will be excluded during getent user enumeration, if rhel8stig_autofs_remote_home_dirs is true
484+
rhel8stig_auto_mount_home_dirs_local_mount_point: "/home/"
485+
486+
#The default shell command to gather local interactive user directories
487+
## NOTE: You will need to adjust the UID range in parenthesis below.
488+
## ALSO NOTE: We weed out any user with a home dir not in standard locations because interactive users shouldn't have those paths as a home dir. Add or removed directory paths as needed below.
489+
local_interactive_user_dir_command: "getent passwd { {{ rhel8stig_int_gid }}..65535} | cut -d: -f6 | sort -u | grep -v '/var/' | grep -v '/nonexistent/*' | grep -v '/run/*'"
490+
480491
# IPv6 required
481492
rhel8stig_ipv6_required: true
482493

tasks/prelim.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,26 @@
116116
- RHEL-08-010750
117117
- RHEL-08-020320
118118

119-
## NOTE: You will need to adjust the UID range in parenthases below.
120-
## ALSO NOTE: We weed out any user with a home dir not in standard locations because interactive users shouldn't have those paths as a home dir. Add or removed directory paths as needed below.
119+
- name: "PRELIM | RHEL-08-010690 Ensure user enumeration command is modified when autofs remote home directories are in use"
120+
block:
121+
- name: Ensure that rhel8stig_auto_mount_home_dirs_local_mount_point is defined and not length zero
122+
assert:
123+
that:
124+
- rhel8stig_auto_mount_home_dirs_local_mount_point is defined
125+
- rhel8stig_auto_mount_home_dirs_local_mount_point | length > 0
126+
127+
- name: Modify local_interactive_user_dir_command to exclude remote automounted home directories
128+
set_fact:
129+
local_interactive_user_dir_command: "{{ local_interactive_user_dir_command }} | grep -v '{{ rhel8stig_auto_mount_home_dirs_local_mount_point }}"
130+
131+
when:
132+
- rhel8stig_autofs_remote_home_dirs
133+
tags:
134+
- RHEL-08-010690
135+
- complexity-high
136+
121137
- name: "PRELIM | RHEL-08-010690 | Gather local interactive user directories"
122-
# shell: "getent passwd { {{ rhel8stig_int_gid }}..65535} | cut -d: -f6 | sort -u | grep -v '/var/' | grep -v '/nonexistent/*' | grep -v '/run/*'"
123-
shell: "getent passwd {% raw %}{{% endraw %}{{ rhel8stig_int_gid }}..24339{% raw %}}{% endraw %} | cut -d: -f6 | sort -u | grep -v '/var/' | grep -v '/nonexistent/*' | grep -v '/run/*'"
138+
shell: "{{ local_interactive_user_dir_command }}"
124139
register: rhel_08_010690_getent
125140
changed_when: false
126141
failed_when: false

0 commit comments

Comments
 (0)