policy_module(samba, 1.16.3) ################################# # # Declarations # ## ##

## Allow samba to modify public files used for public file ## transfer services. Files/Directories must be labeled ## public_content_rw_t. ##

##
gen_tunable(smbd_anon_write, false) ## ##

## Allow samba to create new home directories (e.g. via PAM) ##

##
gen_tunable(samba_create_home_dirs, false) ## ##

## Allow samba to act as the domain controller, add users, ## groups and change passwords. ## ##

##
gen_tunable(samba_domain_controller, false) ## ##

## Allow samba to act as a portmapper ## ##

##
gen_tunable(samba_portmapper, false) ## ##

## Allow samba and winbind-rpcd to share users home directories. ##

##
gen_tunable(samba_enable_home_dirs, false) ## ##

## Allow samba to share any file/directory read only. ##

##
gen_tunable(samba_export_all_ro, false) ## ##

## Allow samba to share any file/directory read/write. ##

##
gen_tunable(samba_export_all_rw, false) ## ##

## Allow samba to run unconfined scripts ##

##
gen_tunable(samba_run_unconfined, false) ## ##

## Allow samba to export NFS volumes. ##

##
gen_tunable(samba_share_nfs, false) ## ##

## Allow samba to export ntfs/fusefs volumes. ##

##
gen_tunable(samba_share_fusefs, false) ## ##

## Allow smbd to load libgfapi from gluster. ##

##
gen_tunable(samba_load_libgfapi, false) type nmbd_t; type nmbd_exec_t; init_daemon_domain(nmbd_t, nmbd_exec_t) type nmbd_var_run_t; files_pid_file(nmbd_var_run_t) type samba_etc_t; files_config_file(samba_etc_t) type samba_initrc_exec_t; init_script_file(samba_initrc_exec_t) type samba_unit_file_t; systemd_unit_file(samba_unit_file_t) type samba_log_t; logging_log_file(samba_log_t) type samba_net_t; type samba_net_exec_t; application_domain(samba_net_t, samba_net_exec_t) role system_r types samba_net_t; type samba_net_tmp_t; files_tmp_file(samba_net_tmp_t) type samba_secrets_t; files_type(samba_secrets_t) type samba_share_t; # customizable files_type(samba_share_t) type samba_spool_t; files_type(samba_spool_t) type samba_var_t; files_type(samba_var_t) type smbcontrol_t; type smbcontrol_exec_t; application_domain(smbcontrol_t, smbcontrol_exec_t) role system_r types smbcontrol_t; type smbd_t; type smbd_exec_t; init_daemon_domain(smbd_t, smbd_exec_t) type smbd_keytab_t; files_type(smbd_keytab_t) type smbd_tmp_t; files_tmp_file(smbd_tmp_t) type smbd_tmpfs_t; files_tmpfs_file(smbd_tmpfs_t) type smbd_var_run_t; files_pid_file(smbd_var_run_t) type smbmount_t; domain_type(smbmount_t) type smbmount_exec_t; domain_entry_file(smbmount_t, smbmount_exec_t) type swat_t; type swat_exec_t; domain_type(swat_t) domain_entry_file(swat_t, swat_exec_t) role system_r types swat_t; type swat_tmp_t; files_tmp_file(swat_tmp_t) type swat_var_run_t; files_pid_file(swat_var_run_t) type winbind_t; type winbind_exec_t; init_daemon_domain(winbind_t, winbind_exec_t) type winbind_helper_t; domain_type(winbind_helper_t) role system_r types winbind_helper_t; type winbind_helper_exec_t; domain_entry_file(winbind_helper_t, winbind_helper_exec_t) type winbind_rpcd_t; type winbind_rpcd_exec_t; application_domain(winbind_rpcd_t, winbind_rpcd_exec_t) role system_r types winbind_rpcd_t; type winbind_log_t; logging_log_file(winbind_log_t) type winbind_rpcd_var_run_t; files_pid_file(winbind_rpcd_var_run_t) type winbind_rpcd_tmp_t; files_tmp_file(winbind_rpcd_tmp_t) type winbind_var_run_t; files_pid_file(winbind_var_run_t) ######################################## # # Samba net local policy # allow samba_net_t self:capability { sys_chroot sys_nice dac_read_search }; allow samba_net_t self:capability2 block_suspend; allow samba_net_t self:process { getsched setsched }; allow samba_net_t self:unix_dgram_socket create_socket_perms; allow samba_net_t self:unix_stream_socket create_stream_socket_perms; allow samba_net_t self:udp_socket create_socket_perms; allow samba_net_t self:tcp_socket create_socket_perms; allow samba_net_t samba_etc_t:file read_file_perms; manage_files_pattern(samba_net_t, samba_etc_t, samba_secrets_t) filetrans_pattern(samba_net_t, samba_etc_t, samba_secrets_t, file) manage_dirs_pattern(samba_net_t, samba_net_tmp_t, samba_net_tmp_t) manage_files_pattern(samba_net_t, samba_net_tmp_t, samba_net_tmp_t) files_tmp_filetrans(samba_net_t, samba_net_tmp_t, { file dir }) manage_dirs_pattern(samba_net_t, samba_var_t, samba_var_t) manage_files_pattern(samba_net_t, samba_var_t, samba_var_t) manage_lnk_files_pattern(samba_net_t, samba_var_t, samba_var_t) manage_sock_files_pattern(samba_net_t, samba_var_t, samba_var_t) files_var_filetrans(samba_net_t, samba_var_t, dir, "samba") allow samba_net_t samba_var_t:file { map } ; kernel_read_proc_symlinks(samba_net_t) kernel_read_system_state(samba_net_t) kernel_read_network_state(samba_net_t) corenet_all_recvfrom_netlabel(samba_net_t) corenet_tcp_sendrecv_generic_if(samba_net_t) corenet_udp_sendrecv_generic_if(samba_net_t) corenet_raw_sendrecv_generic_if(samba_net_t) corenet_tcp_sendrecv_generic_node(samba_net_t) corenet_udp_sendrecv_generic_node(samba_net_t) corenet_raw_sendrecv_generic_node(samba_net_t) corenet_tcp_sendrecv_all_ports(samba_net_t) corenet_udp_sendrecv_all_ports(samba_net_t) corenet_tcp_bind_generic_node(samba_net_t) corenet_udp_bind_generic_node(samba_net_t) corenet_tcp_connect_smbd_port(samba_net_t) dev_read_urand(samba_net_t) domain_use_interactive_fds(samba_net_t) files_read_usr_symlinks(samba_net_t) auth_use_nsswitch(samba_net_t) auth_manage_cache(samba_net_t) logging_send_syslog_msg(samba_net_t) samba_read_var_files(samba_net_t) sysnet_use_ldap(samba_net_t) userdom_use_inherited_user_terminals(samba_net_t) userdom_list_user_home_dirs(samba_net_t) optional_policy(` ctdbd_stream_connect(samba_net_t) ctdbd_manage_lib_dirs(samba_net_t) ctdbd_manage_lib_files(samba_net_t) ') optional_policy(` ldap_stream_connect(samba_net_t) dirsrv_stream_connect(samba_net_t) ') optional_policy(` pcscd_read_pid_files(samba_net_t) ') optional_policy(` realmd_manage_cache_files(samba_net_t) realmd_read_tmp_files(samba_net_t) ') optional_policy(` kerberos_use(samba_net_t) kerberos_etc_filetrans_keytab(samba_net_t) ') ######################################## # # smbd Local policy # allow smbd_t self:capability { chown fowner kill fsetid setgid setuid sys_chroot sys_nice sys_admin sys_resource lease dac_read_search net_admin }; dontaudit smbd_t self:capability sys_tty_config; dontaudit smbd_t self:capability2 block_suspend; allow smbd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow smbd_t self:process setrlimit; allow smbd_t self:fd use; allow smbd_t self:fifo_file rw_fifo_file_perms; allow smbd_t self:msg { send receive }; allow smbd_t self:msgq create_msgq_perms; allow smbd_t self:sem create_sem_perms; allow smbd_t self:shm create_shm_perms; allow smbd_t self:key manage_key_perms; allow smbd_t self:sock_file read_sock_file_perms; allow smbd_t self:tcp_socket create_stream_socket_perms; allow smbd_t self:udp_socket create_socket_perms; allow smbd_t self:unix_dgram_socket { create_socket_perms sendto }; allow smbd_t self:unix_stream_socket { create_stream_socket_perms connectto }; allow smbd_t nmbd_t:process { signal signull }; allow smbd_t nmbd_t:unix_dgram_socket sendto; allow smbd_t nmbd_var_run_t:file rw_file_perms; stream_connect_pattern(smbd_t, nmbd_var_run_t, nmbd_var_run_t, nmbd_t) allow smbd_t samba_etc_t:file { rw_file_perms setattr }; allow smbd_t smbd_keytab_t:file read_file_perms; manage_dirs_pattern(smbd_t, samba_log_t, samba_log_t) manage_files_pattern(smbd_t, samba_log_t, samba_log_t) allow smbd_t samba_net_tmp_t:file getattr; manage_files_pattern(smbd_t, samba_secrets_t, samba_secrets_t) filetrans_pattern(smbd_t, samba_etc_t, samba_secrets_t, file) manage_dirs_pattern(smbd_t, samba_share_t, samba_share_t) manage_files_pattern(smbd_t, samba_share_t, samba_share_t) manage_fifo_files_pattern(smbd_t, samba_share_t, samba_share_t) manage_sock_files_pattern(smbd_t, samba_share_t, samba_share_t) manage_lnk_files_pattern(smbd_t, samba_share_t, samba_share_t) getattr_blk_files_pattern(smbd_t, samba_share_t, samba_share_t) getattr_chr_files_pattern(smbd_t, samba_share_t, samba_share_t) allow smbd_t samba_share_t:file { map }; allow smbd_t samba_share_t:filesystem { getattr quotaget }; manage_dirs_pattern(smbd_t, samba_var_t, samba_var_t) manage_files_pattern(smbd_t, samba_var_t, samba_var_t) manage_lnk_files_pattern(smbd_t, samba_var_t, samba_var_t) manage_sock_files_pattern(smbd_t, samba_var_t, samba_var_t) files_var_filetrans(smbd_t, samba_var_t, dir, "samba") allow smbd_t samba_var_t:file { map } ; manage_dirs_pattern(smbd_t, samba_spool_t, samba_spool_t) manage_files_pattern(smbd_t, samba_spool_t, samba_spool_t) manage_lnk_files_pattern(smbd_t, samba_spool_t, samba_spool_t) manage_sock_files_pattern(smbd_t, samba_spool_t, samba_spool_t) files_spool_filetrans(smbd_t, samba_spool_t, dir, "samba") allow smbd_t smbcontrol_t:process { signal signull }; allow smbd_t smbcontrol_t:unix_dgram_socket sendto; allow smbd_t winbind_t:unix_dgram_socket sendto; manage_dirs_pattern(smbd_t, smbd_tmp_t, smbd_tmp_t) manage_files_pattern(smbd_t, smbd_tmp_t, smbd_tmp_t) files_tmp_filetrans(smbd_t, smbd_tmp_t, { file dir }) manage_dirs_pattern(smbd_t, smbd_tmpfs_t, smbd_tmpfs_t) manage_files_pattern(smbd_t, smbd_tmpfs_t, smbd_tmpfs_t) fs_tmpfs_filetrans(smbd_t, smbd_tmpfs_t, { file dir }) manage_dirs_pattern(smbd_t, smbd_var_run_t, smbd_var_run_t) manage_files_pattern(smbd_t, smbd_var_run_t, smbd_var_run_t) manage_sock_files_pattern(smbd_t, smbd_var_run_t, smbd_var_run_t) files_pid_filetrans(smbd_t, smbd_var_run_t, { dir file }) allow smbd_t swat_t:process signal; allow smbd_t winbind_var_run_t:sock_file rw_sock_file_perms; allow smbd_t winbind_t:process { signal signull }; kernel_getattr_core_if(smbd_t) kernel_getattr_message_if(smbd_t) kernel_read_network_state(smbd_t) kernel_read_net_sysctls(smbd_t) kernel_read_fs_sysctls(smbd_t) kernel_read_kernel_sysctls(smbd_t) kernel_read_software_raid_state(smbd_t) kernel_read_system_state(smbd_t) corecmd_exec_shell(smbd_t) corecmd_exec_bin(smbd_t) corenet_all_recvfrom_netlabel(smbd_t) corenet_tcp_sendrecv_generic_if(smbd_t) corenet_udp_sendrecv_generic_if(smbd_t) corenet_raw_sendrecv_generic_if(smbd_t) corenet_tcp_sendrecv_generic_node(smbd_t) corenet_udp_sendrecv_generic_node(smbd_t) corenet_raw_sendrecv_generic_node(smbd_t) corenet_tcp_sendrecv_all_ports(smbd_t) corenet_udp_sendrecv_all_ports(smbd_t) corenet_tcp_bind_generic_node(smbd_t) corenet_udp_bind_generic_node(smbd_t) corenet_tcp_bind_smbd_port(smbd_t) corenet_tcp_connect_ipp_port(smbd_t) corenet_tcp_connect_smbd_port(smbd_t) dev_read_sysfs(smbd_t) dev_read_urand(smbd_t) dev_dontaudit_write_urand(smbd_t) dev_getattr_mtrr_dev(smbd_t) dev_dontaudit_getattr_usbfs_dirs(smbd_t) # For redhat bug 566984 dev_getattr_all_blk_files(smbd_t) dev_getattr_all_chr_files(smbd_t) domain_dontaudit_signull_all_domains(smbd_t) fs_getattr_all_fs(smbd_t) fs_getattr_all_dirs(smbd_t) fs_get_xattr_fs_quotas(smbd_t) fs_search_auto_mountpoints(smbd_t) fs_getattr_rpc_dirs(smbd_t) fs_get_all_fs_quotas(smbd_t) auth_use_nsswitch(smbd_t) auth_domtrans_chk_passwd(smbd_t) auth_domtrans_upd_passwd(smbd_t) auth_manage_cache(smbd_t) auth_write_login_records(smbd_t) domain_use_interactive_fds(smbd_t) domain_dontaudit_list_all_domains_state(smbd_t) files_list_var_lib(smbd_t) files_read_etc_runtime_files(smbd_t) files_search_spool(smbd_t) # smbd seems to getattr all mountpoints files_dontaudit_getattr_all_dirs(smbd_t) files_dontaudit_list_all_mountpoints(smbd_t) # Allow samba to list mnt_t for potential mounted dirs files_list_mnt(smbd_t) init_rw_utmp(smbd_t) logging_search_logs(smbd_t) logging_send_syslog_msg(smbd_t) miscfiles_read_public_files(smbd_t) sysnet_use_ldap(smbd_t) userdom_use_unpriv_users_fds(smbd_t) userdom_search_user_home_content(smbd_t) userdom_signal_all_users(smbd_t) usermanage_read_crack_db(smbd_t) term_use_ptmx(smbd_t) ifdef(`hide_broken_symptoms', ` files_dontaudit_getattr_default_dirs(smbd_t) files_dontaudit_getattr_boot_dirs(smbd_t) ') tunable_policy(`smbd_anon_write',` miscfiles_manage_public_files(smbd_t) ') tunable_policy(`samba_portmapper',` corenet_tcp_bind_epmap_port(smbd_t) corenet_tcp_bind_all_unreserved_ports(smbd_t) ') tunable_policy(`samba_domain_controller',` gen_require(` class passwd passwd; ') usermanage_domtrans_passwd(smbd_t) usermanage_kill_passwd(smbd_t) usermanage_domtrans_useradd(smbd_t) usermanage_domtrans_groupadd(smbd_t) allow smbd_t self:passwd passwd; usermanage_domtrans_passwd(winbind_rpcd_t) allow winbind_rpcd_t self:passwd passwd; ') tunable_policy(`samba_enable_home_dirs',` userdom_manage_user_home_content(smbd_t) userdom_watch_user_home_dirs(smbd_t) userdom_manage_user_home_content(winbind_rpcd_t) userdom_watch_user_home_dirs(winbind_rpcd_t) ') optional_policy(` tunable_policy(`samba_enable_home_dirs',` apache_manage_user_content(smbd_t) ') ') # Support Samba sharing of NFS mount points tunable_policy(`samba_share_nfs',` fs_manage_nfs_dirs(smbd_t) fs_manage_nfs_files(smbd_t) fs_manage_nfs_symlinks(smbd_t) fs_manage_nfs_named_pipes(smbd_t) fs_manage_nfs_named_sockets(smbd_t) ') # Support Samba sharing of ntfs/fusefs mount points tunable_policy(`samba_share_fusefs',` fs_manage_fusefs_dirs(smbd_t) fs_manage_fusefs_files(smbd_t) ',` fs_search_fusefs(smbd_t) ') tunable_policy(`samba_load_libgfapi',` corenet_tcp_connect_all_ports(smbd_t) corenet_tcp_bind_all_ports(smbd_t) corenet_sendrecv_all_packets(smbd_t) ') optional_policy(` avahi_dbus_chat(smbd_t) ') optional_policy(` ccs_read_config(smbd_t) ') optional_policy(` ctdbd_stream_connect(smbd_t) ctdbd_manage_lib_files(smbd_t) ctdbd_manage_lib_dirs(smbd_t) ') optional_policy(` cups_read_rw_config(smbd_t) cups_stream_connect(smbd_t) ') optional_policy(` dbus_system_bus_client(smbd_t) optional_policy(` oddjob_dbus_chat(smbd_t) oddjob_domtrans_mkhomedir(smbd_t) ') ') optional_policy(` glusterd_read_conf(smbd_t) glusterd_rw_lib(smbd_t) glusterd_manage_pid(smbd_t) ') optional_policy(` kerberos_read_keytab(smbd_t) kerberos_use(smbd_t) kerberos_tmp_filetrans_host_rcache(smbd_t, "host_0") kerberos_tmp_filetrans_host_rcache(smbd_t, "krb5_0.rcache2") kerberos_manage_host_rcache(smbd_t) ') optional_policy(` ldap_stream_connect(smbd_t) dirsrv_stream_connect(smbd_t) ') optional_policy(` lpd_exec_lpr(smbd_t) ') optional_policy(` qemu_manage_tmp_dirs(smbd_t) qemu_manage_tmp_files(smbd_t) ') optional_policy(` rhcs_signull_cluster(smbd_t) ') optional_policy(` rpc_search_nfs_state_data(smbd_t) ') optional_policy(` seutil_sigchld_newrole(smbd_t) ') optional_policy(` udev_read_db(smbd_t) ') tunable_policy(`samba_create_home_dirs',` allow smbd_t self:capability chown; userdom_create_user_home_dirs(smbd_t) ') userdom_home_filetrans_user_home_dir(smbd_t) tunable_policy(`samba_export_all_ro',` allow nmbd_t self:capability { dac_read_search }; fs_read_noxattr_fs_files(smbd_t) files_read_non_security_files(smbd_t) files_dontaudit_list_security_dirs(smbd_t) files_dontaudit_search_security_files(smbd_t) files_dontaudit_read_security_files(smbd_t) fs_read_noxattr_fs_files(nmbd_t) files_read_non_security_files(nmbd_t) files_dontaudit_list_security_dirs(nmbd_t) files_dontaudit_search_security_files(nmbd_t) files_dontaudit_read_security_files(nmbd_t) fs_read_noxattr_fs_files(winbind_rpcd_t) files_read_non_security_files(winbind_rpcd_t) files_dontaudit_list_security_dirs(winbind_rpcd_t) files_dontaudit_search_security_files(winbind_rpcd_t) files_dontaudit_read_security_files(winbind_rpcd_t) ') tunable_policy(`samba_export_all_rw',` allow nmbd_t self:capability { dac_read_search }; fs_manage_noxattr_fs_files(smbd_t) files_manage_non_security_files(smbd_t) files_manage_non_security_dirs(smbd_t) files_dontaudit_list_security_dirs(smbd_t) files_dontaudit_search_security_files(smbd_t) files_dontaudit_read_security_files(smbd_t) fs_manage_noxattr_fs_files(nmbd_t) files_manage_non_security_files(nmbd_t) files_manage_non_security_dirs(nmbd_t) files_dontaudit_list_security_dirs(nmbd_t) files_dontaudit_search_security_files(nmbd_t) files_dontaudit_read_security_files(nmbd_t) fs_manage_noxattr_fs_files(winbind_rpcd_t) files_manage_non_security_files(winbind_rpcd_t) files_manage_non_security_dirs(winbind_rpcd_t) files_dontaudit_list_security_dirs(winbind_rpcd_t) files_dontaudit_search_security_files(winbind_rpcd_t) files_dontaudit_read_security_files(winbind_rpcd_t) ') userdom_filetrans_home_content(nmbd_t) ######################################## # # nmbd Local policy # dontaudit nmbd_t self:capability sys_tty_config; allow nmbd_t self:capability {net_admin}; allow nmbd_t self:capability2 block_suspend; allow nmbd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow nmbd_t self:fd use; allow nmbd_t self:fifo_file rw_fifo_file_perms; allow nmbd_t self:msg { send receive }; allow nmbd_t self:msgq create_msgq_perms; allow nmbd_t self:sem create_sem_perms; allow nmbd_t self:shm create_shm_perms; allow nmbd_t self:sock_file read_sock_file_perms; allow nmbd_t self:tcp_socket create_stream_socket_perms; allow nmbd_t self:udp_socket create_socket_perms; allow nmbd_t self:unix_dgram_socket { create_socket_perms sendto }; allow nmbd_t self:unix_stream_socket { create_stream_socket_perms connectto }; manage_dirs_pattern(nmbd_t, { smbd_var_run_t nmbd_var_run_t }, nmbd_var_run_t) manage_files_pattern(nmbd_t, nmbd_var_run_t, nmbd_var_run_t) manage_sock_files_pattern(nmbd_t, nmbd_var_run_t, nmbd_var_run_t) files_pid_filetrans(nmbd_t, nmbd_var_run_t, { dir file sock_file }) filetrans_pattern(nmbd_t, smbd_var_run_t, nmbd_var_run_t, dir) read_files_pattern(nmbd_t, samba_etc_t, samba_etc_t) read_lnk_files_pattern(nmbd_t, samba_etc_t, samba_etc_t) manage_dirs_pattern(nmbd_t, samba_log_t, samba_log_t) manage_files_pattern(nmbd_t, samba_log_t, samba_log_t) manage_dirs_pattern(nmbd_t, samba_var_t, samba_var_t) manage_files_pattern(nmbd_t, samba_var_t, samba_var_t) manage_lnk_files_pattern(nmbd_t, samba_var_t, samba_var_t) manage_sock_files_pattern(nmbd_t, samba_var_t, samba_var_t) files_var_filetrans(nmbd_t, samba_var_t, dir, "samba") allow nmbd_t samba_var_t:file map; allow nmbd_t smbcontrol_t:process signal; allow nmbd_t smbcontrol_t:unix_dgram_socket sendto; kernel_getattr_core_if(nmbd_t) kernel_getattr_message_if(nmbd_t) kernel_read_kernel_sysctls(nmbd_t) kernel_read_network_state(nmbd_t) kernel_read_software_raid_state(nmbd_t) kernel_read_system_state(nmbd_t) corenet_all_recvfrom_netlabel(nmbd_t) corenet_tcp_sendrecv_generic_if(nmbd_t) corenet_udp_sendrecv_generic_if(nmbd_t) corenet_tcp_sendrecv_generic_node(nmbd_t) corenet_udp_sendrecv_generic_node(nmbd_t) corenet_tcp_sendrecv_all_ports(nmbd_t) corenet_udp_sendrecv_all_ports(nmbd_t) corenet_udp_bind_generic_node(nmbd_t) corenet_udp_bind_nmbd_port(nmbd_t) corenet_sendrecv_nmbd_server_packets(nmbd_t) corenet_sendrecv_nmbd_client_packets(nmbd_t) corenet_tcp_connect_smbd_port(nmbd_t) dev_getattr_mtrr_dev(nmbd_t) dev_read_sysfs(nmbd_t) dev_read_urand(nmbd_t) fs_getattr_all_fs(nmbd_t) fs_search_auto_mountpoints(nmbd_t) domain_use_interactive_fds(nmbd_t) files_list_var_lib(nmbd_t) auth_use_nsswitch(nmbd_t) logging_search_logs(nmbd_t) logging_send_syslog_msg(nmbd_t) userdom_use_unpriv_users_fds(nmbd_t) userdom_dontaudit_search_user_home_dirs(nmbd_t) optional_policy(` ctdbd_stream_connect(nmbd_t) ctdbd_manage_lib_dirs(nmbd_t) ctdbd_manage_lib_files(nmbd_t) ') optional_policy(` dbus_system_bus_client(nmbd_t) ') optional_policy(` seutil_sigchld_newrole(nmbd_t) ') optional_policy(` udev_read_db(nmbd_t) ') ######################################## # # smbcontrol local policy # allow smbcontrol_t self:capability2 block_suspend; allow smbcontrol_t self:process { signal signull }; # internal communication is often done using fifo and unix sockets. allow smbcontrol_t self:fifo_file rw_file_perms; allow smbcontrol_t self:netlink_route_socket r_netlink_socket_perms; allow smbcontrol_t self:udp_socket create_socket_perms; allow smbcontrol_t self:unix_stream_socket create_stream_socket_perms; allow smbcontrol_t self:unix_dgram_socket create_socket_perms; allow smbcontrol_t nmbd_t:process { signal signull }; read_files_pattern(smbcontrol_t, nmbd_var_run_t, nmbd_var_run_t) allow smbcontrol_t smbd_t:process { signal signull }; read_files_pattern(smbcontrol_t, smbd_var_run_t, smbd_var_run_t) allow smbcontrol_t winbind_t:process { signal signull }; manage_files_pattern(smbcontrol_t, samba_var_t, samba_var_t) manage_dirs_pattern(smbcontrol_t, samba_var_t, samba_var_t) manage_sock_files_pattern(smbcontrol_t, samba_var_t, samba_var_t) allow smbcontrol_t samba_var_t:file map; allow smbcontrol_t nmbd_t:unix_dgram_socket sendto; allow smbcontrol_t smbd_t:unix_dgram_socket sendto; allow smbcontrol_t winbind_rpcd_t:unix_dgram_socket sendto; allow smbcontrol_t winbind_t:unix_dgram_socket sendto; samba_read_config(smbcontrol_t) samba_search_var(smbcontrol_t) samba_read_winbind_pid(smbcontrol_t) kernel_read_network_state(smbcontrol_t) domain_use_interactive_fds(smbcontrol_t) dev_read_urand(smbcontrol_t) term_use_console(smbcontrol_t) auth_read_passwd(smbcontrol_t) sysnet_use_ldap(smbcontrol_t) userdom_use_inherited_user_terminals(smbcontrol_t) optional_policy(` ctdbd_stream_connect(smbcontrol_t) ctdbd_sigchld(smbcontrol_t) ') ######################################## # # smbmount Local policy # allow smbmount_t self:capability { sys_rawio sys_admin dac_read_search chown }; # FIXME: is all of this really necessary? allow smbmount_t self:process { fork signal_perms }; allow smbmount_t self:tcp_socket create_stream_socket_perms; allow smbmount_t self:udp_socket connect; allow smbmount_t self:unix_dgram_socket create_socket_perms; allow smbmount_t self:unix_stream_socket create_socket_perms; allow smbmount_t samba_etc_t:dir list_dir_perms; allow smbmount_t samba_etc_t:file read_file_perms; can_exec(smbmount_t, smbmount_exec_t) allow smbmount_t samba_log_t:dir list_dir_perms; allow smbmount_t samba_log_t:file manage_file_perms; allow smbmount_t samba_secrets_t:file manage_file_perms; manage_dirs_pattern(smbmount_t, samba_var_t, samba_var_t) manage_files_pattern(smbmount_t, samba_var_t, samba_var_t) manage_lnk_files_pattern(smbmount_t, samba_var_t, samba_var_t) files_var_filetrans(smbmount_t, samba_var_t, dir, "samba") files_list_var_lib(smbmount_t) kernel_read_system_state(smbmount_t) corenet_all_recvfrom_netlabel(smbmount_t) corenet_tcp_sendrecv_generic_if(smbmount_t) corenet_raw_sendrecv_generic_if(smbmount_t) corenet_udp_sendrecv_generic_if(smbmount_t) corenet_tcp_sendrecv_generic_node(smbmount_t) corenet_raw_sendrecv_generic_node(smbmount_t) corenet_udp_sendrecv_generic_node(smbmount_t) corenet_tcp_sendrecv_all_ports(smbmount_t) corenet_udp_sendrecv_all_ports(smbmount_t) corenet_tcp_bind_generic_node(smbmount_t) corenet_udp_bind_generic_node(smbmount_t) corenet_tcp_connect_all_ports(smbmount_t) fs_getattr_cifs(smbmount_t) fs_mount_cifs(smbmount_t) fs_remount_cifs(smbmount_t) fs_unmount_cifs(smbmount_t) fs_list_cifs(smbmount_t) fs_read_cifs_files(smbmount_t) storage_raw_read_fixed_disk(smbmount_t) storage_raw_write_fixed_disk(smbmount_t) corecmd_list_bin(smbmount_t) files_list_mnt(smbmount_t) files_mounton_mnt(smbmount_t) files_manage_etc_runtime_files(smbmount_t) files_etc_filetrans_etc_runtime(smbmount_t, file) auth_use_nsswitch(smbmount_t) locallogin_use_fds(smbmount_t) logging_search_logs(smbmount_t) userdom_use_inherited_user_terminals(smbmount_t) userdom_use_all_users_fds(smbmount_t) optional_policy(` cups_read_rw_config(smbmount_t) ') optional_policy(` mount_use_fds(smbmount_t) ') ######################################## # # SWAT Local policy # allow swat_t self:capability { dac_read_search setuid setgid sys_resource }; allow swat_t self:capability2 block_suspend; allow swat_t self:process { setrlimit signal_perms }; allow swat_t self:fifo_file rw_fifo_file_perms; allow swat_t self:netlink_tcpdiag_socket r_netlink_socket_perms; allow swat_t self:tcp_socket create_stream_socket_perms; allow swat_t self:udp_socket create_socket_perms; allow swat_t self:unix_stream_socket connectto; samba_domtrans_smbd(swat_t) allow swat_t smbd_t:process { signal signull }; samba_domtrans_nmbd(swat_t) allow swat_t nmbd_t:process { signal signull }; allow nmbd_t swat_t:process signal; read_files_pattern(swat_t, nmbd_var_run_t, nmbd_var_run_t) stream_connect_pattern(swat_t, nmbd_var_run_t, nmbd_var_run_t, nmbd_t) allow swat_t smbd_port_t:tcp_socket name_bind; allow swat_t nmbd_port_t:udp_socket name_bind; rw_files_pattern(swat_t, samba_etc_t, samba_etc_t) read_lnk_files_pattern(swat_t, samba_etc_t, samba_etc_t) manage_dirs_pattern(swat_t, samba_log_t, samba_log_t) manage_files_pattern(swat_t, samba_log_t, samba_log_t) manage_files_pattern(swat_t, samba_etc_t, samba_secrets_t) manage_dirs_pattern(swat_t, samba_var_t, samba_var_t) manage_files_pattern(swat_t, samba_var_t, samba_var_t) files_var_filetrans(swat_t, samba_var_t, dir, "samba") allow swat_t smbd_exec_t:file mmap_file_perms ; allow swat_t smbd_t:process signull; allow swat_t smbd_var_run_t:file read_file_perms; allow swat_t smbd_var_run_t:file { lock unlink }; manage_dirs_pattern(swat_t, swat_tmp_t, swat_tmp_t) manage_files_pattern(swat_t, swat_tmp_t, swat_tmp_t) files_tmp_filetrans(swat_t, swat_tmp_t, { file dir }) manage_files_pattern(swat_t, swat_var_run_t, swat_var_run_t) files_pid_filetrans(swat_t, swat_var_run_t, file) allow swat_t winbind_exec_t:file mmap_file_perms; domtrans_pattern(swat_t, winbind_exec_t, winbind_t) allow swat_t winbind_t:process { signal signull }; read_files_pattern(swat_t, winbind_var_run_t, winbind_var_run_t) allow swat_t winbind_var_run_t:dir { write add_name remove_name }; allow swat_t winbind_var_run_t:sock_file { create unlink }; kernel_read_kernel_sysctls(swat_t) kernel_read_system_state(swat_t) kernel_read_network_state(swat_t) corecmd_search_bin(swat_t) corenet_all_recvfrom_netlabel(swat_t) corenet_tcp_sendrecv_generic_if(swat_t) corenet_udp_sendrecv_generic_if(swat_t) corenet_raw_sendrecv_generic_if(swat_t) corenet_tcp_sendrecv_generic_node(swat_t) corenet_udp_sendrecv_generic_node(swat_t) corenet_raw_sendrecv_generic_node(swat_t) corenet_tcp_sendrecv_all_ports(swat_t) corenet_udp_sendrecv_all_ports(swat_t) corenet_tcp_connect_smbd_port(swat_t) corenet_tcp_connect_ipp_port(swat_t) corenet_sendrecv_smbd_client_packets(swat_t) corenet_sendrecv_ipp_client_packets(swat_t) dev_read_urand(swat_t) files_list_var_lib(swat_t) files_search_home(swat_t) fs_getattr_xattr_fs(swat_t) auth_domtrans_chk_passwd(swat_t) auth_use_nsswitch(swat_t) init_read_utmp(swat_t) init_dontaudit_write_utmp(swat_t) logging_send_syslog_msg(swat_t) logging_send_audit_msgs(swat_t) logging_search_logs(swat_t) sysnet_use_ldap(swat_t) userdom_dontaudit_search_admin_dir(swat_t) optional_policy(` cups_read_rw_config(swat_t) cups_stream_connect(swat_t) ') optional_policy(` inetd_service_domain(swat_t, swat_exec_t) ') optional_policy(` kerberos_use(swat_t) ') ######################################## # # Winbind local policy # allow winbind_t self:capability { kill dac_read_search ipc_lock setuid sys_nice }; allow winbind_t self:capability2 block_suspend; dontaudit winbind_t self:capability { net_admin sys_tty_config }; allow winbind_t self:process { signal_perms getsched setsched }; allow winbind_t self:fifo_file rw_fifo_file_perms; allow winbind_t self:unix_dgram_socket { create_socket_perms sendto }; allow winbind_t self:unix_stream_socket create_stream_socket_perms; allow winbind_t self:tcp_socket create_stream_socket_perms; allow winbind_t self:udp_socket create_socket_perms; allow winbind_t self:socket create_socket_perms; allow winbind_t self:cap_userns { kill }; allow winbind_t nmbd_t:process { signal signull }; read_files_pattern(winbind_t, nmbd_var_run_t, nmbd_var_run_t) samba_stream_connect_nmbd(winbind_t) allow winbind_t samba_etc_t:dir list_dir_perms; read_files_pattern(winbind_t, samba_etc_t, samba_etc_t) read_lnk_files_pattern(winbind_t, samba_etc_t, samba_etc_t) manage_files_pattern(winbind_t, samba_etc_t, samba_secrets_t) filetrans_pattern(winbind_t, samba_etc_t, samba_secrets_t, file) manage_dirs_pattern(winbind_t, samba_log_t, samba_log_t) manage_files_pattern(winbind_t, samba_log_t, samba_log_t) manage_lnk_files_pattern(winbind_t, samba_log_t, samba_log_t) manage_dirs_pattern(winbind_t, samba_var_t, samba_var_t) manage_files_pattern(winbind_t, samba_var_t, samba_var_t) manage_lnk_files_pattern(winbind_t, samba_var_t, samba_var_t) manage_sock_files_pattern(winbind_t, samba_var_t, samba_var_t) files_var_filetrans(winbind_t, samba_var_t, dir, "samba") allow winbind_t samba_var_t:file { map } ; manage_files_pattern(winbind_t, smbd_tmp_t, smbd_tmp_t) allow winbind_t winbind_log_t:file manage_file_perms; logging_log_filetrans(winbind_t, winbind_log_t, file) userdom_manage_user_tmp_dirs(winbind_t) userdom_manage_user_tmp_files(winbind_t) userdom_tmp_filetrans_user_tmp(winbind_t, { file dir }) manage_dirs_pattern(winbind_t, { smbd_var_run_t winbind_var_run_t }, winbind_var_run_t) manage_files_pattern(winbind_t, winbind_var_run_t, winbind_var_run_t) manage_sock_files_pattern(winbind_t, winbind_var_run_t, winbind_var_run_t) files_pid_filetrans(winbind_t, winbind_var_run_t, { sock_file file dir }) files_pid_filetrans(winbind_t, winbind_rpcd_var_run_t, file, "samba-dcerpcd.pid") filetrans_pattern(winbind_t, smbd_var_run_t, winbind_var_run_t, dir) # /run/samba/krb5cc_samba manage_files_pattern(winbind_t, smbd_var_run_t, smbd_var_run_t) manage_dirs_pattern(winbind_t, smbd_var_run_t, smbd_var_run_t) manage_sock_files_pattern(winbind_t, smbd_var_run_t, smbd_var_run_t) kernel_read_network_state(winbind_t) kernel_read_kernel_sysctls(winbind_t) kernel_read_system_state(winbind_t) kernel_signull(winbind_t) kernel_request_load_module(winbind_t) corecmd_exec_bin(winbind_t) corenet_all_recvfrom_netlabel(winbind_t) corenet_tcp_sendrecv_generic_if(winbind_t) corenet_udp_sendrecv_generic_if(winbind_t) corenet_raw_sendrecv_generic_if(winbind_t) corenet_tcp_sendrecv_generic_node(winbind_t) corenet_udp_sendrecv_generic_node(winbind_t) corenet_raw_sendrecv_generic_node(winbind_t) corenet_tcp_sendrecv_all_ports(winbind_t) corenet_udp_sendrecv_all_ports(winbind_t) corenet_tcp_bind_generic_node(winbind_t) corenet_udp_bind_generic_node(winbind_t) corenet_tcp_connect_smbd_port(winbind_t) corenet_tcp_connect_epmap_port(winbind_t) corenet_tcp_connect_all_unreserved_ports(winbind_t) corenet_tcp_connect_all_ephemeral_ports(winbind_t) dev_read_sysfs(winbind_t) dev_read_urand(winbind_t) fs_getattr_all_fs(winbind_t) fs_search_auto_mountpoints(winbind_t) auth_domtrans_chk_passwd(winbind_t) auth_use_nsswitch(winbind_t) auth_manage_cache(winbind_t) domain_use_interactive_fds(winbind_t) files_read_usr_symlinks(winbind_t) files_list_var_lib(winbind_t) logging_send_syslog_msg(winbind_t) miscfiles_read_generic_certs(winbind_t) sysnet_use_ldap(winbind_t) userdom_dontaudit_use_unpriv_user_fds(winbind_t) userdom_manage_user_home_content_dirs(winbind_t) userdom_manage_user_home_content_files(winbind_t) userdom_manage_user_home_content_symlinks(winbind_t) userdom_manage_user_home_content_pipes(winbind_t) userdom_manage_user_home_content_sockets(winbind_t) userdom_filetrans_home_content(winbind_t) optional_policy(` ctdbd_stream_connect(winbind_t) ctdbd_manage_lib_files(winbind_t) ctdbd_manage_lib_dirs(winbind_t) ') optional_policy(` dirsrv_stream_connect(winbind_t) ') optional_policy(` kerberos_use(winbind_t) kerberos_filetrans_named_content(winbind_t) ') optional_policy(` nis_authenticate(winbind_t) ') optional_policy(` seutil_sigchld_newrole(winbind_t) ') optional_policy(` systemd_hostnamed_signull(winbind_t) ') optional_policy(` udev_read_db(winbind_t) ') ######################################## # # Winbind helper local policy # allow winbind_helper_t self:unix_dgram_socket create_socket_perms; allow winbind_helper_t self:unix_stream_socket create_stream_socket_perms; allow winbind_helper_t samba_etc_t:dir list_dir_perms; read_files_pattern(winbind_helper_t, samba_etc_t, samba_etc_t) read_lnk_files_pattern(winbind_helper_t, samba_etc_t, samba_etc_t) allow winbind_helper_t samba_var_t:dir search_dir_perms; files_list_var_lib(winbind_helper_t) allow winbind_t smbcontrol_t:process signal; allow winbind_t smbcontrol_t:unix_dgram_socket sendto; stream_connect_pattern(winbind_helper_t, winbind_var_run_t, winbind_var_run_t, winbind_t) kernel_read_network_state(winbind_helper_t) dev_read_urand(winbind_helper_t) term_list_ptys(winbind_helper_t) corecmd_exec_bin(winbind_helper_t) domain_use_interactive_fds(winbind_helper_t) files_list_tmp(winbind_helper_t) auth_use_nsswitch(winbind_helper_t) logging_send_syslog_msg(winbind_helper_t) userdom_use_inherited_user_terminals(winbind_helper_t) optional_policy(` apache_append_log(winbind_helper_t) ') optional_policy(` squid_read_log(winbind_helper_t) squid_append_log(winbind_helper_t) squid_rw_stream_sockets(winbind_helper_t) ') ######################################## # # Winbind-rpcd local policy # allow winbind_rpcd_t self:capability { setgid setuid }; allow winbind_rpcd_t self:key { read write }; allow winbind_rpcd_t self:netlink_route_socket create_netlink_socket_perms; allow winbind_rpcd_t self:process setcap; allow winbind_rpcd_t self:unix_dgram_socket { create_socket_perms sendto }; allow winbind_rpcd_t self:unix_stream_socket connectto; allow winbind_rpcd_t self:udp_socket create_socket_perms; allow winbind_rpcd_t winbind_rpcd_exec_t:file execute_no_trans; read_files_pattern(winbind_rpcd_t, samba_etc_t, samba_etc_t) write_files_pattern(winbind_rpcd_t, winbind_var_run_t, winbind_var_run_t) write_sock_files_pattern(winbind_rpcd_t, winbind_var_run_t, winbind_var_run_t) manage_files_pattern(winbind_rpcd_t, winbind_rpcd_var_run_t, winbind_rpcd_var_run_t) files_pid_filetrans(winbind_rpcd_t, winbind_rpcd_var_run_t, { dir file }) manage_files_pattern(winbind_rpcd_t, winbind_rpcd_tmp_t, winbind_rpcd_tmp_t) files_tmp_filetrans(winbind_rpcd_t, winbind_rpcd_tmp_t, file) # access to files of other samba domains manage_dirs_pattern(winbind_rpcd_t, samba_share_t, samba_share_t) manage_files_pattern(winbind_rpcd_t, samba_share_t, samba_share_t) manage_dirs_pattern(winbind_rpcd_t, smbd_var_run_t, smbd_var_run_t) read_files_pattern(winbind_rpcd_t, smbd_var_run_t, smbd_var_run_t) manage_sock_files_pattern(winbind_rpcd_t, smbd_var_run_t, smbd_var_run_t) manage_dirs_pattern(winbind_rpcd_t, samba_log_t, samba_log_t) manage_files_pattern(winbind_rpcd_t, samba_log_t, samba_log_t) manage_dirs_pattern(winbind_rpcd_t, samba_var_t, samba_var_t) manage_files_pattern(winbind_rpcd_t, samba_var_t, samba_var_t) manage_sock_files_pattern(winbind_rpcd_t, samba_var_t, samba_var_t) allow winbind_rpcd_t samba_var_t:file { map } ; manage_files_pattern(winbind_rpcd_t, smbd_tmp_t, smbd_tmp_t) kernel_read_network_state(winbind_rpcd_t) corecmd_exec_bin(winbind_rpcd_t) corenet_tcp_connect_ipp_port(winbind_rpcd_t) corenet_tcp_connect_ldap_port(winbind_rpcd_t) dev_getattr_fs(winbind_rpcd_t) term_getattr_pty_fs(winbind_rpcd_t) term_use_ptmx(winbind_rpcd_t) optional_policy(` auth_domtrans_chk_passwd(winbind_rpcd_t) auth_read_passwd(winbind_rpcd_t) ') optional_policy(` cups_read_config(winbind_rpcd_t) cups_stream_connect(winbind_rpcd_t) ') optional_policy(` dbus_system_bus_client(winbind_rpcd_t) ') optional_policy(` dirsrv_stream_connect(winbind_rpcd_t) ') optional_policy(` init_stream_connectto(winbind_rpcd_t) ') optional_policy(` kerberos_read_keytab(winbind_rpcd_t) kerberos_use(winbind_rpcd_t) ') optional_policy(` logging_send_syslog_msg(winbind_rpcd_t) ') optional_policy(` lpd_domtrans_lpr(winbind_rpcd_t) ') optional_policy(` miscfiles_read_generic_certs(winbind_rpcd_t) miscfiles_read_public_files(winbind_rpcd_t) ') optional_policy(` nscd_socket_use(winbind_rpcd_t) ') optional_policy(` sssd_read_public_files(winbind_rpcd_t) sssd_stream_connect(winbind_rpcd_t) ') optional_policy(` sysnet_read_config(winbind_rpcd_t) ') optional_policy(` systemd_machined_stream_connect(winbind_rpcd_t) systemd_userdbd_stream_connect(winbind_rpcd_t) ') optional_policy(` term_use_generic_ptys(winbind_rpcd_t) ') optional_policy(` unconfined_dgram_send(winbind_rpcd_t) ') # inter-process communication with other samba domains allow smbd_t winbind_rpcd_t:process noatsecure; allow smbd_t winbind_rpcd_t:unix_stream_socket connectto; allow winbind_t winbind_rpcd_t:unix_stream_socket connectto; allow winbind_rpcd_t nmbd_t:unix_dgram_socket sendto; allow winbind_rpcd_t smbd_t:unix_dgram_socket sendto; allow winbind_rpcd_t winbind_t:unix_dgram_socket sendto; allow winbind_rpcd_t winbind_t:unix_stream_socket connectto; samba_domtrans_winbind_rpcd(smbd_t) samba_domtrans_winbind_rpcd(winbind_t) ######################################## # # samba_unconfined_script_t local policy # optional_policy(` type samba_unconfined_net_t; domain_type(samba_unconfined_net_t) domain_entry_file(samba_unconfined_net_t, samba_net_exec_t) role system_r types samba_unconfined_net_t; unconfined_domain(samba_unconfined_net_t) manage_files_pattern(samba_unconfined_net_t, samba_etc_t, samba_secrets_t) filetrans_pattern(samba_unconfined_net_t, samba_etc_t, samba_secrets_t, file) userdom_use_inherited_user_terminals(samba_unconfined_net_t) ') type samba_unconfined_script_t; type samba_unconfined_script_exec_t; domain_type(samba_unconfined_script_t) domain_entry_file(samba_unconfined_script_t, samba_unconfined_script_exec_t) corecmd_shell_entry_type(samba_unconfined_script_t) role system_r types samba_unconfined_script_t; allow smbd_t samba_unconfined_script_exec_t:dir search_dir_perms; allow smbd_t samba_unconfined_script_exec_t:file ioctl; optional_policy(` unconfined_domain(samba_unconfined_script_t) ') tunable_policy(`samba_run_unconfined',` domtrans_pattern(smbd_t, samba_unconfined_script_exec_t, samba_unconfined_script_t) ',` can_exec(smbd_t, samba_unconfined_script_exec_t) ')