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 1424728 - SELinux prevents cyrus imapd from using gssproxy
Summary: SELinux prevents cyrus imapd from using gssproxy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-18 20:55 UTC by James Ralston
Modified: 2017-08-01 15:22 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 15:22:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1861 0 normal SHIPPED_LIVE selinux-policy bug fix update 2017-08-01 17:50:24 UTC

Description James Ralston 2017-02-18 20:55:05 UTC
Description of problem:

In order to permit GSSAPI authentication, Cyrus imapd needs access to the imap/hostname Kerberos principal in the /etc/krb5.keytab file. On RHEL7 systems, the preferred way to do this is to configure the application to use the gssproxy interposer, described here:

https://fedorahosted.org/gss-proxy/wiki/Apache

E.g., in /etc/gssproxy/gssproxy.conf:

[service/imap]
  mechs = krb5
  cred_store = keytab:/etc/krb5.keytab
  cred_store = ccache:/var/lib/gssproxy/clients/krb5cc_%U
  euid = 76
  krb5_principal = imap

Add create /etc/systemd/system/cyrus-imapd.service as follows:

.include /usr/lib/systemd/system/cyrus-imapd.service
[Service]
Environment=GSS_USE_PROXY=1

In order to speak to the gssproxy interposer, imapd needs access to /var/lib/gssproxy/default.sock. But unfortunately, SELinux blocks this access:

----
type=SYSCALL msg=audit(2017-02-18 15:43:24.276:1915) : arch=x86_64 syscall=connect success=no exit=EACCES(Permission denied) a0=0x13 a1=0x7fff9db59310 a2=0x6e a3=0x1e items=0 ppid=29710 pid=30650 auid=unset uid=cyrus gid=mail euid=cyrus suid=cyrus fsuid=cyrus egid=mail sgid=mail fsgid=mail tty=(none) ses=unset comm=imapd exe=/usr/lib/cyrus-imapd/imapd subj=system_u:system_r:cyrus_t:s0 key=(null) 
type=AVC msg=audit(2017-02-18 15:43:24.276:1915) : avc:  denied  { search } for  pid=30650 comm=imapd name=gssproxy dev="dm-5" ino=4202830 scontext=system_u:system_r:cyrus_t:s0 tcontext=system_u:object_r:gssproxy_var_lib_t:s0 tclass=dir 
----
type=SYSCALL msg=audit(2017-02-18 15:43:24.274:1914) : arch=x86_64 syscall=connect success=no exit=EACCES(Permission denied) a0=0x13 a1=0x7fff9db59650 a2=0x6e a3=0x1e items=0 ppid=29710 pid=30650 auid=unset uid=cyrus gid=mail euid=cyrus suid=cyrus fsuid=cyrus egid=mail sgid=mail fsgid=mail tty=(none) ses=unset comm=imapd exe=/usr/lib/cyrus-imapd/imapd subj=system_u:system_r:cyrus_t:s0 key=(null) 
type=AVC msg=audit(2017-02-18 15:43:24.274:1914) : avc:  denied  { search } for  pid=30650 comm=imapd name=gssproxy dev="dm-5" ino=4202830 scontext=system_u:system_r:cyrus_t:s0 tcontext=system_u:object_r:gssproxy_var_lib_t:s0 tclass=dir 

As a result, GSSAPI authentication fails.

If I make the cyrus_t type permissive by running "semanage permissive -a cyrus_t", then GSSAPI authentication succeeds, generating these avc messages:

----
type=SYSCALL msg=audit(2017-02-18 15:49:44.783:1917) : arch=x86_64 syscall=connect success=yes exit=0 a0=0x13 a1=0x7ffcaeac8540 a2=0x6e a3=0x21 items=0 ppid=29710 pid=31312 auid=unset uid=cyrus gid=mail euid=cyrus suid=cyrus fsuid=cyrus egid=mail sgid=mail fsgid=mail tty=(none) ses=unset comm=imapd exe=/usr/lib/cyrus-imapd/imapd subj=system_u:system_r:cyrus_t:s0 key=(null) 
type=AVC msg=audit(2017-02-18 15:49:44.783:1917) : avc:  denied  { connectto } for  pid=31312 comm=imapd path=/var/lib/gssproxy/default.sock scontext=system_u:system_r:cyrus_t:s0 tcontext=system_u:system_r:gssproxy_t:s0 tclass=unix_stream_socket 
type=AVC msg=audit(2017-02-18 15:49:44.783:1917) : avc:  denied  { write } for  pid=31312 comm=imapd name=default.sock dev="dm-5" ino=4202816 scontext=system_u:system_r:cyrus_t:s0 tcontext=system_u:object_r:gssproxy_var_lib_t:s0 tclass=sock_file 

Please update the SELinux targeted policy to permit the above access, so that we can enable GSSAPI authentication without needing to make the cyrus_t type permissive.

Version-Release number of selected component (if applicable):

0:cyrus-imapd-2.4.17-8.el7_1.x86_64
0:cyrus-imapd-utils-2.4.17-8.el7_1.x86_64
0:cyrus-sasl-2.1.26-20.el7_2.x86_64
0:cyrus-sasl-gssapi-2.1.26-20.el7_2.x86_64
0:cyrus-sasl-lib-2.1.26-20.el7_2.x86_64
0:cyrus-sasl-md5-2.1.26-20.el7_2.x86_64
0:cyrus-sasl-plain-2.1.26-20.el7_2.x86_64
0:gssproxy-0.4.1-13.el7.x86_64
0:libselinux-2.5-6.el7.x86_64
0:libselinux-devel-2.5-6.el7.x86_64
0:libselinux-python-2.5-6.el7.x86_64
0:libselinux-ruby-2.5-6.el7.x86_64
0:libselinux-utils-2.5-6.el7.x86_64
0:selinux-policy-3.13.1-102.el7_3.13.noarch
0:selinux-policy-targeted-3.13.1-102.el7_3.13.noarch

Comment 4 errata-xmlrpc 2017-08-01 15:22:43 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.

https://access.redhat.com/errata/RHBA-2017:1861


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