--- nsaserefpolicy/policy/modules/services/pyzor.fc	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/pyzor.fc	2008-08-14 13:53:54.000000000 -0400
@@ -1,9 +1,12 @@
 /etc/pyzor(/.*)?		gen_context(system_u:object_r:pyzor_etc_t, s0)
 
-HOME_DIR/\.pyzor(/.*)?		gen_context(system_u:object_r:ROLE_pyzor_home_t,s0)
+HOME_DIR/\.pyzor(/.*)?		gen_context(system_u:object_r:pyzor_home_t,s0)
+HOME_DIR/\.spamd(/.*)?		gen_context(system_u:object_r:pyzor_home_t,s0)
 
 /usr/bin/pyzor		--	gen_context(system_u:object_r:pyzor_exec_t,s0)
 /usr/bin/pyzord		--	gen_context(system_u:object_r:pyzord_exec_t,s0)
 
 /var/lib/pyzord(/.*)?		gen_context(system_u:object_r:pyzor_var_lib_t,s0)
 /var/log/pyzord\.log	--	gen_context(system_u:object_r:pyzord_log_t,s0)
+
+/etc/rc.d/init.d/pyzord	--	gen_context(system_u:object_r:pyzord_script_exec_t,s0)
--- nsaserefpolicy/policy/modules/services/pyzor.if	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/pyzor.if	2008-08-14 13:53:54.000000000 -0400
@@ -25,16 +25,16 @@
 #
 template(`pyzor_per_role_template',`
 	gen_require(`
-		type pyzord_t;
+		type pyzor_t;
+		type pyzor_home_t;
 	')
 
-	type $1_pyzor_home_t;
-	userdom_user_home_content($1, $1_pyzor_home_t)
+	typealias pyzor_home_t alias $1_pyzor_home_t;
 
-	manage_dirs_pattern(pyzord_t, $1_pyzor_home_t, $1_pyzor_home_t)
-	manage_files_pattern(pyzord_t, $1_pyzor_home_t, $1_pyzor_home_t)
-	manage_lnk_files_pattern(pyzord_t, $1_pyzor_home_t, $1_pyzor_home_t)
-	userdom_user_home_dir_filetrans($1, pyzord_t, $1_pyzor_home_t, { dir file lnk_file })
+	manage_dirs_pattern(pyzor_t, pyzor_home_t, pyzor_home_t)
+	manage_files_pattern(pyzor_t, pyzor_home_t, pyzor_home_t)
+	manage_lnk_files_pattern(pyzor_t, pyzor_home_t, pyzor_home_t)
+	userdom_user_home_dir_filetrans($1, pyzor_t, pyzor_home_t, { dir file lnk_file })
 ')
 
 ########################################
@@ -94,3 +94,78 @@
 	corecmd_search_bin($1)
 	can_exec($1, pyzor_exec_t)
 ')
+
+########################################
+## <summary>
+##	Execute pyzor server in the pyzor domain.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	The type of the process performing this action.
+##	</summary>
+## </param>
+#
+#
+interface(`pyzor_pyzord_script_domtrans',`
+	gen_require(`
+		type pyzord_script_exec_t;
+	')
+
+	init_script_domtrans_spec($1, pyzord_script_exec_t)
+')
+
+########################################
+## <summary>
+##	All of the rules required to administrate 
+##	an pyzor environment
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <param name="role">
+##	<summary>
+##	The role to be allowed to manage the pyzor domain.
+##	</summary>
+## </param>
+## <param name="terminal">
+##	<summary>
+##	The type of the user terminal.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`pyzor_admin',`
+	gen_require(`
+		type pyzord_t;
+		type pyzord_script_exec_t;
+		type pyzor_tmp_t;
+		type pyzord_log_t;
+		type pyzor_etc_t;
+		type pyzor_var_lib_t;
+	')
+
+	allow $1 pyzord_t:process { ptrace signal_perms getattr };
+	read_files_pattern($1, pyzord_t, pyzord_t)
+	        
+	# Allow pyzord_t to restart the apache service
+	pyzor_pyzord_script_domtrans($1)
+	domain_system_change_exemption($1)
+	role_transition $2 pyzord_script_exec_t system_r;
+	allow $2 system_r;
+
+	files_list_tmp($1)
+        admin_pattern($1, pyzor_tmp_t)
+
+	logging_list_logs($1)
+        admin_pattern($1, pyzord_log_t)
+
+	files_list_etc($1)
+	admin_pattern($1, pyzor_etc_t)
+
+	files_list_var_lib($1)
+        admin_pattern($1, pyzor_var_lib_t)
+')
+
+
--- nsaserefpolicy/policy/modules/services/pyzor.te	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/pyzor.te	2008-08-14 13:53:54.000000000 -0400
@@ -6,6 +6,37 @@
 # Declarations
 #
 
+
+ifdef(`distro_redhat',`
+
+	gen_require(`
+		type spamc_t;
+		type spamc_exec_t;
+		type spamd_t;
+		type spamd_script_exec_t;
+		type spamd_exec_t;
+		type spamc_tmp_t;
+		type spamd_log_t;
+		type spamd_var_lib_t;
+		type spamd_etc_t;
+		type spamc_tmp_t;
+		type spamc_home_t;
+	')
+
+	typealias spamc_t alias pyzor_t;
+	typealias spamc_exec_t alias pyzor_exec_t;
+	typealias spamd_t alias pyzord_t;
+	typealias spamd_script_exec_t alias pyzord_script_exec_t;
+	typealias spamd_exec_t alias pyzord_exec_t;
+	typealias spamc_tmp_t alias pyzor_tmp_t;
+	typealias spamd_log_t alias pyzor_log_t;
+	typealias spamd_log_t alias pyzord_log_t;
+	typealias spamd_var_lib_t alias pyzor_var_lib_t;
+	typealias spamd_etc_t alias pyzor_etc_t;
+	typealias spamc_home_t alias pyzor_home_t;
+
+',`
+
 type pyzor_t;
 type pyzor_exec_t;
 application_domain(pyzor_t, pyzor_exec_t)
@@ -17,7 +48,7 @@
 init_daemon_domain(pyzord_t, pyzord_exec_t)
 
 type pyzor_etc_t;
-files_type(pyzor_etc_t)
+   files_config_file(pyzor_etc_t)
 
 type pyzord_log_t;
 logging_log_file(pyzord_log_t)
@@ -28,6 +59,14 @@
 type pyzor_var_lib_t;
 files_type(pyzor_var_lib_t)
 
+   type pyzor_home_t;
+   userdom_user_home_content(user, pyzor_home_t)
+
+   type pyzord_script_exec_t;
+   init_script_type(pyzord_script_exec_t)
+
+')
+
 ########################################
 #
 # Pyzor local policy
@@ -68,6 +107,8 @@
 
 miscfiles_read_localization(pyzor_t)
 
+mta_read_queue(pyzor_t)
+
 sysadm_dontaudit_search_home_dirs(pyzor_t)
 
 optional_policy(`
@@ -76,8 +117,13 @@
 ')
 
 optional_policy(`
+	procmail_read_tmp_files(pyzor_t)
+')
+
+optional_policy(`
 	spamassassin_signal_spamd(pyzor_t)
 	spamassassin_read_spamd_tmp_files(pyzor_t)
+	unprivuser_read_home_content_files(pyzor_t)
 ')
 
 ########################################
