Blob Blame History Raw

policy_module(rsync,1.3.0)

########################################
#
# Declarations
#

type rsync_t;
type rsync_exec_t;
init_daemon_domain(rsync_t,rsync_exec_t)
role system_r types rsync_t;

type rsync_data_t;
files_type(rsync_data_t)

type rsync_tmp_t;
files_tmp_file(rsync_tmp_t)

type rsync_var_run_t;
files_pid_file(rsync_var_run_t)

########################################
#
# Local policy
#

allow rsync_t self:capability sys_chroot;
allow rsync_t self:process signal_perms;
allow rsync_t self:fifo_file rw_fifo_file_perms;
allow rsync_t self:tcp_socket create_stream_socket_perms;
allow rsync_t self:udp_socket connected_socket_perms;

# for identd
# cjp: this should probably only be inetd_child_t rules?
# search home and kerberos also.
allow rsync_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
allow rsync_t self:capability { setuid setgid };
#end for identd

allow rsync_t rsync_data_t:dir list_dir_perms;
read_files_pattern(rsync_t,rsync_data_t,rsync_data_t)
read_lnk_files_pattern(rsync_t,rsync_data_t,rsync_data_t)

manage_dirs_pattern(rsync_t,rsync_tmp_t,rsync_tmp_t)
manage_files_pattern(rsync_t,rsync_tmp_t,rsync_tmp_t)
files_tmp_filetrans(rsync_t, rsync_tmp_t, { file dir })

manage_files_pattern(rsync_t,rsync_var_run_t,rsync_var_run_t)
files_pid_filetrans(rsync_t,rsync_var_run_t,file)

kernel_read_kernel_sysctls(rsync_t)
kernel_read_system_state(rsync_t)
kernel_read_network_state(rsync_t)

corenet_non_ipsec_sendrecv(rsync_t)
corenet_tcp_sendrecv_all_if(rsync_t)
corenet_udp_sendrecv_all_if(rsync_t)
corenet_tcp_sendrecv_all_nodes(rsync_t)
corenet_udp_sendrecv_all_nodes(rsync_t)
corenet_tcp_sendrecv_all_ports(rsync_t)
corenet_udp_sendrecv_all_ports(rsync_t)
corenet_tcp_bind_all_nodes(rsync_t)
corenet_tcp_bind_rsync_port(rsync_t)
corenet_sendrecv_rsync_server_packets(rsync_t)

dev_read_urand(rsync_t)

fs_getattr_xattr_fs(rsync_t)

files_read_etc_files(rsync_t)
files_search_home(rsync_t)

init_dontaudit_use_fds(rsync_t)

libs_use_ld_so(rsync_t)
libs_use_shared_libs(rsync_t)

logging_send_syslog_msg(rsync_t)
logging_dontaudit_search_logs(rsync_t)

miscfiles_read_localization(rsync_t)
miscfiles_read_public_files(rsync_t)

sysnet_read_config(rsync_t)

tunable_policy(`allow_rsync_anon_write',`
	miscfiles_manage_public_files(rsync_t)
')

optional_policy(`
	daemontools_service_domain(rsync_t, rsync_exec_t)
')

optional_policy(`
	kerberos_use(rsync_t)
')

optional_policy(`
	inetd_service_domain(rsync_t,rsync_exec_t)
')

optional_policy(`
	nis_use_ypbind(rsync_t)
')

optional_policy(`
	nscd_socket_use(rsync_t)
')