Chris PeBenito 17de1b
## <summary>Qmail Mail Server</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito bbcd3c
##      The per role template for qmail
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##      

Chris PeBenito 17de1b
##      This template is invoked automatically for each user, and
Chris PeBenito 17de1b
##      generally does not need to be invoked directly
Chris PeBenito 17de1b
##      by policy writers.
Chris PeBenito 17de1b
##      

Chris PeBenito 17de1b
## </desc>
Chris PeBenito c5cfd2
## <param name="userdomain_prefix" unused="true">
Chris PeBenito 17de1b
##      <summary>
Chris PeBenito 17de1b
##      The prefix of the user domain (e.g., user
Chris PeBenito 17de1b
##      is the prefix for user_t).
Chris PeBenito 17de1b
##      </summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_domain">
Chris PeBenito 17de1b
##      <summary>
Chris PeBenito 17de1b
##      The type of the user domain.
Chris PeBenito 17de1b
##      </summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_role">
Chris PeBenito 17de1b
##      <summary>
Chris PeBenito 17de1b
##      The role associated with the user domain.
Chris PeBenito 17de1b
##      </summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito bbcd3c
template(`qmail_per_role_template',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		attribute qmail_user_domains;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	role $3 types qmail_user_domains;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	qmail_domtrans_inject($2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow qmail_user_domains $2:process sigchld;
Chris PeBenito 17de1b
	allow qmail_user_domains $2:fifo_file { write getattr };
Chris PeBenito 17de1b
	allow qmail_user_domains $2:fd use;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Template for qmail parent/sub-domain pairs
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="child_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the child domain
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="parent_domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The name of the parent domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
template(`qmail_child_domain_template',`
Chris PeBenito 17de1b
	type $1_t;
Chris PeBenito 17de1b
	domain_type($1_t)
Chris PeBenito 17de1b
	type $1_exec_t;
Chris PeBenito 0bfccd
	domain_entry_file($1_t, $1_exec_t)
Chris PeBenito 17de1b
	domain_auto_trans($2, $1_exec_t, $1_t)
Chris PeBenito 17de1b
	role system_r types $1_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_t self:process signal_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_t $2:fd use;
Chris PeBenito 17de1b
	allow $1_t $2:fifo_file rw_file_perms;
Chris PeBenito 17de1b
	allow $1_t $2:process sigchld;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_t qmail_etc_t:dir { getattr read search };
Chris PeBenito 17de1b
	allow $1_t qmail_etc_t:file { getattr read };
Chris PeBenito 17de1b
	allow $1_t qmail_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_t qmail_start_t:fd use;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	kernel_list_proc($2)
Chris PeBenito 17de1b
	kernel_read_proc_symlinks($2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_search_bin($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_var($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	fs_getattr_xattr_fs($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	libs_use_ld_so($1_t)
Chris PeBenito 17de1b
	libs_use_shared_libs($1_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	miscfiles_read_localization($1_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Transition to qmail_inject_t
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`qmail_domtrans_inject',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 0bfccd
		type qmail_inject_t, qmail_inject_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito c0868a
	domtrans_pattern($1, qmail_inject_exec_t, qmail_inject_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`distro_debian',`
Chris PeBenito 17de1b
		files_search_usr($1)
Chris PeBenito 8021cb
		corecmd_search_bin($1)
Chris PeBenito 17de1b
	',`
Chris PeBenito 17de1b
		files_search_var($1)
Chris PeBenito 17de1b
		corecmd_search_bin($1)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Transition to qmail_queue_t
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##		Domain allowed access
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`qmail_domtrans_queue',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 0bfccd
		type qmail_queue_t, qmail_queue_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito c0868a
	domtrans_pattern($1, qmail_queue_exec_t, qmail_queue_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`distro_debian',`
Chris PeBenito 17de1b
		files_search_usr($1)
Chris PeBenito 8021cb
		corecmd_search_bin($1)
Chris PeBenito 17de1b
	',`
Chris PeBenito 17de1b
		files_search_var($1)
Chris PeBenito 17de1b
		corecmd_search_bin($1)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read qmail configuration files.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito bbcd3c
## <rolecap/>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`qmail_read_config',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type qmail_etc_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 qmail_etc_t:dir { getattr read search };
Chris PeBenito 17de1b
	allow $1 qmail_etc_t:file { getattr read };
Chris PeBenito 17de1b
	allow $1 qmail_etc_t:lnk_file { getattr read };
Chris PeBenito 17de1b
	files_search_var($1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	ifdef(`distro_debian',`
Chris PeBenito 17de1b
		# handle /etc/qmail
Chris PeBenito 17de1b
		files_search_etc($1)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Define the specified domain as a qmail-smtp service. 
Chris PeBenito 17de1b
##	Needed by antivirus/antispam filters.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="entrypoint">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type associated with the process program.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`qmail_smtpd_service_domain',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type qmail_smtpd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito c0868a
        domtrans_pattern(qmail_smtpd_t, $2, $1)
Chris PeBenito 17de1b
')