Blame SOURCES/0020-SELinux-do-not-double-define-node_t-and-pki_tomcat_c_rhbz#1870202.patch

7a9cbd
From 58c3343a67a3922dcc84d3d4b1deca515c48a6f8 Mon Sep 17 00:00:00 2001
7a9cbd
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fcami@redhat.com>
7a9cbd
Date: Wed, 23 Sep 2020 09:17:53 +0200
7a9cbd
Subject: [PATCH] SELinux: do not double-define node_t and pki_tomcat_cert_t
7a9cbd
MIME-Version: 1.0
7a9cbd
Content-Type: text/plain; charset=UTF-8
7a9cbd
Content-Transfer-Encoding: 8bit
7a9cbd
7a9cbd
node_t and pki_tomcat_cert_t are defined in other modules.
7a9cbd
Do not double-define them.
7a9cbd
7a9cbd
Fixes: https://pagure.io/freeipa/issue/8513
7a9cbd
Signed-off-by: François Cami <fcami@redhat.com>
7a9cbd
Reviewed-By: Christian Heimes <cheimes@redhat.com>
7a9cbd
---
7a9cbd
 selinux/ipa.te | 25 ++++++++++++++++---------
7a9cbd
 1 file changed, 16 insertions(+), 9 deletions(-)
7a9cbd
7a9cbd
diff --git a/selinux/ipa.te b/selinux/ipa.te
7a9cbd
index fa577191c..d80e64a0b 100644
7a9cbd
--- a/selinux/ipa.te
7a9cbd
+++ b/selinux/ipa.te
7a9cbd
@@ -74,9 +74,6 @@ logging_log_file(ipa_custodia_log_t)
7a9cbd
 type ipa_custodia_tmp_t;
7a9cbd
 files_tmp_file(ipa_custodia_tmp_t)
7a9cbd
 
7a9cbd
-type pki_tomcat_cert_t;
7a9cbd
-type node_t;
7a9cbd
-
7a9cbd
 type ipa_pki_retrieve_key_exec_t;
7a9cbd
 type ipa_pki_retrieve_key_t;
7a9cbd
 domain_type(ipa_pki_retrieve_key_t)
7a9cbd
@@ -339,12 +336,6 @@ allow ipa_custodia_t self:unix_dgram_socket create_socket_perms;
7a9cbd
 allow ipa_custodia_t self:tcp_socket { bind create };
7a9cbd
 allow ipa_custodia_t self:udp_socket create_socket_perms;
7a9cbd
 
7a9cbd
-allow ipa_custodia_t node_t:tcp_socket node_bind;
7a9cbd
-
7a9cbd
-allow ipa_custodia_t pki_tomcat_cert_t:dir remove_name;
7a9cbd
-allow ipa_custodia_t pki_tomcat_cert_t:file create;
7a9cbd
-allow ipa_custodia_t pki_tomcat_cert_t:file unlink;
7a9cbd
-
7a9cbd
 manage_dirs_pattern(ipa_custodia_t,ipa_custodia_log_t,ipa_custodia_log_t)
7a9cbd
 manage_files_pattern(ipa_custodia_t, ipa_custodia_log_t, ipa_custodia_log_t)
7a9cbd
 logging_log_filetrans(ipa_custodia_t, ipa_custodia_log_t, { dir file })
7a9cbd
@@ -456,3 +447,19 @@ optional_policy(`
7a9cbd
     kerberos_read_config(tomcat_t)
7a9cbd
     kerberos_read_keytab(tomcat_t)
7a9cbd
 ')
7a9cbd
+
7a9cbd
+optional_policy(`
7a9cbd
+    gen_require(`
7a9cbd
+        type node_t;
7a9cbd
+    ')
7a9cbd
+    allow ipa_custodia_t node_t:tcp_socket node_bind;
7a9cbd
+')
7a9cbd
+
7a9cbd
+optional_policy(`
7a9cbd
+    gen_require(`
7a9cbd
+        type pki_tomcat_cert_t;
7a9cbd
+    ')
7a9cbd
+    allow ipa_custodia_t pki_tomcat_cert_t:dir remove_name;
7a9cbd
+    allow ipa_custodia_t pki_tomcat_cert_t:file create;
7a9cbd
+    allow ipa_custodia_t pki_tomcat_cert_t:file unlink;
7a9cbd
+')
7a9cbd
-- 
7a9cbd
2.26.2
7a9cbd