Bug 2135793
| Summary: | mkhomedir does not set the permissions of the home directory according to HOME_MODE | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Carlos Santos <casantos> |
| Component: | oddjob | Assignee: | Alexander Bokovoy <abokovoy> |
| Status: | CLOSED ERRATA | QA Contact: | ipa-qe <ipa-qe> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 8.6 | CC: | myusuf, rcritten |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | oddjob-0.34.7-3.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-16 08:38:16 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Fix was provided upstream in https://pagure.io/oddjob/pull-request/18 and merged. version:
oddjob-0.34.7-3.el8.x86_64
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.10.1, py-1.11.0, pluggy-1.0.0 -- /usr/libexec/platform-python
cachedir: /home/cloud-user/.pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-445.el8.x86_64-x86_64-with-redhat-8.8-Ootpa', 'Packages': {'pytest': '3.10.1', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'metadata': '1.11.0', 'html': '1.22.1', 'multihost': '3.0', 'sourceorder': '0.6.0'}}
rootdir: /usr/lib/python3.6/site-packages/ipatests, inifile:
plugins: metadata-1.11.0, html-1.22.1, multihost-3.0, sourceorder-0.6.0
collecting ... collected 11 items
test_integration/test_authselect.py::TestClientInstallation::test_install_client_no_preconfigured_profile PASSED [ 9%]
test_integration/test_authselect.py::TestClientInstallation::test_uninstall_client_no_preconfigured_profile PASSED [ 18%]
test_integration/test_authselect.py::TestClientInstallation::test_install_client_preconfigured_profile PASSED [ 27%]
test_integration/test_authselect.py::TestClientInstallation::test_uninstall_client_preconfigured_profile PASSED [ 36%]
test_integration/test_authselect.py::TestClientInstallation::test_install_client_no_sudo PASSED [ 45%]
test_integration/test_authselect.py::TestClientInstallation::test_uninstall_wrong_sysrestore PASSED [ 54%]
test_integration/test_authselect.py::TestClientInstallation::test_install_client_subid PASSED [ 63%]
test_integration/test_authselect.py::TestServerInstallation::test_install PASSED [ 72%]
test_integration/test_authselect.py::TestServerInstallation::test_uninstall PASSED [ 81%]
test_integration/test_authselect.py::TestServerInstallation::test_install_with_subid PASSED [ 90%]
test_integration/test_authselect.py::TestServerInstallation::test_uninstall_with_subid PASSED [100%]
---------------- generated xml file: /home/cloud-user/junit.xml ----------------
----------- generated html file: file:///home/cloud-user/report.html -----------
========================= 11 passed in 4093.19 seconds =========================
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.10.1, py-1.11.0, pluggy-1.0.0 -- /usr/libexec/platform-python
cachedir: /home/cloud-user/.pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-445.el8.x86_64-x86_64-with-redhat-8.8-Ootpa', 'Packages': {'pytest': '3.10.1', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'metadata': '1.11.0', 'html': '1.22.1', 'multihost': '3.0', 'sourceorder': '0.6.0'}}
rootdir: /usr/lib/python3.6/site-packages/ipatests, inifile:
plugins: metadata-1.11.0, html-1.22.1, multihost-3.0, sourceorder-0.6.0
collecting ... collected 4 items
test_integration/test_installation_client.py::TestInstallClient::test_dns_lookup_kdc_is_true_with_default_enrollment_options PASSED [ 25%]
test_integration/test_installation_client.py::TestInstallClient::test_dns_lookup_kdc_is_true_with_ipa_server_on_cli PASSED [ 50%]
test_integration/test_installation_client.py::TestInstallClient::test_client_install_with_ssh_trust_dns PASSED [ 75%]
test_integration/test_installation_client.py::TestClientInstallBind::test_client_nsupdate PASSED [100%]
---------------- generated xml file: /home/cloud-user/junit.xml ----------------
----------- generated html file: file:///home/cloud-user/report.html -----------
========================= 4 passed in 1214.58 seconds ==========================
Automation passed (sanity check), hence marking the bug verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (oddjob bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:2853 |
Description of problem: Currently the home directory permissions are set by taking the /etc/skel mode and masking it with HOME_MODE: override_umask = 0777 & ~get_umask(&configured_umask, "HOME_MODE"); stat(skel, &sb); /* performed by nftw() */ oddjob_selinux_mkdir(newpath, sb->st_mode & ~override_umask, uid, gid); The problem is that when HOME_MODE is more permissive than /etc/skel, the masking will not produce the desired result, e.g. skel_mode = 0755 HOME_MODE = 0775 override_umask = 0777 & ~HOME_MODE /* 0002 */ mode = skel_mode & ~override_umask /* 0755 & 0775 = 0755 */ In order to fix the problem, mkhomedir should use 0777 & ~override_umask for the top home directory. Version-Release number of selected component (if applicable): - oddjob-0.34.7-1.el8.x86_64 - oddjob-mkhomedir-0.34.7-1.el8.x86_64 How reproducible: Always Steps to Reproduce: 1. Ensure that HOME_MODE has the required values in /etc/login.defs: HOME_MODE 0775 2. Ensure that /etc/skel has the default permissions # ls -ld /etc/skel drwxr-xr-x. 2 root root 76 Oct 4 09:38 /etc/skel 3. Create an test user, without creating the home directory # useradd --no-create-home test14 If the user already exists, just remove the home directory # rm -rf ~test14 4. Simulate what oddjobd would do the first time the user logs in # echo test14 | /usr/libexec/oddjob/mkhomedir The permissions of the test14 home directory should be rwxrwxr-x but are rwxr-xr-x # ls -ld ~test14 drwxr-xr-x. 2 test14 test14 76 Oct 18 09:35 /home/test14 5. Remove the user home directory # rm -rf ~test14 6. Ensure that PAM will use mkhomedir # authselect select sssd --force # authselect enable-feature with-mkhomedir # authselect enable-feature with-sudo # systemctl enable --now oddjobd.service 7. Log in as test14. The permissions of the test14 home directory should be rwxrwxr-x but are rwxr-xr-x # su -l test14 -c 'ls -ld $HOME' drwxr-xr-x. 2 test14 test14 76 Oct 18 09:43 /home/test14 Actual results: The permissions of the home directory depend on the /etc/skel permissions. Expected results: The permissions of the home directory should be what is set in HOME_MODE.