Chris PeBenito 84c922
## <summary>SMB and CIFS client/server programs for UNIX</summary>
Chris PeBenito 84c922
Chris PeBenito 84c922
#######################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	The per user domain template for the samba module.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <desc>
Chris PeBenito 84c922
##	

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

Chris PeBenito 84c922
##	

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

Chris PeBenito 84c922
## </desc>
Chris PeBenito 84c922
## <param name="userdomain_prefix">
Chris PeBenito 84c922
##	The prefix of the user domain (e.g., user
Chris PeBenito 84c922
##	is the prefix for user_t).
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
## <param name="user_domain">
Chris PeBenito 84c922
##	The type of the user domain.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
## <param name="user_role">
Chris PeBenito 84c922
##	The role associated with the user domain.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
template(`samba_per_userdomain_template',`
Chris PeBenito 84c922
	optional_policy(`
Chris PeBenito 84c922
		gen_require(`
Chris PeBenito 84c922
			type smbd_t;
Chris PeBenito 84c922
		')
Chris PeBenito 84c922
Chris PeBenito 84c922
		userdom_manage_user_home_subdir_files($1,smbd_t)
Chris PeBenito 84c922
		userdom_manage_user_home_subdir_symlinks($1,smbd_t)
Chris PeBenito 84c922
		userdom_manage_user_home_subdir_sockets($1,smbd_t)
Chris PeBenito 84c922
		userdom_manage_user_home_subdir_pipes($1,smbd_t)
Chris PeBenito 84c922
		userdom_create_user_home($1,smbd_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Execute samba net in the samba_net domain.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	The type of the process performing this action.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_domtrans_net',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_net_t, samba_net_exec_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	corecmd_search_bin($1)
Chris PeBenito 84c922
	domain_auto_trans($1,samba_net_exec_t,samba_net_t)
Chris PeBenito 84c922
Chris PeBenito 84c922
	allow $1 samba_net_t:fd use;
Chris PeBenito 84c922
	allow samba_net_t $1:fd use;
Chris PeBenito 84c922
	allow samba_net_t $1:fifo_file rw_file_perms;
Chris PeBenito 84c922
	allow samba_net_t $1:process sigchld;
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Execute samba net in the samba_net domain, and
Chris PeBenito 84c922
##	allow the specified role the samba_net domain.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	The type of the process performing this action.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
## <param name="role">
Chris PeBenito 84c922
##	The role to be allowed the samba_net domain.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
## <param name="terminal">
Chris PeBenito 84c922
##	The type of the terminal allow the samba_net domain to use.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_run_net',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_net_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	samba_domtrans_net($1)
Chris PeBenito 84c922
	role $2 types samba_net_t;
Chris PeBenito 84c922
	allow samba_net_t $3:chr_file rw_term_perms;
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Execute smbmount in the smbmount domain.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	The type of the process performing this action.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_domtrans_smbmount',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type smbmount_t, smbmount_exec_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	corecmd_search_bin($1)
Chris PeBenito 84c922
	domain_auto_trans($1,smbmount_exec_t,smbmount_t)
Chris PeBenito 84c922
Chris PeBenito 84c922
	allow $1 smbmount_t:fd use;
Chris PeBenito 84c922
	allow smbmount_t $1:fd use;
Chris PeBenito 84c922
	allow smbmount_t $1:fifo_file rw_file_perms;
Chris PeBenito 84c922
	allow smbmount_t $1:process sigchld;
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to read
Chris PeBenito 84c922
##	samba configuration files.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_read_config',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_etc_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	files_search_etc($1)
Chris PeBenito 84c922
	allow $1 samba_etc_t:file { read getattr lock };
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to read
Chris PeBenito 84c922
##	and write samba configuration files.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_rw_config',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_etc_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	files_search_etc($1)
Chris PeBenito 84c922
	allow $1 samba_etc_t:file rw_file_perms;
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to read samba's log files.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_read_log',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_log_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	logging_search_logs($1)
Chris PeBenito 84c922
	allow $1 samba_log_t:file { read getattr lock };
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Execute samba log in the caller domain.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	The type of the process performing this action.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_exec_log',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_log_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	logging_search_logs($1)
Chris PeBenito 84c922
	can_exec($1,samba_log_t)
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to read samba's secrets.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_read_secrets',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type samba_secrets_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	files_search_etc($1)
Chris PeBenito 84c922
	allow $1 samba_secrets_t:file { read getattr lock };
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to write to smbmount tcp sockets.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_write_smbmount_tcp_socket',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type smbmount_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	allow $1 smbmount_t:tcp_socket write;
Chris PeBenito 84c922
')
Chris PeBenito 84c922
Chris PeBenito 84c922
########################################
Chris PeBenito 84c922
## <summary>
Chris PeBenito 84c922
##	Allow the specified domain to read and write to smbmount tcp sockets.
Chris PeBenito 84c922
## </summary>
Chris PeBenito 84c922
## <param name="domain">
Chris PeBenito 84c922
##	Domain allowed access.
Chris PeBenito 84c922
## </param>
Chris PeBenito 84c922
#
Chris PeBenito 84c922
interface(`samba_rw_smbmount_tcp_socket',`
Chris PeBenito 84c922
	gen_require(`
Chris PeBenito 84c922
		type smbmount_t;
Chris PeBenito 84c922
	')
Chris PeBenito 84c922
Chris PeBenito 84c922
	allow $1 smbmount_t:tcp_socket { read write };
Chris PeBenito 84c922
')