Chris PeBenito 17de1b
## <summary>File transfer protocol service</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	The per user domain template for the ftp module.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	This template allows ftpd to manage files in
Chris PeBenito 17de1b
##	a user home directory, creating files with the
Chris PeBenito 17de1b
##	correct type.
Chris PeBenito 17de1b
##	

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 17de1b
## <param name="userdomain_prefix">
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
#
Chris PeBenito 17de1b
template(`ftp_per_userdomain_template',`
Chris PeBenito 17de1b
	tunable_policy(`ftpd_is_daemon',`
Chris PeBenito 17de1b
		userdom_manage_user_home_content_files($1,ftpd_t)
Chris PeBenito 17de1b
		userdom_manage_user_home_content_symlinks($1,ftpd_t)
Chris PeBenito 17de1b
		userdom_manage_user_home_content_sockets($1,ftpd_t)
Chris PeBenito 17de1b
		userdom_manage_user_home_content_pipes($1,ftpd_t)
Chris PeBenito 17de1b
		userdom_user_home_dir_filetrans_user_home_content($1,ftpd_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##      Use ftp by connecting over TCP.
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(`ftp_tcp_connect',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type ftpd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 ftpd_t:tcp_socket { connectto recvfrom };
Chris PeBenito 17de1b
	allow ftpd_t $1:tcp_socket { acceptfrom recvfrom };
Chris PeBenito 17de1b
	kernel_tcp_recvfrom($1)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##      Read ftpd etc 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 17de1b
#
Chris PeBenito 17de1b
interface(`ftp_read_config',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type ftpd_etc_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_search_etc($1)
Chris PeBenito 17de1b
	allow $1 ftpd_etc_t:file { getattr read };
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##      Execute FTP daemon entry point programs.
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(`ftp_check_exec',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type ftpd_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_search_sbin($1)
Chris PeBenito 17de1b
	allow $1 ftpd_exec_t:file x_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##      Read FTP transfer logs
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(`ftp_read_log',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type xferlog_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_search_logs($1)
Chris PeBenito 17de1b
	allow $1 xferlog_t:file r_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##      Execute the ftpdctl program in the ftpdctl domain.
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(`ftp_domtrans_ftpdctl',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type ftpdctl_t, ftpdctl_exec_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_search_bin($1)
Chris PeBenito 17de1b
	domain_auto_trans($1, ftpdctl_exec_t, ftpdctl_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow ftpdctl_t $1:fd use;
Chris PeBenito 17de1b
	allow ftpdctl_t $1:fifo_file rw_file_perms;
Chris PeBenito 17de1b
	allow ftpdctl_t $1:process sigchld;
Chris PeBenito 17de1b
')