Chris PeBenito 29af4c
policy_module(rsync, 1.10.0)
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
## 

Dan Walsh 3eaa99
## Allow rsync to run as a client
Dan Walsh 3eaa99
## 

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(rsync_client, false)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
## <desc>
Dan Walsh 3eaa99
## 

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 cdf98f
application_executable_file(rsync_exec_t)
Chris PeBenito 17de1b
role system_r types rsync_t;
Chris PeBenito 17de1b
Dominick Grift 1031ee
type rsync_etc_t;
Dominick Grift 1031ee
files_config_file(rsync_etc_t)
Dominick Grift 1031ee
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 657c22
allow rsync_t self:capability { chown dac_read_search dac_override fowner fsetid 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
Dan Walsh 3eaa99
read_files_pattern(rsync_t, rsync_etc_t, rsync_etc_t)
Dominick Grift 1031ee
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 668b30
corenet_tcp_sendrecv_generic_if(rsync_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(rsync_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(rsync_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(rsync_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(rsync_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(rsync_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(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
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',`
Dan Walsh 3eaa99
	files_getattr_all_pipes(rsync_t)
Chris PeBenito 226c06
	fs_read_noxattr_fs_files(rsync_t) 
Chris PeBenito 455155
	fs_read_nfs_files(rsync_t)
Chris PeBenito 455155
	fs_read_cifs_files(rsync_t)
Chris PeBenito 8f800d
	auth_read_all_dirs_except_shadow(rsync_t)
Chris PeBenito 226c06
	auth_read_all_files_except_shadow(rsync_t)
Chris PeBenito 8f800d
	auth_read_all_symlinks_except_shadow(rsync_t)
Chris PeBenito 8f800d
	auth_tunable_read_shadow(rsync_t)
Chris PeBenito 17de1b
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`rsync_client',`
Dan Walsh 3eaa99
	corenet_tcp_connect_rsync_port(rsync_t)
Dan Walsh 3eaa99
	corenet_tcp_connect_ssh_port(rsync_t)
Dan Walsh 3eaa99
	manage_dirs_pattern(rsync_t, rsync_data_t, rsync_data_t)
Dan Walsh 3eaa99
	manage_files_pattern(rsync_t, rsync_data_t, rsync_data_t)
Dan Walsh 3eaa99
	manage_lnk_files_pattern(rsync_t, rsync_data_t, rsync_data_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	tunable_policy(`rsync_client',`
Dan Walsh 3eaa99
		ssh_exec(rsync_t) 
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Chris PeBenito 8f800d
auth_can_read_shadow_passwords(rsync_t)