## Thunderbird email client ####################################### ## ## The per role template for the thunderbird module. ## ## ##

## This template creates a derived domain which is used ## for the thunderbird email client. ##

##

## This template is invoked automatically for each user, and ## generally does not need to be invoked directly ## by policy writers. ##

##
## ## ## The prefix of the user domain (e.g., user ## is the prefix for user_t). ## ## ## ## ## The type of the user domain. ## ## ## ## ## The role associated with the user domain. ## ## # template(`thunderbird_per_role_template',` ######################################## # # Declarations # type $1_thunderbird_t; domain_type($1_thunderbird_t) domain_entry_file($1_thunderbird_t,thunderbird_exec_t) role $3 types $1_thunderbird_t; type $1_thunderbird_home_t alias $1_thunderbird_rw_t; files_poly_member($1_thunderbird_home_t) userdom_user_home_content($1, $1_thunderbird_home_t) type $1_thunderbird_tmpfs_t; files_tmpfs_file($1_thunderbird_tmpfs_t) ######################################## # # Local policy # allow $1_thunderbird_t self:capability sys_nice; allow $1_thunderbird_t self:process { signal_perms setsched getsched execheap execmem execstack }; allow $1_thunderbird_t self:fifo_file { ioctl read write getattr }; allow $1_thunderbird_t self:unix_dgram_socket { create connect }; allow $1_thunderbird_t self:unix_stream_socket { create accept connect write getattr read listen bind }; allow $1_thunderbird_t self:tcp_socket create_socket_perms; allow $1_thunderbird_t self:shm { read write create destroy unix_read unix_write }; allow $1_thunderbird_t self:netlink_route_socket r_netlink_socket_perms; # Access ~/.thunderbird manage_dirs_pattern($1_thunderbird_t,$1_thunderbird_home_t,$1_thunderbird_home_t) manage_files_pattern($1_thunderbird_t,$1_thunderbird_home_t,$1_thunderbird_home_t) manage_lnk_files_pattern($1_thunderbird_t,$1_thunderbird_home_t,$1_thunderbird_home_t) userdom_search_user_home_dirs($1,$1_thunderbird_t) manage_files_pattern($1_thunderbird_t,$1_thunderbird_tmpfs_t,$1_thunderbird_tmpfs_t) manage_lnk_files_pattern($1_thunderbird_t,$1_thunderbird_tmpfs_t,$1_thunderbird_tmpfs_t) manage_fifo_files_pattern($1_thunderbird_t,$1_thunderbird_tmpfs_t,$1_thunderbird_tmpfs_t) manage_sock_files_pattern($1_thunderbird_t,$1_thunderbird_tmpfs_t,$1_thunderbird_tmpfs_t) fs_tmpfs_filetrans($1_thunderbird_t,$1_thunderbird_tmpfs_t,{ dir file lnk_file sock_file fifo_file }) allow $2 $1_thunderbird_t:fd use; allow $2 $1_thunderbird_t:shm { associate getattr }; allow $2 $1_thunderbird_t:unix_stream_socket connectto; allow $1_thunderbird_t $2:fd use; allow $1_thunderbird_t $2:process sigchld; allow $1_thunderbird_t $2:unix_stream_socket connectto; # Allow the user domain to signal/ps. ps_process_pattern($2,$1_thunderbird_t) # Access ~/.thunderbird manage_dirs_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) manage_files_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) manage_lnk_files_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) relabel_dirs_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) relabel_files_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) relabel_lnk_files_pattern($2,$1_thunderbird_home_t,$1_thunderbird_home_t) # Allow netstat kernel_read_network_state($1_thunderbird_t) kernel_read_net_sysctls($1_thunderbird_t) kernel_read_system_state($1_thunderbird_t) corecmd_exec_shell($1_thunderbird_t) # Startup shellscript corecmd_search_sbin($1_thunderbird_t) corenet_non_ipsec_sendrecv($1_thunderbird_t) corenet_tcp_sendrecv_generic_if($1_thunderbird_t) corenet_tcp_sendrecv_all_nodes($1_thunderbird_t) corenet_tcp_sendrecv_ipp_port($1_thunderbird_t) corenet_tcp_sendrecv_ldap_port($1_thunderbird_t) corenet_tcp_sendrecv_innd_port($1_thunderbird_t) corenet_tcp_sendrecv_smtp_port($1_thunderbird_t) corenet_tcp_sendrecv_pop_port($1_thunderbird_t) corenet_tcp_sendrecv_http_port($1_thunderbird_t) corenet_tcp_connect_ipp_port($1_thunderbird_t) corenet_tcp_connect_ldap_port($1_thunderbird_t) corenet_tcp_connect_innd_port($1_thunderbird_t) corenet_tcp_connect_smtp_port($1_thunderbird_t) corenet_tcp_connect_pop_port($1_thunderbird_t) corenet_tcp_connect_http_port($1_thunderbird_t) corenet_sendrecv_ipp_client_packets($1_thunderbird_t) corenet_sendrecv_ldap_client_packets($1_thunderbird_t) corenet_sendrecv_innd_client_packets($1_thunderbird_t) corenet_sendrecv_smtp_client_packets($1_thunderbird_t) corenet_sendrecv_pop_client_packets($1_thunderbird_t) corenet_sendrecv_http_client_packets($1_thunderbird_t) dev_read_urand($1_thunderbird_t) dev_dontaudit_search_sysfs($1_thunderbird_t) files_list_tmp($1_thunderbird_t) files_read_usr_files($1_thunderbird_t) files_read_etc_files($1_thunderbird_t) files_read_etc_runtime_files($1_thunderbird_t) files_read_var_files($1_thunderbird_t) files_read_var_symlinks($1_thunderbird_t) files_dontaudit_getattr_all_tmp_files($1_thunderbird_t) files_dontaudit_getattr_boot_dirs($1_thunderbird_t) files_dontaudit_getattr_lost_found_dirs($1_thunderbird_t) files_dontaudit_search_mnt($1_thunderbird_t) fs_getattr_xattr_fs($1_thunderbird_t) fs_list_inotifyfs($1_thunderbird_t) # Access ~/.thunderbird fs_search_auto_mountpoints($1_thunderbird_t) libs_use_shared_libs($1_thunderbird_t) libs_use_ld_so($1_thunderbird_t) miscfiles_read_fonts($1_thunderbird_t) miscfiles_read_localization($1_thunderbird_t) sysnet_read_config($1_thunderbird_t) # Allow DNS sysnet_dns_name_resolve($1_thunderbird_t) userdom_manage_user_tmp_dirs($1,$1_thunderbird_t) userdom_read_user_tmp_files($1,$1_thunderbird_t) userdom_write_user_tmp_sockets($1,$1_thunderbird_t) userdom_manage_user_tmp_sockets($1,$1_thunderbird_t) # .kde/....gtkrc userdom_read_user_home_content_files($1,$1_thunderbird_t) xserver_user_client_template($1,$1_thunderbird_t,$1_thunderbird_tmpfs_t) xserver_read_xdm_tmp_files($1_thunderbird_t) xserver_dontaudit_getattr_xdm_tmp_sockets($1_thunderbird_t) # Transition from user type tunable_policy(`! disable_thunderbird_trans',` domain_auto_trans($2, thunderbird_exec_t, $1_thunderbird_t) ') # Access ~/.thunderbird tunable_policy(`use_nfs_home_dirs',` fs_manage_nfs_dirs($1_thunderbird_t) fs_manage_nfs_files($1_thunderbird_t) fs_manage_nfs_symlinks($1_thunderbird_t) ') tunable_policy(`use_samba_home_dirs',` fs_manage_cifs_dirs($1_thunderbird_t) fs_manage_cifs_files($1_thunderbird_t) fs_manage_cifs_symlinks($1_thunderbird_t) ') tunable_policy(`mail_read_content && use_nfs_home_dirs',` files_list_home($1_thunderbird_t) fs_list_auto_mountpoints($1_thunderbird_t) fs_read_nfs_files($1_thunderbird_t) fs_read_nfs_symlinks($1_thunderbird_t) ',` files_dontaudit_list_home($1_thunderbird_t) fs_dontaudit_list_auto_mountpoints($1_thunderbird_t) fs_dontaudit_list_nfs($1_thunderbird_t) fs_dontaudit_read_nfs_files($1_thunderbird_t) ') tunable_policy(`mail_read_content && use_samba_home_dirs',` files_list_home($1_thunderbird_t) fs_list_auto_mountpoints($1_thunderbird_t) fs_read_cifs_files($1_thunderbird_t) fs_read_cifs_symlinks($1_thunderbird_t) ',` files_dontaudit_list_home($1_thunderbird_t) fs_dontaudit_list_auto_mountpoints($1_thunderbird_t) fs_dontaudit_read_cifs_files($1_thunderbird_t) fs_dontaudit_list_cifs($1_thunderbird_t) ') tunable_policy(`mail_read_content',` userdom_list_user_tmp($1,$1_thunderbird_t) userdom_read_user_tmp_files($1,$1_thunderbird_t) userdom_read_user_tmp_symlinks($1,$1_thunderbird_t) userdom_search_user_home_dirs($1,$1_thunderbird_t) userdom_read_user_home_content_files($1,$1_thunderbird_t) ifndef(`enable_mls',` fs_search_removable($1_thunderbird_t) fs_read_removable_files($1_thunderbird_t) fs_read_removable_symlinks($1_thunderbird_t) ') ',` files_dontaudit_list_tmp($1_thunderbird_t) files_dontaudit_list_home($1_thunderbird_t) fs_dontaudit_list_removable($1_thunderbird_t) fs_dontaudit_read_removable_files($1_thunderbird_t) userdom_dontaudit_list_user_tmp($1,$1_thunderbird_t) userdom_dontaudit_read_user_tmp_files($1,$1_thunderbird_t) userdom_dontaudit_list_user_home_dirs($1,$1_thunderbird_t) userdom_dontaudit_read_user_home_content_files($1,$1_thunderbird_t) ') tunable_policy(`mail_read_content && read_default_t',` files_list_default($1_thunderbird_t) files_read_default_files($1_thunderbird_t) files_read_default_symlinks($1_thunderbird_t) ',` files_dontaudit_read_default_files($1_thunderbird_t) files_dontaudit_list_default($1_thunderbird_t) ') tunable_policy(`mail_read_content && read_untrusted_content',` files_list_tmp($1_thunderbird_t) files_list_home($1_thunderbird_t) userdom_search_user_home_dirs($1,$1_thunderbird_t) userdom_list_user_untrusted_content($1,$1_thunderbird_t) userdom_read_user_untrusted_content_files($1,$1_thunderbird_t) userdom_read_user_untrusted_content_symlinks($1,$1_thunderbird_t) userdom_list_user_tmp_untrusted_content($1,$1_thunderbird_t) userdom_read_user_tmp_untrusted_content_files($1,$1_thunderbird_t) userdom_read_user_tmp_untrusted_content_symlinks($1,$1_thunderbird_t) ',` files_dontaudit_list_tmp($1_thunderbird_t) files_dontaudit_list_home($1_thunderbird_t) userdom_dontaudit_list_user_home_dirs($1,$1_thunderbird_t) userdom_dontaudit_list_user_untrusted_content($1,$1_thunderbird_t) userdom_dontaudit_read_user_untrusted_content_files($1,$1_thunderbird_t) userdom_dontaudit_list_user_tmp_untrusted_content($1,$1_thunderbird_t) userdom_dontaudit_read_user_tmp_untrusted_content_files($1,$1_thunderbird_t) ') # Manage nfs homedirs tunable_policy(`write_untrusted_content && use_nfs_home_dirs',` files_search_home($1_thunderbird_t) fs_search_auto_mountpoints($1_thunderbird_t) fs_manage_nfs_dirs($1_thunderbird_t) fs_manage_nfs_files($1_thunderbird_t) fs_manage_nfs_symlinks($1_thunderbird_t) ',` fs_dontaudit_list_auto_mountpoints($1_thunderbird_t) fs_dontaudit_manage_nfs_dirs($1_thunderbird_t) fs_dontaudit_manage_nfs_files($1_thunderbird_t) ') # Manage samba homedirs tunable_policy(`write_untrusted_content && use_samba_home_dirs',` files_search_home($1_thunderbird_t) fs_search_auto_mountpoints($1_thunderbird_t) fs_manage_cifs_dirs($1_thunderbird_t) fs_manage_cifs_files($1_thunderbird_t) fs_manage_cifs_symlinks($1_thunderbird_t) ',` fs_dontaudit_list_auto_mountpoints($1_thunderbird_t) fs_dontaudit_manage_cifs_dirs($1_thunderbird_t) fs_dontaudit_manage_cifs_files($1_thunderbird_t) ') # Manage /tmp and /home tunable_policy(`write_untrusted_content',` files_search_home($1_thunderbird_t) files_tmp_filetrans($1_thunderbird_t,$1_untrusted_content_tmp_t,file) files_tmp_filetrans($1_thunderbird_t,$1_untrusted_content_tmp_t,dir) userdom_manage_user_untrusted_content_files($1,$1_thunderbird_t) userdom_manage_user_untrusted_content_tmp_files($1, $1_thunderbird_t) userdom_user_home_dir_filetrans($1,$1_thunderbird_t,$1_untrusted_content_tmp_t, { file dir }) userdom_user_home_content_filetrans($1,$1_thunderbird_t,$1_untrusted_content_tmp_t, { file dir }) ',` files_dontaudit_list_home($1_thunderbird_t) files_dontaudit_list_tmp($1_thunderbird_t) userdom_dontaudit_list_user_home_dirs($1,$1_thunderbird_t) userdom_dontaudit_manage_user_tmp_dirs($1,$1_thunderbird_t) userdom_dontaudit_manage_user_tmp_files($1,$1_thunderbird_t) userdom_dontaudit_manage_user_home_content_dirs($1,$1_thunderbird_t) ') optional_policy(` dbus_system_bus_client_template($1_thunderbird,$1_thunderbird_t) dbus_user_bus_client_template($1,$1_thunderbird,$1_thunderbird_t) dbus_send_system_bus($1_thunderbird_t) dbus_send_user_bus($1,$1_thunderbird_t) ') optional_policy(` cups_read_rw_config($1_thunderbird_t) cups_dbus_chat($1_thunderbird_t) ') optional_policy(` gnome_stream_connect_gconf_template($1,$1_thunderbird_t) gnome_domtrans_user_gconf($1, $1_thunderbird_t) gnome_manage_user_gnome_config($1, $1_thunderbird_t) ') optional_policy(` gpg_domtrans_user_gpg($1,$1_thunderbird_t) ') optional_policy(` lpd_domtrans_user_lpr($1,$1_thunderbird_t) ') optional_policy(` mozilla_read_user_home_files($1, $1_thunderbird_t) mozilla_domtrans_user_mozilla($1, $1_thunderbird_t) mozilla_dbus_chat($1, $1_thunderbird_t) ') optional_policy(` nis_use_ypbind($1_thunderbird_t) ') optional_policy(` nscd_socket_use($1_thunderbird_t) ') ifdef(`TODO',` # FIXME: Rules were removed to centralize policy in a gnome_app macro # A similar thing might be necessary for mozilla compiled without GNOME # support (is this possible?). # GNOME support optional_policy(` gnome_application($1_thunderbird, $1) gnome_file_dialog($1_thunderbird, $1) allow $1_thunderbird_t $1_gnome_settings_t:file { read write }; ') ') ') ######################################## ## ## Run thunderbird in the user thunderbird domain. ## ## ##

## Run thunderbird in the user thunderbird domain. ##

##

## This is a templated interface, and should only ## be called from a per-userdomain template. ##

##
## ## ## The prefix of the user domain (e.g., user ## is the prefix for user_t). ## ## ## ## ## Domain allowed access. ## ## # template(`thunderbird_domtrans_user_thunderbird',` gen_require(` type $1_thunderbird_t, thunderbird_exec_t; ') domtrans_pattern($2, thunderbird_exec_t,$1_thunderbird_t) ')