Chris PeBenito 17de1b7
Chris PeBenito 5d4f4b5
policy_module(rsync, 1.7.0)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Declarations
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 56e1b3d
## <desc>
Chris PeBenito 56e1b3d
## 

Chris PeBenito dd9e1de
## Allow rsync to export any files/directories read only.
Chris PeBenito 226c069
## 

Chris PeBenito 226c069
## </desc>
Chris PeBenito 0bfccda
gen_tunable(rsync_export_all_ro, false)
Chris PeBenito 226c069
Chris PeBenito 226c069
## <desc>
Chris PeBenito 226c069
## 

Chris PeBenito 56e1b3d
## Allow rsync to modify public files
Chris PeBenito dd9e1de
## used for public file transfer services.  Files/Directories must be
Chris PeBenito dd9e1de
## labeled public_content_rw_t.
Chris PeBenito 56e1b3d
## 

Chris PeBenito 56e1b3d
## </desc>
Chris PeBenito 0bfccda
gen_tunable(allow_rsync_anon_write, false)
Chris PeBenito 56e1b3d
Chris PeBenito 17de1b7
type rsync_t;
Chris PeBenito 17de1b7
type rsync_exec_t;
Chris PeBenito 0bfccda
init_daemon_domain(rsync_t, rsync_exec_t)
Chris PeBenito cdf98fe
application_executable_file(rsync_exec_t)
Chris PeBenito 17de1b7
role system_r types rsync_t;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
type rsync_data_t;
Chris PeBenito 17de1b7
files_type(rsync_data_t)
Chris PeBenito 17de1b7
Chris PeBenito 8a948ca
type rsync_log_t;
Chris PeBenito 8a948ca
logging_log_file(rsync_log_t)
Chris PeBenito 8a948ca
Chris PeBenito 17de1b7
type rsync_tmp_t;
Chris PeBenito 17de1b7
files_tmp_file(rsync_tmp_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
type rsync_var_run_t;
Chris PeBenito 17de1b7
files_pid_file(rsync_var_run_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
########################################
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
# Local policy
Chris PeBenito 17de1b7
#
Chris PeBenito 17de1b7
Chris PeBenito 8a948ca
allow rsync_t self:capability { dac_read_search dac_override setuid setgid sys_chroot };
Chris PeBenito 17de1b7
allow rsync_t self:process signal_perms;
Chris PeBenito c0868a7
allow rsync_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b7
allow rsync_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b7
allow rsync_t self:udp_socket connected_socket_perms;
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
# for identd
Chris PeBenito 17de1b7
# cjp: this should probably only be inetd_child_t rules?
Chris PeBenito 17de1b7
# search home and kerberos also.
Chris PeBenito 17de1b7
allow rsync_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
Chris PeBenito 17de1b7
#end for identd
Chris PeBenito 17de1b7
Chris PeBenito c0868a7
allow rsync_t rsync_data_t:dir list_dir_perms;
Chris PeBenito 0bfccda
read_files_pattern(rsync_t, rsync_data_t, rsync_data_t)
Chris PeBenito 0bfccda
read_lnk_files_pattern(rsync_t, rsync_data_t, rsync_data_t)
Chris PeBenito 17de1b7
Chris PeBenito 7aabe35
manage_files_pattern(rsync_t, rsync_log_t, rsync_log_t)
Chris PeBenito 7aabe35
logging_log_filetrans(rsync_t, rsync_log_t, file)
Chris PeBenito 7aabe35
Chris PeBenito 0bfccda
manage_dirs_pattern(rsync_t, rsync_tmp_t, rsync_tmp_t)
Chris PeBenito 0bfccda
manage_files_pattern(rsync_t, rsync_tmp_t, rsync_tmp_t)
Chris PeBenito 17de1b7
files_tmp_filetrans(rsync_t, rsync_tmp_t, { file dir })
Chris PeBenito 17de1b7
Chris PeBenito 0bfccda
manage_files_pattern(rsync_t, rsync_var_run_t, rsync_var_run_t)
Chris PeBenito 0bfccda
files_pid_filetrans(rsync_t, rsync_var_run_t, file)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
kernel_read_kernel_sysctls(rsync_t)
Chris PeBenito 17de1b7
kernel_read_system_state(rsync_t)
Chris PeBenito 17de1b7
kernel_read_network_state(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 1900668
corenet_all_recvfrom_unlabeled(rsync_t)
Chris PeBenito 1900668
corenet_all_recvfrom_netlabel(rsync_t)
Chris PeBenito 17de1b7
corenet_tcp_sendrecv_all_if(rsync_t)
Chris PeBenito 17de1b7
corenet_udp_sendrecv_all_if(rsync_t)
Chris PeBenito 17de1b7
corenet_tcp_sendrecv_all_nodes(rsync_t)
Chris PeBenito 17de1b7
corenet_udp_sendrecv_all_nodes(rsync_t)
Chris PeBenito 17de1b7
corenet_tcp_sendrecv_all_ports(rsync_t)
Chris PeBenito 17de1b7
corenet_udp_sendrecv_all_ports(rsync_t)
Chris PeBenito 17de1b7
corenet_tcp_bind_all_nodes(rsync_t)
Chris PeBenito 17de1b7
corenet_tcp_bind_rsync_port(rsync_t)
Chris PeBenito 17de1b7
corenet_sendrecv_rsync_server_packets(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
dev_read_urand(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
fs_getattr_xattr_fs(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
files_read_etc_files(rsync_t)
Chris PeBenito 17de1b7
files_search_home(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito c0cf6e0
auth_use_nsswitch(rsync_t)
Chris PeBenito c0cf6e0
Chris PeBenito 17de1b7
libs_use_ld_so(rsync_t)
Chris PeBenito 17de1b7
libs_use_shared_libs(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
logging_send_syslog_msg(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
miscfiles_read_localization(rsync_t)
Chris PeBenito 17de1b7
miscfiles_read_public_files(rsync_t)
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
tunable_policy(`allow_rsync_anon_write',`
Chris PeBenito 17de1b7
	miscfiles_manage_public_files(rsync_t)
Chris PeBenito 17de1b7
')
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
optional_policy(`
Chris PeBenito 17de1b7
	daemontools_service_domain(rsync_t, rsync_exec_t)
Chris PeBenito 17de1b7
')
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
optional_policy(`
Chris PeBenito 17de1b7
	kerberos_use(rsync_t)
Chris PeBenito 17de1b7
')
Chris PeBenito 17de1b7
Chris PeBenito 17de1b7
optional_policy(`
Chris PeBenito 0bfccda
	inetd_service_domain(rsync_t, rsync_exec_t)
Chris PeBenito 17de1b7
')
Chris PeBenito 17de1b7
Chris PeBenito 226c069
tunable_policy(`rsync_export_all_ro',`
Chris PeBenito 226c069
	fs_read_noxattr_fs_files(rsync_t) 
Chris PeBenito 226c069
	auth_read_all_files_except_shadow(rsync_t)
Chris PeBenito 17de1b7
')