Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule file_permission_user_init_files_root fails to remediate #13100

Closed
Mab879 opened this issue Feb 25, 2025 · 3 comments · Fixed by #13134
Closed

Rule file_permission_user_init_files_root fails to remediate #13100

Mab879 opened this issue Feb 25, 2025 · 3 comments · Fixed by #13134
Assignees
Labels
productization-issue Issue found in upstream stabilization process. RHEL Red Hat Enterprise Linux product related. triaged

Comments

@Mab879
Copy link
Member

Mab879 commented Feb 25, 2025

Description of problem:

After running the remediation for file_permission_user_init_files_root there are still files with incorrect permissions.

Automatus tests seem to pass, so this might be issue in the daily test environment.

SCAP Security Guide Version:

a2501c9

Operating System Version:

RHEL 8.10, RHEL 9.6, and RHEL 10.0.

Actual Results:

Rule fails after remediation.

Expected Results:

Rule passes after remediation.

Additional Information/Debugging Steps:

None.

@Mab879 Mab879 added productization-issue Issue found in upstream stabilization process. RHEL Red Hat Enterprise Linux product related. labels Feb 25, 2025
Mab879 added a commit to Mab879/contest that referenced this issue Feb 25, 2025
@comps
Copy link
Collaborator

comps commented Feb 25, 2025

This is due to

/root/.bash_profile
/root/.bashrc
/root/.cshrc
/root/.tcshrc
/root/.bash_logout

being scanned with 0644 mode.

These come from /usr/lib/tmpfiles.d/rootfiles.conf:

# create initial /root directories shell content
C /root/.bash_logout   644 root root - /usr/share/rootfiles/.bash_logout
C /root/.bash_profile  644 root root - /usr/share/rootfiles/.bash_profile
C /root/.bashrc        644 root root - /usr/share/rootfiles/.bashrc
C /root/.cshrc         644 root root - /usr/share/rootfiles/.cshrc
C /root/.tcshrc        644 root root - /usr/share/rootfiles/.tcshrc

provided by the rootfiles RPM package.

So I think the proper fix here is to ensure the package is not installed + if the files exist at the time of remediation, their mode is changed.

The reason we see them during productization testing is that we reboot the host after remediation, which lets systemd tmpfiles.d re-set the mode.

@Mab879
Copy link
Member Author

Mab879 commented Feb 27, 2025

Another solution is dropping in our own file in /etc/tmpfiles.d/rootconf.conf and setting the right permissions. If we remove the package we also remove the default .bashrc and friends which might prevent things from umask from being load globally.

@Mab879 Mab879 closed this as completed Feb 27, 2025
@Mab879 Mab879 reopened this Feb 27, 2025
@comps
Copy link
Collaborator

comps commented Feb 27, 2025

If we remove the package we also remove the default .bashrc

Not strictly as they are defined as

%ghost /root/.bash_logout
%ghost /root/.bash_profile
%ghost /root/.bashrc
%ghost /root/.cshrc
%ghost /root/.tcshrc

but for remediation types like oscap-generated kickstart, excluding it might cause issues.

So /etc/ override might be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
productization-issue Issue found in upstream stabilization process. RHEL Red Hat Enterprise Linux product related. triaged
Projects
None yet
2 participants