Chris PeBenito 65e131
## <summary>Qmail Mail Server</summary>
Chris PeBenito 65e131
Chris PeBenito 65e131
#######################################
Chris PeBenito 65e131
## <summary>
Chris PeBenito 65e131
##      The per user domain template for qmail
Chris PeBenito 65e131
## </summary>
Chris PeBenito 65e131
## <desc>
Chris PeBenito 65e131
##      

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

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