Bug 1238165

Summary: Add SELinux policy for IPA to allow calling out oddjobd-activated services
Product: [Fedora] Fedora Reporter: Alexander Bokovoy <abokovoy>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: dominick.grift, dwalsh, lvrabec, mgrepl, mmalik, plautrba, pvrabec, qe-baseos-security, ssekidde
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1238163 Environment:
Last Closed: 2016-12-20 13:52:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexander Bokovoy 2015-07-01 10:28:22 UTC
+++ This bug was initially created as a clone of Bug #1238163 +++

(this is the original message explaining design and use case, mgrepl@ already has policy in works)

I'm implementing a feature in FreeIPA for which I'll need new SELinux
policy and I'd like to hear your suggestions how to design it.

Sorry in advance for long prelude, it needs to be said to establish the
context.

For FreeIPA 4.2 we are adding support to establish one-way trust to
Active Directory. As a consequence of this, we need to change how
certain operations against AD LDAP are performed. Right now we are
using feature of cross-realm Kerberos trust: we authenticate as
HTTP/ipa.master from within Apache process and then talk to
ldap/ad.dc or to cifs/ad.dc services in AD.

With one-way trust we cannot use this approach anymore because there is
no cross-realm Kerberos trust from IPA to AD, only the other way around.
Instead, there is an object in AD LDAP which represents IPA and we have
to authenticate as this object.

Access to this object is highly regulated (by us) because possession of
the trust domain object (TDO) credentials impersonates whole trust link.
Thus, we want to avoid authenticating as TDO within Apache process.

To achieve this I've implemented a scheme similar to oddjob-mkhomedir,
by providing a helper script which is executed by oddjobd on request
from Apache:

Apache process sends d-bus request to oddjobd daemon. Oddjobd daemon
executes an IPA helper. IPA helper accesses /etc/samba/samba.keytab and
authenticates as cifs/ipa.master. It then fetches TDO
credentials from IPA LDAP and authenticates with them to AD DC. Once
operation is performed, it connects again to IPA LDAP and updates it.

Now, there are several moving parts here:

 1. /etc/samba/samba.keytab is root:root, 0600, unconfined_u:object_r:samba_etc_t:s0
    It is created by /usr/sbin/ipa-adtrust-install

 2. /var/lib/sss/keytabs/ad.test.keytab is root:root, 0600, unconfined_u:object_r:sssd_var_lib_t:s0
    It can be created by IPA helper or by SSSD, whoever runs into need
    of the keytab first. The name is dependent on the AD forest root
    name (ad.test in my case).

 3. /usr/libexec/ipa/com.redhat.idm.trust-fetch-domains is root:root, 0755, uknown label so far.
    It is the IPA helper oddjobd daemon will be calling in response to Apache request.
    The helper is written in Python.

 4. /var/run/ipa/krb5cc_oddjob_trusts{,_fetch} -- credential caches used by the helper.
    They are root:root, 0600, unconfined_u:object_r:ipa_var_run_t:s0

 5. oddjobd daemon runs under system_u:system_r:oddjob_t:s0-s0:c0.c1023 context.


Could you please add SELinux policy that would allow the IPA
helper (3) to be executed by oddjobd, read from (1), read/write to files (2) and (4),
and communicate with LDAP server locally and AD DC remotely.

Comment 1 Jan Kurik 2015-07-15 13:52:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 2 Fedora Admin XMLRPC Client 2016-09-27 14:56:37 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Fedora End Of Life 2016-11-24 11:58:51 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Fedora End Of Life 2016-12-20 13:52:38 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.