From 42dd1628a1211363c860917e474ecc5b9c1fdb84 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Thu, 2 Jul 2020 15:50:00 +0300
Subject: [PATCH] selinux: allow oddjobd to set up ipa_helper_t context for
execution
On Fedora 32+ and RHEL 8.3.0+ execution of ipa_helper_t context requires
SELinux policy permission to use 'noatsecure'. This comes most likely
from execve() setup by glibc.
Add SELinux interface ipa_helper_noatsecure() that can be called by
oddjob's SELinux policy definition.
In addition, if ipa_helper_t runs ipa-getkeytab, libkrb5 will attempt to
access SELinux configuration and produce AVC for that. Allow reading
general userspace SELinux configuration.
Fixes: https://pagure.io/freeipa/issue/8395
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
---
selinux/ipa.if | 18 ++++++++++++++++++
selinux/ipa.te | 1 +
2 files changed, 19 insertions(+)
diff --git a/selinux/ipa.if b/selinux/ipa.if
index ea971b8fa..783db8b78 100644
--- a/selinux/ipa.if
+++ b/selinux/ipa.if
@@ -419,3 +419,21 @@ ifndef(`dirsrv_systemctl',`
ps_process_pattern($1, dirsrv_t)
')
')
+
+
+########################################
+## <summary>
+## Allow ipa_helper noatsecure
+## </summary>
+## <param name="domain">
+## <summary>
+## Domain allowed access.
+## </summary>
+## </param>
+#
+interface(`ipa_helper_noatsecure',`
+ gen_require(`
+ type ipa_helper_t;
+ ')
+ allow $1 ipa_helper_t:process { noatsecure };
+')
diff --git a/selinux/ipa.te b/selinux/ipa.te
index 587e5e585..383979094 100644
--- a/selinux/ipa.te
+++ b/selinux/ipa.te
@@ -115,6 +115,7 @@ optional_policy(`
allow ipa_helper_t self:capability { net_admin dac_read_search dac_override chown };
+seutil_read_config(ipa_helper_t);
#kernel bug
dontaudit ipa_helper_t self:capability2 block_suspend;
--
2.26.2
From 0d70addbbf2a99e7398a518bc98d5fe109469bb5 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Fri, 3 Jul 2020 17:20:49 +0300
Subject: [PATCH] selinux: support running ipa-custodia with PrivateTmp=yes
Related: https://pagure.io/freeipa/issue/8395
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
---
selinux/ipa.te | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/selinux/ipa.te b/selinux/ipa.te
index 383979094..a3381217a 100644
--- a/selinux/ipa.te
+++ b/selinux/ipa.te
@@ -390,3 +390,7 @@ optional_policy(`
sssd_search_lib(ipa_custodia_t)
sssd_stream_connect(ipa_custodia_t)
')
+
+optional_policy(`
+ systemd_private_tmp(ipa_custodia_tmp_t)
+')
--
2.26.2