selinux-refpolicy/policy/modules/services/glusterfs.te
Kenton Groombridge bf546e4c4f glusterfs: allow glusterd to bind to all TCP unreserved ports
Port 32767 seems to be needed by glfs_timer

type=SYSCALL msg=audit(1678151692.991:193): arch=c000003e syscall=49 success=no exit=-13 a0=7 a1=43bc7241350 a2=10 a3=3968 items=0 ppid=1 pid=2401 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="glfs_timer" exe="/usr/bin/glusterfsd" subj=system_u:system_r:glusterd_t:s0 key=(null)
type=AVC msg=audit(1678151692.991:193): avc:  denied  { name_bind } for pid=2401 comm="glfs_timer" src=32767 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0

Signed-off-by: Kenton Groombridge <me@concord.sh>
2023-03-10 15:10:59 -05:00

165 lines
5.3 KiB
Plaintext

policy_module(glusterfs)
## <desc>
## <p>
## Allow the gluster daemon to automatically
## add and remove file contexts from the local
## SELinux policy when adding and removing
## bricks.
## </p>
## </desc>
gen_tunable(glusterfs_modify_policy, false)
########################################
#
# Declarations
#
type glusterd_t;
type glusterd_exec_t;
init_daemon_domain(glusterd_t, glusterd_exec_t)
type glusterd_conf_t;
files_type(glusterd_conf_t)
type glusterd_initrc_exec_t;
init_script_file(glusterd_initrc_exec_t)
type glusterd_log_t;
logging_log_file(glusterd_log_t)
type glusterd_runtime_t alias glusterd_var_run_t;
files_runtime_file(glusterd_runtime_t)
type glusterd_tmp_t;
files_tmp_file(glusterd_tmp_t)
type glusterd_var_lib_t;
files_type(glusterd_var_lib_t)
type glusterd_brick_t;
files_type(glusterd_brick_t)
type glusterd_hook_t;
files_type(glusterd_hook_t)
########################################
#
# Local policy
#
allow glusterd_t self:capability { chown dac_override dac_read_search fowner fsetid ipc_lock sys_admin sys_ptrace sys_resource };
allow glusterd_t self:process { getsched setrlimit signal signull };
allow glusterd_t self:fifo_file rw_fifo_file_perms;
allow glusterd_t self:tcp_socket create_stream_socket_perms;
allow glusterd_t self:unix_stream_socket { create_stream_socket_perms connectto };
manage_dirs_pattern(glusterd_t, glusterd_conf_t, glusterd_conf_t)
manage_files_pattern(glusterd_t, glusterd_conf_t, glusterd_conf_t)
files_etc_filetrans(glusterd_t, glusterd_conf_t, dir)
manage_dirs_pattern(glusterd_t, glusterd_tmp_t, glusterd_tmp_t)
manage_files_pattern(glusterd_t, glusterd_tmp_t, glusterd_tmp_t)
manage_sock_files_pattern(glusterd_t, glusterd_tmp_t, glusterd_tmp_t)
files_tmp_filetrans(glusterd_t, glusterd_tmp_t, { dir file sock_file })
manage_dirs_pattern(glusterd_t, glusterd_log_t, glusterd_log_t)
append_files_pattern(glusterd_t, glusterd_log_t, glusterd_log_t)
create_files_pattern(glusterd_t, glusterd_log_t, glusterd_log_t)
setattr_files_pattern(glusterd_t, glusterd_log_t, glusterd_log_t)
logging_log_filetrans(glusterd_t, glusterd_log_t, dir)
manage_dirs_pattern(glusterd_t, glusterd_runtime_t, glusterd_runtime_t)
manage_files_pattern(glusterd_t, glusterd_runtime_t, glusterd_runtime_t)
manage_sock_files_pattern(glusterd_t, glusterd_runtime_t, glusterd_runtime_t)
files_runtime_filetrans(glusterd_t, glusterd_runtime_t, { dir file sock_file })
can_exec(glusterd_t, glusterd_var_lib_t)
manage_dirs_pattern(glusterd_t, glusterd_var_lib_t, glusterd_var_lib_t)
manage_files_pattern(glusterd_t, glusterd_var_lib_t, glusterd_var_lib_t)
manage_lnk_files_pattern(glusterd_t, glusterd_var_lib_t, glusterd_var_lib_t)
files_var_lib_filetrans(glusterd_t, glusterd_var_lib_t, dir)
list_dirs_pattern(glusterd_t, glusterd_hook_t, glusterd_hook_t)
read_files_pattern(glusterd_t, glusterd_hook_t, glusterd_hook_t)
read_lnk_files_pattern(glusterd_t, glusterd_hook_t, glusterd_hook_t)
can_exec(glusterd_t, glusterd_hook_t)
manage_dirs_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
manage_files_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
manage_chr_files_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
manage_fifo_files_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
manage_lnk_files_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
manage_sock_files_pattern(glusterd_t, glusterd_brick_t, glusterd_brick_t)
can_exec(glusterd_t, glusterd_exec_t)
corenet_all_recvfrom_netlabel(glusterd_t)
corenet_tcp_sendrecv_generic_if(glusterd_t)
corenet_udp_sendrecv_generic_if(glusterd_t)
corenet_tcp_sendrecv_generic_node(glusterd_t)
corenet_udp_sendrecv_generic_node(glusterd_t)
corenet_tcp_bind_generic_node(glusterd_t)
corenet_udp_bind_generic_node(glusterd_t)
corenet_tcp_bind_glusterd_port(glusterd_t)
corenet_tcp_connect_glusterd_port(glusterd_t)
# Too coarse?
corenet_sendrecv_all_server_packets(glusterd_t)
corenet_tcp_bind_all_reserved_ports(glusterd_t)
corenet_tcp_bind_all_unreserved_ports(glusterd_t)
corenet_udp_bind_all_rpc_ports(glusterd_t)
corenet_udp_bind_ipp_port(glusterd_t)
corenet_sendrecv_all_client_packets(glusterd_t)
corenet_tcp_connect_all_unreserved_ports(glusterd_t)
corecmd_exec_bin(glusterd_t)
corecmd_exec_shell(glusterd_t)
dev_read_sysfs(glusterd_t)
dev_read_urand(glusterd_t)
domain_read_all_domains_state(glusterd_t)
domain_use_interactive_fds(glusterd_t)
files_read_usr_files(glusterd_t)
files_mounton_mnt(glusterd_t)
fs_dontaudit_getattr_all_fs(glusterd_t)
fs_getattr_xattr_fs(glusterd_t)
fs_mount_fusefs(glusterd_t)
fs_unmount_fusefs(glusterd_t)
kernel_dontaudit_getattr_proc(glusterd_t)
kernel_read_kernel_sysctls(glusterd_t)
kernel_read_net_sysctls(glusterd_t)
kernel_read_system_state(glusterd_t)
storage_rw_fuse(glusterd_t)
auth_use_nsswitch(glusterd_t)
hostname_exec(glusterd_t)
logging_send_syslog_msg(glusterd_t)
miscfiles_read_generic_certs(glusterd_t)
miscfiles_read_localization(glusterd_t)
userdom_dontaudit_search_user_runtime_root(glusterd_t)
xdg_dontaudit_search_data_dirs(glusterd_t)
tunable_policy(`glusterfs_modify_policy',`
# needed by relabeling hooks when adding bricks
seutil_domtrans_semanage(glusterd_t)
seutil_exec_setfiles(glusterd_t)
seutil_read_default_contexts(glusterd_t)
',`
seutil_dontaudit_exec_semanage(glusterd_t)
seutil_dontaudit_exec_setfiles(glusterd_t)
seutil_dontaudit_read_file_contexts(glusterd_t)
')