Hide Forgot
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
Karel, you will need to use "home_root_t" label, which is used for /home directory.
(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 ?
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?
Yes, this is a good question. I would say this is more a test issue.
(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 ...?
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.
I added a fix to Fedora16.
Fixed in selinux-policy-3.7.19-136.el6
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