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 767579 - selinux prevents quota from setting quota on homedirs
Summary: selinux prevents quota from setting quota on homedirs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.2
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-14 12:28 UTC by Karel Volný
Modified: 2012-06-20 12:29 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-3.7.19-136.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 12:29:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0780 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2012-06-19 20:34:59 UTC

Description Karel Volný 2011-12-14 12:28:26 UTC
Description of problem:
Trying to set up quota on a filesystem which is mounted as an user home directory fails due to selinux denial for the command "quotacheck -c /user/home/directory"

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.7.19-126.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. run the test /CoreOS/quota/Regression/bz77871-grace-period-not-shown
  
Actual results:
see https://beaker.engineering.redhat.com/tasks/executed?task=/CoreOS/quota/Regression/bz77871-grace-period-not-shown&job_id=170480

ls -dlZ /tmp/tmp.QCHj5nec7c/bz77871:
drwxr-xr-x. bz77871 bz77871 unconfined_u:object_r:user_home_dir_t:s0 /tmp/tmp.QCHj5nec7c/bz77871
quotacheck: Cannot create new quotafile /tmp/tmp.QCHj5nec7c/bz77871/aquota.user.new: Permission denied
quotacheck: Cannot initialize IO on new quotafile: Permission denied

type=SYSCALL msg=audit(1323811395.282:1089019): arch=c000003e syscall=2 success=no exit=-13 a0=7fff2d5d2030 a1=c2 a2=180 a3=7fff2d5d1da0 items=0 ppid=30595 pid=30889 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="quotacheck" exe="/sbin/quotacheck" subj=unconfined_u:unconfined_r:quota_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1323811395.282:1089019): avc:  denied  { write } for  pid=30889 comm="quotacheck" name="/" dev=loop0 ino=2 scontext=unconfined_u:unconfined_r:quota_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir


Expected results:
no errors/denials, aquota.user created properly

Additional info:
Note that "unconfined_u:object_r:user_home_dir_t:s0" corresponds to the contexts of normal user directories in /home

Comment 1 Miroslav Grepl 2011-12-14 13:33:34 UTC
Karel,
you will need to use "home_root_t" label, which is used for /home directory.

Comment 2 Karel Volný 2011-12-16 15:07:34 UTC
(In reply to comment #1)
> Karel,
> you will need to use "home_root_t" label, which is used for /home directory.

okay, changing 
unconfined_u:object_r:user_home_dir_t:s0 to unconfined_u:object_r:home_root_t:s0 seems to enable quota to do its job

however, this creates quite unpleasant inconsistency, as for example restorecon tends to change home_root_t to user_home_dir_t

could we have this at least as RFE to enable quota to operate both on home_root_t AND user_home_dir_t ?

Comment 3 Daniel Walsh 2011-12-17 12:42:30 UTC
Sure,  But Karel would an admin actually setup a users homedir with a quota.group file actually  in the users homedir? Or is this just a test issue?

Comment 4 Miroslav Grepl 2011-12-19 07:33:05 UTC
Yes, this is a good question. I would say this is more a test issue.

Comment 5 Karel Volný 2011-12-19 11:43:48 UTC
(In reply to comment #3)
> Sure,  But Karel would an admin actually setup a users homedir with a
> quota.group file actually  in the users homedir? Or is this just a test issue?

well, I don't have the statistical data ...

the problem is that quota works by default per filesystem, and it puts its data (i.e. quota.user/quota.group) into fileystem's root

while the typical usage is to have /home mounted on one filesystem and users' directories as subdirectories on that filesystem, I think having users' directories as separate mounts makes sense too (and using quota on them, as quota provides better control than just "I won't write the file as you are out of free blocks on this harddrive")

CCing ppisar, the quota maintainer, if he can correct me/add some info ...?

Comment 6 Petr Pisar 2011-12-19 12:27:00 UTC
I have not so much to add. quota tools control quotas that are maintained per file system. Thus administrator expects the tools can work on any (real) mount point. Not only on /home. Otherwise you tell administrator that quotas are supported on /home only which is hard constraint. I think SELinux should allow quota tools to write into file_t.

Comment 7 Miroslav Grepl 2011-12-20 13:45:51 UTC
I added a fix to Fedora16.

Comment 8 Miroslav Grepl 2012-01-26 10:20:06 UTC
Fixed in selinux-policy-3.7.19-136.el6

Comment 11 errata-xmlrpc 2012-06-20 12:29:42 UTC
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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0780.html


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