Bug 1417671 - Confined users are unable to get AFS tokens
Summary: Confined users are unable to get AFS tokens
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.3
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1393066
TreeView+ depends on / blocked
 
Reported: 2017-01-30 15:53 UTC by Jonathan Billings
Modified: 2019-03-14 12:30 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1710962 (view as bug list)
Environment:
Last Closed: 2019-03-14 12:30:00 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jonathan Billings 2017-01-30 15:53:25 UTC
Description of problem:
We use the a 3rd party software called OpenAFS (http://www.openafs.org) to access home directories in AFS.  There already is policy added for support of using AFS (so everything is correctly labelled), however, I've discovered that the existing AFS policy needs to be updated to allow SELinux confined users to acquire AFS Tokens.

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-102.el7_3.13.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install openafs software, I build my own repos here:
https://copr.fedorainfracloud.org/coprs/jsbillings/openafs/builds/
Note: this requires a working AFS cell and kerberos realm.
2. Set up a user that is confined and has an AFS account:
semanage login -a -s user_u myuser
3. Try to run 'aklog' as myuser

Actual results:
$ aklog
aklog: can't get afs configuration (afsconf_Open(/etc/openafs))


Expected results:
'aklog' should get AFS tokens from my kerberos tickets.

Additional info:

Here are the Audit logs for when I run aklog (permissive with dontaudit off):

type=AVC msg=audit(1485791285.432:1496): avc:  denied  { open } for  pid=3747 comm="aklog" path="/etc/openafs/ThisCell" dev="dm-0" ino=3408589 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:afs_config_t:s0 tclass=file
type=AVC msg=audit(1485791285.432:1496): avc:  denied  { read } for  pid=3747 comm="aklog" name="ThisCell" dev="dm-0" ino=3408589 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:afs_config_t:s0 tclass=file

type=AVC msg=audit(1485791285.438:1498): avc:  denied  { open } for  pid=3747 comm="aklog" path="/proc/fs/openafs/afs_ioctl" dev="proc" ino=4026532171 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:proc_afs_t:s0 tclass=file
type=AVC msg=audit(1485791285.438:1498): avc:  denied  { read } for  pid=3747 comm="aklog" name="afs_ioctl" dev="proc" ino=4026532171 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:proc_afs_t:s0 tclass=file


I have a working SELinux module that addresses this problem.

$ cat afsusers.te 
policy_module(afsusers,1.0.0)
gen_require(` type staff_t, user_t; ')
gen_require(` type proc_afs_t; ')
read_files_pattern({ staff_t user_t}, proc_afs_t, proc_afs_t)
afs_read_config(staff_t)
afs_read_config(user_t)

Loading the module lets 'aklog' read /etc/openafs/ThisCell as well as /proc/fs/openafs/afs_ioctl.

Comment 1 Jonathan Billings 2017-01-31 21:26:48 UTC
I have to amend my custom module, I forgot to allow staff_sudo_t:

Here is the updated module .te:


policy_module(afsusers,1.0.1)
gen_require(` type staff_t, user_t, staff_sudo_t; ')
gen_require(` type proc_afs_t; ')
read_files_pattern({ staff_t user_t}, proc_afs_t, proc_afs_t)
afs_read_config(staff_t)
afs_read_config(staff_sudo_t)
afs_read_config(user_t)

Comment 3 Lukas Vrabec 2017-10-12 12:17:21 UTC
We're going to close this bug as WONTFIX because

 * of limited capacity of selinux-policy developers
 * the bug is related to EPEL component or 3rd party SW only
 * the bug appears in unsupported configuration 

We believe this bug can be fixed via a local policy module.
For more information please see: 

 * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-troubleshooting-fixing_problems#sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow

If you disagree, please re-open the bug.

Comment 4 Lukas Vrabec 2017-10-12 12:20:36 UTC
We're going to close this bug as WONTFIX because

 * of limited capacity of selinux-policy developers
 * the bug is related to EPEL component or 3rd party SW only
 * the bug appears in unsupported configuration 

We believe this bug can be fixed via a local policy module.
For more information please see: 

 * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-troubleshooting-fixing_problems#sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow

If you disagree, please re-open the bug.

Comment 5 Robbie Harwood 2017-11-13 17:21:47 UTC
Re-opening as per out-of-band conversation with Lukas.

Justification is that the AFS policy hooks are already present, so they should be be fixed.  Thanks!

Comment 8 Lukas Vrabec 2018-09-23 13:09:29 UTC
Milos, 

What about staff_t, could staff_t access afs_config_t ? AFAIK, we should allow it for usersdomains. 

Thanks,
Lukas.

Comment 9 Milos Malik 2018-09-24 06:58:22 UTC
staff_t and user_t can access afs_config_t, but the reporter also mentions staff_sudo_t. See comment#1.

Comment 12 Zdenek Pytela 2019-03-14 12:30:00 UTC
This issue was not selected to be included in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small number of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.


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