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

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

Chris PeBenito 725926
##	

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

Chris PeBenito 725926
## </desc>
Chris PeBenito 725926
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 725926
##	The prefix of the user domain (e.g., user
Chris PeBenito 725926
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 725926
## </param>
Chris PeBenito 725926
#
Chris PeBenito 725926
template(`ftp_per_userdomain_template',`
Chris PeBenito 725926
	tunable_policy(`ftpd_is_daemon',`
Chris PeBenito 103fe2
		userdom_manage_user_home_content_files($1,ftpd_t)
Chris PeBenito 103fe2
		userdom_manage_user_home_content_symlinks($1,ftpd_t)
Chris PeBenito 103fe2
		userdom_manage_user_home_content_sockets($1,ftpd_t)
Chris PeBenito 103fe2
		userdom_manage_user_home_content_pipes($1,ftpd_t)
Chris PeBenito 103fe2
		userdom_user_home_dir_filetrans_user_home_content($1,ftpd_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 725926
	')
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito fc6524
########################################
Chris PeBenito fc6524
## <summary>
Chris PeBenito fc6524
##      Use ftp by connecting over TCP.
Chris PeBenito fc6524
## </summary>
Chris PeBenito fc6524
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fc6524
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito fc6524
## </param>
Chris PeBenito fc6524
#
Chris PeBenito fc6524
interface(`ftp_tcp_connect',`
Chris PeBenito fc6524
	gen_require(`
Chris PeBenito fc6524
		type ftpd_t;
Chris PeBenito fc6524
	')
Chris PeBenito fc6524
Chris PeBenito fc6524
	allow $1 ftpd_t:tcp_socket { connectto recvfrom };
Chris PeBenito fc6524
	allow ftpd_t $1:tcp_socket { acceptfrom recvfrom };
Chris PeBenito fc6524
	kernel_tcp_recvfrom($1)
Chris PeBenito fc6524
')
Chris PeBenito fc6524
Chris PeBenito fc6524
########################################
Chris PeBenito fc6524
## <summary>
Chris PeBenito fc6524
##      Read ftpd etc files
Chris PeBenito fc6524
## </summary>
Chris PeBenito fc6524
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fc6524
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito fc6524
## </param>
Chris PeBenito fc6524
#
Chris PeBenito fc6524
interface(`ftp_read_config',`
Chris PeBenito fc6524
	gen_require(`
Chris PeBenito fc6524
		type ftpd_etc_t;
Chris PeBenito fc6524
	')
Chris PeBenito fc6524
Chris PeBenito fc6524
	files_search_etc($1)
Chris PeBenito fc6524
	allow $1 ftpd_etc_t:file { getattr read };
Chris PeBenito fc6524
')
Chris PeBenito fc6524
Chris PeBenito fc6524
########################################
Chris PeBenito fc6524
## <summary>
Chris PeBenito fc6524
##      Execute FTP daemon entry point programs.
Chris PeBenito fc6524
## </summary>
Chris PeBenito fc6524
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fc6524
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito fc6524
## </param>
Chris PeBenito fc6524
#
Chris PeBenito fc6524
interface(`ftp_check_exec',`
Chris PeBenito fc6524
	gen_require(`
Chris PeBenito fc6524
		type ftpd_exec_t;
Chris PeBenito fc6524
	')
Chris PeBenito fc6524
Chris PeBenito fc6524
	corecmd_search_sbin($1)
Chris PeBenito fc6524
	allow $1 ftpd_exec_t:file x_file_perms;
Chris PeBenito fc6524
')
Chris PeBenito fc6524
Chris PeBenito fc6524
########################################
Chris PeBenito fc6524
## <summary>
Chris PeBenito fc6524
##      Read FTP transfer logs
Chris PeBenito fc6524
## </summary>
Chris PeBenito fc6524
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fc6524
##      Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito fc6524
## </param>
Chris PeBenito fc6524
#
Chris PeBenito fc6524
interface(`ftp_read_log',`
Chris PeBenito fc6524
	gen_require(`
Chris PeBenito fc6524
		type xferlog_t;
Chris PeBenito fc6524
	')
Chris PeBenito fc6524
Chris PeBenito fc6524
	logging_search_logs($1)
Chris PeBenito fc6524
	allow $1 xferlog_t:file r_file_perms;
Chris PeBenito fc6524
')
Chris PeBenito 75fbbb
Chris PeBenito 75fbbb
########################################
Chris PeBenito 75fbbb
## <summary>
Chris PeBenito 75fbbb
##      Execute the ftpdctl program in the ftpdctl domain.
Chris PeBenito 75fbbb
## </summary>
Chris PeBenito 75fbbb
## <param name="domain">
Chris PeBenito 75fbbb
##      <summary>
Chris PeBenito 75fbbb
##      Domain allowed access.
Chris PeBenito 75fbbb
##      </summary>
Chris PeBenito 75fbbb
## </param>
Chris PeBenito 75fbbb
#
Chris PeBenito 75fbbb
interface(`ftp_domtrans_ftpdctl',`
Chris PeBenito 75fbbb
	gen_require(`
Chris PeBenito 75fbbb
		type ftpdctl_t, ftpdctl_exec_t;
Chris PeBenito 75fbbb
	')
Chris PeBenito 75fbbb
Chris PeBenito 75fbbb
	corecmd_search_bin($1)
Chris PeBenito 75fbbb
	domain_auto_trans($1, ftpdctl_exec_t, ftpdctl_t)
Chris PeBenito 75fbbb
Chris PeBenito 75fbbb
	allow ftpdctl_t $1:fd use;
Chris PeBenito 75fbbb
	allow ftpdctl_t $1:fifo_file rw_file_perms;
Chris PeBenito 75fbbb
	allow ftpdctl_t $1:process sigchld;
Chris PeBenito 75fbbb
')