RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 973647 - missing error message when useradd cannot create user with homedir in location without default selinux context
Summary: missing error message when useradd cannot create user with homedir in locatio...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: shadow-utils
Version: 7.0
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Michal Trunecka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-12 12:32 UTC by Michal Trunecka
Modified: 2014-09-30 23:35 UTC (History)
4 users (show)

Fixed In Version: shadow-utils-4.1.5.1-6.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 13:27:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Michal Trunecka 2013-06-12 12:32:15 UTC
Description of problem:
For example /mnt/qa/scratch has not a default selinux context:

# matchpathcon /mnt/qa/scratch
/mnt/qa/scratch	<<none>>

Creating user with homedir in there fails:

# useradd -m -d /mnt/qa/scratch/user19376 user19376
# echo $?
12

The returned 12 means the homedir couldn't be created. It works fine in permissive, no AVCs related to this issue. (even with disabled dontaudit rules)

In useradd.c, there is the following code in create_home function:

> 1762 if (set_selinux_file_context (user_home, NULL) != 0) {
> 1763     fail_exit (E_HOMEDIR);
> 1764 }

And because no orig.context is passed in the second argument and at the same time matchpathcon returns no default context, the set_selinux_file_context function failes.
From lib/selinux.c (in shadow-utils srcrpm):

> 53 int set_selinux_file_context (const char *dst_name, const char *orig_name)
...
> 62         if (selinux_enabled) {
> 63                 /* Get the default security context for this file */
> 64                 if (matchpathcon (dst_name, 0, &scontext) < 0) {
> 65                         /* We could not get the default, copy the original */
> 66                         if (orig_name == NULL)
> 67                                 goto error;



Version-Release number of selected component (if applicable):
shadow-utils-4.1.5.1-5.el7.x86_64

Comment 1 Tomas Mraz 2013-06-12 12:39:01 UTC
I don't think this is a bug. Just specify some default context adequate for the home directory parent with semanage fcontext -a ...

Or disable selinux if you do not want to work with it properly - but I strictly do not recommend that.

Comment 2 Michal Trunecka 2013-06-12 12:51:43 UTC
If not anything else, I definitely think that not logging any message about the reason of not creating home dir is a bug.

Comment 6 Ludek Smid 2014-06-13 13:27:33 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.