Chris PeBenito 17de1b
Chris PeBenito 8a948c
policy_module(rsync, 1.6.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito dd9e1d
## Allow rsync to export any files/directories read only.
Chris PeBenito 226c06
## 

Chris PeBenito 226c06
## </desc>
Chris PeBenito 0bfccd
gen_tunable(rsync_export_all_ro, false)
Chris PeBenito 226c06
Chris PeBenito 226c06
## <desc>
Chris PeBenito 226c06
## 

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

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