+## Allow HTTPD scripts and modules to connect to databases over the network.
+##
++##
++gen_tunable(httpd_can_network_connect_db, false)
++
++##
##
-@@ -50,14 +57,6 @@ gen_tunable(ftpd_connect_db, false)
-
- ##
- ##
--## Determine whether ftpd can bind to all
--## unreserved ports for passive mode.
--##
--##
--gen_tunable(ftpd_use_passive_mode, false)
--
--##
--##
- ## Determine whether ftpd can connect to
- ## all unreserved ports.
- ##
-@@ -124,6 +123,9 @@ files_config_file(ftpd_etc_t)
+@@ -124,6 +131,9 @@ files_config_file(ftpd_etc_t)
type ftpd_initrc_exec_t;
init_script_file(ftpd_initrc_exec_t)
@@ -28792,7 +28805,7 @@ index 36838c2..a422d04 100644
type ftpd_keytab_t;
files_type(ftpd_keytab_t)
-@@ -184,6 +186,9 @@ allow ftpd_t ftpd_keytab_t:file read_file_perms;
+@@ -184,6 +194,9 @@ allow ftpd_t ftpd_keytab_t:file read_file_perms;
allow ftpd_t ftpd_lock_t:file manage_file_perms;
files_lock_filetrans(ftpd_t, ftpd_lock_t, file)
@@ -28802,7 +28815,7 @@ index 36838c2..a422d04 100644
manage_dirs_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
manage_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
manage_lnk_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
-@@ -198,22 +203,19 @@ files_pid_filetrans(ftpd_t, ftpd_var_run_t, { file dir })
+@@ -198,22 +211,19 @@ files_pid_filetrans(ftpd_t, ftpd_var_run_t, { file dir })
allow ftpd_t ftpdctl_tmp_t:sock_file delete_sock_file_perms;
@@ -28829,7 +28842,7 @@ index 36838c2..a422d04 100644
corenet_all_recvfrom_netlabel(ftpd_t)
corenet_tcp_sendrecv_generic_if(ftpd_t)
corenet_udp_sendrecv_generic_if(ftpd_t)
-@@ -229,9 +231,12 @@ corenet_tcp_bind_ftp_port(ftpd_t)
+@@ -229,9 +239,12 @@ corenet_tcp_bind_ftp_port(ftpd_t)
corenet_sendrecv_ftp_data_server_packets(ftpd_t)
corenet_tcp_bind_ftp_data_port(ftpd_t)
@@ -28843,7 +28856,7 @@ index 36838c2..a422d04 100644
files_read_etc_runtime_files(ftpd_t)
files_search_var_lib(ftpd_t)
-@@ -250,7 +255,6 @@ logging_send_audit_msgs(ftpd_t)
+@@ -250,7 +263,6 @@ logging_send_audit_msgs(ftpd_t)
logging_send_syslog_msg(ftpd_t)
logging_set_loginuid(ftpd_t)
@@ -28851,7 +28864,7 @@ index 36838c2..a422d04 100644
miscfiles_read_public_files(ftpd_t)
seutil_dontaudit_search_config(ftpd_t)
-@@ -259,37 +263,47 @@ sysnet_use_ldap(ftpd_t)
+@@ -259,32 +271,50 @@ sysnet_use_ldap(ftpd_t)
userdom_dontaudit_use_unpriv_user_fds(ftpd_t)
userdom_dontaudit_search_user_home_dirs(ftpd_t)
@@ -28898,18 +28911,18 @@ index 36838c2..a422d04 100644
- files_manage_non_auth_files(ftpd_t)
+ files_manage_non_security_dirs(ftpd_t)
+ files_manage_non_security_files(ftpd_t)
- ')
-
--tunable_policy(`ftpd_use_passive_mode',`
-- corenet_sendrecv_all_server_packets(ftpd_t)
-- corenet_tcp_bind_all_unreserved_ports(ftpd_t)
++')
++
++tunable_policy(`ftpd_use_passive_mode',`
++ corenet_tcp_bind_all_unreserved_ports(ftpd_t)
++')
+
+tunable_policy(`ftpd_connect_all_unreserved',`
+ corenet_tcp_connect_all_unreserved_ports(ftpd_t)
')
- tunable_policy(`ftpd_connect_all_unreserved',`
-@@ -304,22 +318,19 @@ tunable_policy(`ftpd_connect_db',`
+ tunable_policy(`ftpd_use_passive_mode',`
+@@ -304,22 +334,19 @@ tunable_policy(`ftpd_connect_db',`
corenet_sendrecv_mssql_client_packets(ftpd_t)
corenet_tcp_connect_mssql_port(ftpd_t)
corenet_tcp_sendrecv_mssql_port(ftpd_t)
@@ -28937,7 +28950,7 @@ index 36838c2..a422d04 100644
userdom_tmp_filetrans_user_tmp(ftpd_t, { dir file })
')
-@@ -363,9 +374,8 @@ optional_policy(`
+@@ -363,9 +390,8 @@ optional_policy(`
optional_policy(`
selinux_validate_context(ftpd_t)
@@ -28948,7 +28961,7 @@ index 36838c2..a422d04 100644
kerberos_use(ftpd_t)
')
-@@ -416,21 +426,20 @@ optional_policy(`
+@@ -416,21 +442,20 @@ optional_policy(`
#
stream_connect_pattern(ftpdctl_t, ftpd_var_run_t, ftpd_var_run_t, ftpd_t)
@@ -28972,7 +28985,7 @@ index 36838c2..a422d04 100644
miscfiles_read_public_files(anon_sftpd_t)
-@@ -443,23 +452,34 @@ tunable_policy(`sftpd_anon_write',`
+@@ -443,23 +468,34 @@ tunable_policy(`sftpd_anon_write',`
# Sftpd local policy
#
@@ -29013,7 +29026,7 @@ index 36838c2..a422d04 100644
')
tunable_policy(`sftpd_enable_homedirs && use_nfs_home_dirs',`
-@@ -481,21 +501,11 @@ tunable_policy(`sftpd_anon_write',`
+@@ -481,21 +517,11 @@ tunable_policy(`sftpd_anon_write',`
tunable_policy(`sftpd_full_access',`
allow sftpd_t self:capability { dac_override dac_read_search };
fs_read_noxattr_fs_files(sftpd_t)
@@ -36212,24 +36225,26 @@ index 0000000..61f2003
+userdom_use_user_terminals(iotop_t)
diff --git a/ipa.fc b/ipa.fc
new file mode 100644
-index 0000000..877a747
+index 0000000..db194ec
--- /dev/null
+++ b/ipa.fc
-@@ -0,0 +1,8 @@
+@@ -0,0 +1,10 @@
+/usr/lib/systemd/system/ipa-otpd.* -- gen_context(system_u:object_r:ipa_otpd_unit_file_t,s0)
+
+/usr/libexec/ipa-otpd -- gen_context(system_u:object_r:ipa_otpd_exec_t,s0)
+
++/usr/libexec/ipa/com\.redhat\.idm\.trust-fetch-domains -- gen_context(system_u:object_r:ipa_helper_exec_t,s0)
++
+/var/lib/ipa(/.*)? gen_context(system_u:object_r:ipa_var_lib_t,s0)
+
+/var/run/ipa(/.*)? gen_context(system_u:object_r:ipa_var_run_t,s0)
+
diff --git a/ipa.if b/ipa.if
new file mode 100644
-index 0000000..789b3e8
+index 0000000..de83173
--- /dev/null
+++ b/ipa.if
-@@ -0,0 +1,112 @@
+@@ -0,0 +1,150 @@
+## Policy for IPA services.
+
+########################################
@@ -36270,6 +36285,44 @@ index 0000000..789b3e8
+
+########################################
+##
++## Execute ipa-helper in the ipa_helper domain.
++##
++##
++##
++## Domain allowed to transition.
++##
++##
++#
++interface(`ipa_domtrans_helper',`
++ gen_require(`
++ type ipa_helper_t, ipa_helper_exec_t;
++ ')
++
++ domtrans_pattern($1, ipa_helper_exec_t, ipa_helper_t)
++')
++
++########################################
++##
++## Execute ipa-helper in the ipa_helper domain.
++##
++##
++##
++## Domain allowed to transition.
++##
++##
++#
++interface(`ipa_run_helper',`
++ gen_require(`
++ type ipa_helper_t;
++ attribute_role ipa_helper_roles;
++ ')
++
++ ipa_domtrans_helper($1)
++ roleattribute $2 ipa_helper_roles;
++')
++
++########################################
++##
+## Allow domain to manage ipa lib files/dirs.
+##
+##
@@ -36344,10 +36397,10 @@ index 0000000..789b3e8
+
diff --git a/ipa.te b/ipa.te
new file mode 100644
-index 0000000..a7f09d25
+index 0000000..7d70dcb
--- /dev/null
+++ b/ipa.te
-@@ -0,0 +1,50 @@
+@@ -0,0 +1,113 @@
+policy_module(ipa, 1.0.0)
+
+########################################
@@ -36357,6 +36410,9 @@ index 0000000..a7f09d25
+
+attribute ipa_domain;
+
++attribute_role ipa_helper_roles;
++roleattribute system_r ipa_helper_roles;
++
+type ipa_otpd_t, ipa_domain;
+type ipa_otpd_exec_t;
+init_daemon_domain(ipa_otpd_t, ipa_otpd_exec_t)
@@ -36370,6 +36426,13 @@ index 0000000..a7f09d25
+type ipa_var_run_t;
+files_pid_file(ipa_var_run_t)
+
++type ipa_helper_t;
++type ipa_helper_exec_t;
++domain_type(ipa_helper_t)
++domain_obj_id_change_exemption(ipa_helper_t)
++init_system_domain(ipa_helper_t, ipa_helper_exec_t)
++role ipa_helper_roles types ipa_helper_t;
++
+########################################
+#
+# ipa_otpd local policy
@@ -36398,6 +36461,59 @@ index 0000000..a7f09d25
+optional_policy(`
+ kerberos_use(ipa_otpd_t)
+')
++
++########################################
++#
++# ipa-helper local policy
++#
++
++
++allow ipa_helper_t self:capability { dac_override chown };
++
++allow ipa_helper_t self:process setfscreate;
++allow ipa_helper_t self:fifo_file rw_fifo_file_perms;
++allow ipa_helper_t self:netlink_route_socket r_netlink_socket_perms;
++
++kernel_read_system_state(ipa_helper_t)
++
++corenet_tcp_connect_ldap_port(ipa_helper_t)
++corenet_tcp_connect_smbd_port(ipa_helper_t)
++
++corecmd_exec_bin(ipa_helper_t)
++corecmd_exec_shell(ipa_helper_t)
++
++dev_read_urand(ipa_helper_t)
++
++auth_use_nsswitch(ipa_helper_t)
++
++ipa_manage_pid_files(ipa_helper_t)
++ipa_read_lib(ipa_helper_t)
++
++logging_send_syslog_msg(ipa_helper_t)
++
++optional_policy(`
++ ldap_stream_connect(ipa_helper_t)
++')
++
++optional_policy(`
++ libs_exec_ldconfig(ipa_helper_t)
++')
++
++optional_policy(`
++ memcached_stream_connect(ipa_helper_t)
++')
++
++optional_policy(`
++ oddjob_system_entry(ipa_helper_t, ipa_helper_exec_t)
++')
++
++optional_policy(`
++ samba_read_config(ipa_helper_t)
++')
++
++optional_policy(`
++ sssd_manage_lib_files(ipa_helper_t)
++')
diff --git a/irc.fc b/irc.fc
index 48e7739..1bf0326 100644
--- a/irc.fc
@@ -50280,7 +50396,7 @@ index f42896c..bd1eb52 100644
+/var/spool/mail(/.*)? gen_context(system_u:object_r:mail_spool_t,s0)
+/var/spool/smtpd(/.*)? gen_context(system_u:object_r:mail_spool_t,s0)
diff --git a/mta.if b/mta.if
-index ed81cac..80e6086 100644
+index ed81cac..ad452db 100644
--- a/mta.if
+++ b/mta.if
@@ -1,4 +1,4 @@
@@ -51236,7 +51352,7 @@ index ed81cac..80e6086 100644
##