Skip to content

Add rule accounts_user_interactive_home_directory_on_separate_partition#14370

Merged
Mab879 merged 3 commits intoComplianceAsCode:masterfrom
vojtapolasek:add_rule_home_dirs_on_separate_partition
Feb 12, 2026
Merged

Add rule accounts_user_interactive_home_directory_on_separate_partition#14370
Mab879 merged 3 commits intoComplianceAsCode:masterfrom
vojtapolasek:add_rule_home_dirs_on_separate_partition

Conversation

@vojtapolasek
Copy link
Collaborator

Description:

  • Add new rule accounts_user_interactive_home_directory_on_separate_partition that checks whether all interactive user home directories reside on a file system partition separate from the root (/) partition. The rule has medium severity, targets rhel8 (CCE-86459-5), and includes a custom OVAL check. No remediation is provided (check-only rule). The rule is added to the operating-system component and applies to the machine platform.
  • The OVAL check identifies interactive users (UID >= 1000, login shell, excluding nobody/nfsnobody) from /etc/passwd and verifies each home directory matches a non-root mount point.
  • Includes 4 test scenarios: home on root partition (fail), home on separate partition (pass), mixed users with one on root (fail), and no interactive users (pass).
  • LLM was used during creation of this rule

Rationale:

  • Ensuring interactive user home directories are on a separate partition from root prevents users from filling the root partition, which could cause system instability or denial of service. This also enables administrators to apply restrictive mount options (noexec, nosuid, nodev) to the user home partition.
  • Required by SRG-OS-000480-GPOS-00227.

Review Hints:

  • This is a single-commit PR that can be reviewed as a whole.
  • The rule is non-templated with a custom OVAL check — review the regex in oval/shared.xml carefully, particularly the /etc/passwd pattern match and the mount point regex construction.
  • Two of the test scenarios use # remediation = none since this is a check-only rule with no automated fix.
  • Build with: ./build_product --datastream-only rhel8
  • Test with:
    ./tests/automatus.py rule --libvirt qemu:///system rhel8 --datastream build/ssg-rhel8-ds.xml accounts_user_interactive_home_directory_on_separate_partition
    
  • Key files to review:
    • linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_on_separate_partition/rule.yml
    • linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_on_separate_partition/oval/shared.xml
    • Test scenarios in tests/ subdirectory

@vojtapolasek vojtapolasek added this to the 0.1.80 milestone Feb 9, 2026
@vojtapolasek vojtapolasek added the New Rule Issues or pull requests related to new Rules. label Feb 9, 2026
@vojtapolasek vojtapolasek added the RHEL8 Red Hat Enterprise Linux 8 product related. label Feb 9, 2026
@Mab879 Mab879 self-assigned this Feb 9, 2026
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide the STIG ref that you using for this?

I will note that this PR doesn't seem to add this rule to any profiles. While this might be intentional, the reason why I am bring this up is the review instructions seem to assume that this PR added it.

<ind:textfilecontent54_object id="object_{{{ rule_id }}}_interactive_users" version="1">
<ind:filepath>/etc/passwd</ind:filepath>
<ind:pattern operation="pattern match"
>^(?:(?!nobody|nfsnobody)[^:]*):(?:[^:]*:)[1-9]\d{3,}:(?:[^:]*:){2}([^:]+):(?!(?:/usr)?/sbin/nologin$|/bin/false$)[^:]*$</ind:pattern>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include /usr/bin/false?

\d{3,} is doing some assuming of the min uid. This might be fine, but something to think about.


. $SHARED/partition.sh

awk -F':' '{if ($3>={{{ uid_min }}} && $3!= {{{ nobody_uid }}}) print $1}' /etc/passwd \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use bash_remove_interactive_users_from_passwd_by_uid()?

@vojtapolasek
Copy link
Collaborator Author

/packit retest-failed

@vojtapolasek
Copy link
Collaborator Author

Regarding the STIG ref, I did not include it here because after merging this PR, I wanted to add the new control into the PR #14375 . The PR updates the STIG references. I think that if I would add the STIG control in the PR which adds the rule, it would cause tests to fail.

@vojtapolasek
Copy link
Collaborator Author

I updated the OVAL to skip users which have '.nologin.' as a shell. I also use macro in test scenarios now.

@Mab879
Copy link
Member

Mab879 commented Feb 10, 2026

/packit build

@Mab879
Copy link
Member

Mab879 commented Feb 10, 2026

/retest-required

1 similar comment
@Mab879
Copy link
Member

Mab879 commented Feb 11, 2026

/retest-required

@vojtapolasek vojtapolasek force-pushed the add_rule_home_dirs_on_separate_partition branch from 5faa8ad to 1ad1c01 Compare February 11, 2026 15:34
@vojtapolasek
Copy link
Collaborator Author

/packit retest-all

@vojtapolasek vojtapolasek force-pushed the add_rule_home_dirs_on_separate_partition branch from 1ad1c01 to 51e35d7 Compare February 12, 2026 10:59
@Mab879
Copy link
Member

Mab879 commented Feb 12, 2026

Something is off, 9babdbf shouldn't be on this PR.

@vojtapolasek
Copy link
Collaborator Author

/packit retest-failed

Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the commits on this branch.

@vojtapolasek vojtapolasek force-pushed the add_rule_home_dirs_on_separate_partition branch from 51e35d7 to 663217e Compare February 12, 2026 14:03
@Mab879 Mab879 merged commit 9033391 into ComplianceAsCode:master Feb 12, 2026
139 of 143 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Rule Issues or pull requests related to new Rules. RHEL8 Red Hat Enterprise Linux 8 product related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants