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

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