Changeset 2686

Show
Ignore:
Timestamp:
05/19/08 12:57:28 (7 months ago)
Author:
pebenito
Message:

rbacsep: collapse services except xserver.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rbacsep/policy/modules/services/apache.te

    r2675 r2686  
    187187type httpd_tmpfs_t; 
    188188files_tmpfs_file(httpd_tmpfs_t) 
     189 
     190apache_content_template(user) 
    189191 
    190192# for apache2 memory mapped files 
     
    722724 
    723725miscfiles_read_localization(httpd_rotatelogs_t) 
     726 
     727######################################## 
     728# 
     729# User content local policy 
     730# 
     731 
     732typeattribute httpd_user_script_t httpd_script_domains; 
     733userdom_user_home_content($1,httpd_user_content_t) 
     734 
     735allow $2 httpd_user_content_t:{ dir file lnk_file } { relabelto relabelfrom }; 
     736 
     737allow $2 httpd_user_htaccess_t:file { manage_file_perms relabelto relabelfrom }; 
     738 
     739manage_dirs_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     740manage_files_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     741manage_lnk_files_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     742relabel_dirs_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     743relabel_files_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     744relabel_lnk_files_pattern($2,httpd_user_script_ra_t,httpd_user_script_ra_t) 
     745 
     746manage_dirs_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     747manage_files_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     748manage_lnk_files_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     749relabel_dirs_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     750relabel_files_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     751relabel_lnk_files_pattern($2,httpd_user_script_ro_t,httpd_user_script_ro_t) 
     752 
     753manage_dirs_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     754manage_files_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     755manage_lnk_files_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     756relabel_dirs_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     757relabel_files_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     758relabel_lnk_files_pattern($2,httpd_user_script_rw_t,httpd_user_script_rw_t) 
     759 
     760manage_dirs_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     761manage_files_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     762manage_lnk_files_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     763relabel_dirs_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     764relabel_files_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     765relabel_lnk_files_pattern($2,httpd_user_script_exec_t,httpd_user_script_exec_t) 
     766 
     767tunable_policy(`httpd_enable_cgi',` 
     768        # If a user starts a script by hand it gets the proper context 
     769        domtrans_pattern($2, httpd_user_script_exec_t, httpd_user_script_t) 
     770') 
     771 
     772tunable_policy(`httpd_enable_cgi && httpd_unified',` 
     773        allow httpd_user_script_t httpdcontent:file entrypoint; 
     774 
     775        domtrans_pattern($2, httpdcontent, httpd_user_script_t) 
     776') 
     777 
     778# allow accessing files/dirs below the users home dir 
     779tunable_policy(`httpd_enable_homedirs',` 
     780        userdom_search_user_home_dirs($1,httpd_t) 
     781        userdom_search_user_home_dirs($1,httpd_suexec_t) 
     782        userdom_search_user_home_dirs($1,httpd_user_script_t) 
     783') 
  • branches/rbacsep/policy/modules/services/bluetooth.te

    r2675 r2686  
    1616files_type(bluetooth_conf_rw_t) 
    1717 
    18 attribute bluetooth_helper_domain; 
    19  
     18type bluetooth_helper_t; 
    2019type bluetooth_helper_exec_t; 
    21 application_executable_file(bluetooth_helper_exec_t) 
     20application_domain(bluetooth_helper_t, bluetooth_helper_exec_t) 
     21 
     22type bluetooth_helper_tmp_t; 
     23files_tmp_file(bluetooth_helper_tmp_t) 
     24 
     25type bluetooth_helper_tmpfs_t; 
     26files_tmpfs_file(bluetooth_helper_tmpfs_t) 
    2227 
    2328type bluetooth_lock_t; 
     
    146151        ppp_domtrans(bluetooth_t) 
    147152') 
     153 
     154######################################## 
     155# 
     156# Bluetooth helper programs local policy 
     157# 
     158 
     159allow bluetooth_helper_t self:capability sys_nice; 
     160allow bluetooth_helper_t self:process getsched; 
     161allow bluetooth_helper_t self:fifo_file rw_fifo_file_perms; 
     162allow bluetooth_helper_t self:shm create_shm_perms; 
     163allow bluetooth_helper_t self:unix_stream_socket { create_stream_socket_perms connectto }; 
     164allow bluetooth_helper_t self:tcp_socket create_socket_perms; 
     165allow bluetooth_helper_t self:netlink_route_socket r_netlink_socket_perms; 
     166 
     167allow bluetooth_helper_t bluetooth_t:socket { read write }; 
     168 
     169manage_dirs_pattern(bluetooth_helper_t, bluetooth_helper_tmp_t, bluetooth_helper_tmp_t) 
     170manage_files_pattern(bluetooth_helper_t, bluetooth_helper_tmp_t, bluetooth_helper_tmp_t) 
     171manage_sock_files_pattern(bluetooth_helper_t, bluetooth_helper_tmp_t, bluetooth_helper_tmp_t) 
     172files_tmp_filetrans(bluetooth_helper_t, bluetooth_helper_tmp_t, { file dir sock_file }) 
     173 
     174manage_dirs_pattern(bluetooth_helper_t, bluetooth_helper_tmpfs_t, bluetooth_helper_tmpfs_t) 
     175manage_files_pattern(bluetooth_helper_t, bluetooth_helper_tmpfs_t, bluetooth_helper_tmpfs_t) 
     176fs_tmpfs_filetrans(bluetooth_helper_t, bluetooth_helper_tmpfs_t, { dir file }) 
     177 
     178kernel_read_system_state(bluetooth_helper_t) 
     179kernel_read_kernel_sysctls(bluetooth_helper_t) 
     180 
     181dev_read_urand(bluetooth_helper_t) 
     182 
     183term_dontaudit_use_all_user_ttys(bluetooth_helper_t) 
     184 
     185corecmd_exec_bin(bluetooth_helper_t) 
     186corecmd_exec_shell(bluetooth_helper_t) 
     187 
     188domain_read_all_domains_state(bluetooth_helper_t) 
     189 
     190files_read_etc_files(bluetooth_helper_t) 
     191files_read_etc_runtime_files(bluetooth_helper_t) 
     192files_read_usr_files(bluetooth_helper_t) 
     193files_dontaudit_list_default(bluetooth_helper_t) 
     194 
     195libs_use_ld_so(bluetooth_helper_t) 
     196libs_use_shared_libs(bluetooth_helper_t) 
     197 
     198locallogin_dontaudit_use_fds(bluetooth_helper_t) 
     199 
     200logging_send_syslog_msg(bluetooth_helper_t) 
     201 
     202miscfiles_read_localization(bluetooth_helper_t)  
     203 
     204sysnet_read_config(bluetooth_helper_t) 
     205 
     206optional_policy(` 
     207        bluetooth_dbus_chat(bluetooth_helper_t) 
     208 
     209        dbus_system_bus_client_template(bluetooth_helper, bluetooth_helper_t) 
     210        dbus_connect_system_bus(bluetooth_helper_t) 
     211') 
     212 
     213optional_policy(` 
     214        nscd_socket_use(bluetooth_helper_t) 
     215') 
     216 
     217optional_policy(` 
     218        xserver_user_x_domain_template($1, bluetooth_helper, bluetooth_helper_t, bluetooth_helper_tmpfs_t) 
     219') 
  • branches/rbacsep/policy/modules/services/cron.fc

    r2051 r2686  
    4242 
    4343/var/spool/fcron                -d      gen_context(system_u:object_r:cron_spool_t,s0) 
    44 /var/spool/fcron/.*                   <<none>> 
     44/var/spool/fcron/[^/]*                        <<none>> 
    4545/var/spool/fcron/systab\.orig   --      gen_context(system_u:object_r:system_cron_spool_t,s0) 
    4646/var/spool/fcron/systab         --      gen_context(system_u:object_r:system_cron_spool_t,s0) 
  • branches/rbacsep/policy/modules/services/cron.if

    r2449 r2686  
    267267####################################### 
    268268## <summary> 
     269##      The common rules for a crontab domain. 
     270## </summary> 
     271## <param name="userdomain_prefix"> 
     272##      <summary> 
     273##      The prefix of the user domain (e.g., user 
     274##      is the prefix for user_t). 
     275##      </summary> 
     276## </param> 
     277# 
     278template(`cron_common_crontab_template',` 
     279        gen_require(` 
     280                type crontab_exec_t, user_cron_spool_t; 
     281        ') 
     282 
     283        ############################## 
     284        # 
     285        # Declarations 
     286        # 
     287 
     288        type $1_t; 
     289        application_domain($1_t, crontab_exec_t) 
     290 
     291        type $1_tmp_t; 
     292        files_tmp_file($1_tmp_t) 
     293 
     294        ############################## 
     295        # 
     296        # Local policy 
     297        # 
     298 
     299        # dac_override is to create the file in the directory under /tmp 
     300        allow $1_t self:capability { fowner setuid setgid chown dac_override }; 
     301        allow $1_t self:process signal_perms; 
     302 
     303        # Transition from the user domain to the derived domain. 
     304        domtrans_pattern($2, crontab_exec_t, $1_t) 
     305 
     306        # crontab shows up in user ps 
     307        ps_process_pattern($2,$1_t) 
     308 
     309        # for ^Z 
     310        allow $2 $1_t:process signal; 
     311 
     312        # Allow crond to read those crontabs in cron spool. 
     313        allow crond_t $1_cron_spool_t:file manage_file_perms; 
     314 
     315        allow $1_t $1_tmp_t:file manage_file_perms; 
     316        files_tmp_filetrans($1_t,$1_tmp_t,file) 
     317 
     318        # create files in /var/spool/cron 
     319        # cjp: change this to a role transition 
     320        manage_files_pattern($1_t, cron_spool_t, user_cron_spool_t) 
     321        filetrans_pattern($1_t, cron_spool_t, user_cron_spool_t, file) 
     322        files_search_spool($1_t) 
     323 
     324        # crontab signals crond by updating the mtime on the spooldir 
     325        allow $1_t cron_spool_t:dir setattr; 
     326 
     327        kernel_read_system_state($1_t) 
     328 
     329        # for the checks used by crontab -u 
     330        selinux_dontaudit_search_fs($1_t) 
     331 
     332        fs_getattr_xattr_fs($1_t) 
     333 
     334        # Run helper programs as the user domain 
     335        corecmd_bin_domtrans($1_t,$2) 
     336        corecmd_shell_domtrans($1_t,$2) 
     337 
     338        domain_use_interactive_fds($1_t) 
     339 
     340        files_read_etc_files($1_t) 
     341        files_dontaudit_search_pids($1_t) 
     342 
     343        libs_use_ld_so($1_t) 
     344        libs_use_shared_libs($1_t) 
     345 
     346        logging_send_syslog_msg($1_t) 
     347 
     348        miscfiles_read_localization($1_t) 
     349 
     350        seutil_read_config($1_t) 
     351 
     352        userdom_manage_user_tmp_dirs($1,$1_t) 
     353        userdom_manage_user_tmp_files($1,$1_t) 
     354        # Access terminals. 
     355        userdom_use_user_terminals($1,$1_t) 
     356        # Read user crontabs 
     357        userdom_read_user_home_content_files($1,$1_t) 
     358 
     359        tunable_policy(`fcron_crond',` 
     360                # fcron wants an instant update of a crontab change for the administrator 
     361                # also crontab does a security check for crontab -u 
     362                dontaudit $1_t crond_t:process signal; 
     363        ') 
     364 
     365        optional_policy(` 
     366                nscd_socket_use($1_t) 
     367        ') 
     368') 
     369 
     370####################################### 
     371## <summary> 
    269372##      The administrative functions template for the cron module. 
    270373## </summary> 
     
    287390                attribute cron_spool_type; 
    288391                type $1_crontab_t, $1_crond_t; 
    289         ') 
     392                class passwd crontab; 
     393        ') 
     394 
     395        # Manipulate other users crontab. 
     396        allow $2 self:passwd crontab; 
    290397 
    291398        # Allow our crontab domain to unlink a user cron spool file. 
     
    306413                # also crontab does a security check for crontab -u 
    307414                allow $1_crontab_t self:process setfscreate; 
    308                 selinux_get_fs_mount($1_crontab_t) 
    309415        ') 
    310416') 
     
    328434interface(`cron_system_entry',` 
    329435        gen_require(` 
    330                 type crond_t, system_crond_t; 
    331         ') 
    332  
    333         domain_auto_trans(system_crond_t, $2, $1) 
     436                type crond_t, system_cronjob_t; 
     437        ') 
     438 
     439        domain_auto_trans(system_cronjob_t, $2, $1) 
    334440 
    335441        # cjp: perhaps these four rules from the old 
    336442        # domain_auto_trans are not needed? 
    337         allow $1 system_crond_t:fd use; 
    338         allow $1 system_crond_t:fifo_file rw_file_perms; 
    339         allow $1 system_crond_t:process sigchld; 
     443        allow $1 system_cronjob_t:fd use; 
     444        allow $1 system_cronjob_t:fifo_file rw_file_perms; 
     445        allow $1 system_cronjob_t:process sigchld; 
    340446 
    341447        allow $1 crond_t:fifo_file rw_file_perms; 
     
    486592interface(`cron_anacron_domtrans_system_job',` 
    487593        gen_require(` 
    488                 type system_crond_t, anacron_exec_t; 
    489         ') 
    490  
    491         domtrans_pattern($1,anacron_exec_t,system_crond_t) 
     594                type system_cronjob_t, anacron_exec_t; 
     595        ') 
     596 
     597        domtrans_pattern($1,anacron_exec_t,system_cronjob_t) 
    492598') 
    493599 
     
    505611interface(`cron_use_system_job_fds',` 
    506612        gen_require(` 
    507                 type system_crond_t; 
    508         ') 
    509  
    510         allow $1 system_crond_t:fd use; 
     613                type system_cronjob_t; 
     614        ') 
     615 
     616        allow $1 system_cronjob_t:fd use; 
    511617') 
    512618 
     
    523629interface(`cron_write_system_job_pipes',` 
    524630        gen_require(` 
    525                 type system_crond_t; 
    526         ') 
    527  
    528         allow $1 system_crond_t:file write; 
     631                type system_cronjob_t; 
     632        ') 
     633 
     634        allow $1 system_cronjob_t:file write; 
    529635') 
    530636 
     
    541647interface(`cron_rw_system_job_pipes',` 
    542648        gen_require(` 
    543                 type system_crond_t; 
    544         ') 
    545  
    546         allow $1 system_crond_t:fifo_file rw_fifo_file_perms; 
     649                type system_cronjob_t; 
     650        ') 
     651 
     652        allow $1 system_cronjob_t:fifo_file rw_fifo_file_perms; 
    547653') 
    548654 
     
    559665interface(`cron_read_system_job_tmp_files',` 
    560666        gen_require(` 
    561                 type system_crond_tmp_t; 
     667                type system_cronjob_tmp_t; 
    562668        ') 
    563669 
    564670        files_search_tmp($1) 
    565         allow $1 system_crond_tmp_t:file read_file_perms; 
     671        allow $1 system_cronjob_tmp_t:file read_file_perms; 
    566672') 
    567673 
     
    579685interface(`cron_dontaudit_append_system_job_tmp_files',` 
    580686        gen_require(` 
    581                 type system_crond_tmp_t; 
    582         ') 
    583  
    584         dontaudit $1 system_crond_tmp_t:file append; 
    585 ') 
     687                type system_cronjob_tmp_t; 
     688        ') 
     689 
     690        dontaudit $1 system_cronjob_tmp_t:file append; 
     691') 
  • branches/rbacsep/policy/modules/services/cron.te

    r2553 r2686  
    5858application_executable_file(crontab_exec_t) 
    5959 
     60cron_common_crontab_template(admin_crontab) 
     61 
     62cron_common_crontab_template(crontab) 
     63 
    6064type system_cron_spool_t, cron_spool_type; 
    6165files_type(system_cron_spool_t) 
    6266 
    63 type system_crond_t; 
    64 init_daemon_domain(system_crond_t,anacron_exec_t) 
    65 corecmd_shell_entry_type(system_crond_t) 
    66 role system_r types system_crond_t; 
    67  
    68 type system_crond_lock_t; 
    69 files_lock_file(system_crond_lock_t) 
    70  
    71 type system_crond_tmp_t; 
    72 files_tmp_file(system_crond_tmp_t) 
     67type system_cronjob_t alias system_crond_t; 
     68init_daemon_domain(system_cronjob_t,anacron_exec_t) 
     69corecmd_shell_entry_type(system_cronjob_t) 
     70role system_r types system_cronjob_t; 
     71 
     72type system_cronjob_lock_t alias system_crond_lock_t; 
     73files_lock_file(system_cronjob_lock_t) 
     74 
     75type system_cronjob_tmp_t alias system_crond_tmp_t; 
     76files_tmp_file(system_cronjob_tmp_t) 
    7377 
    7478ifdef(`enable_mcs',` 
     
    7680') 
    7781 
     82type cronjob_t; 
     83domain_type(cronjob_t) 
     84domain_cron_exemption_target(cronjob_t) 
     85corecmd_shell_entry_type(cronjob_t) 
     86role $3 types cronjob_t; 
     87 
     88# Type of user crontabs once moved to cron spool. 
     89type user_cron_spool_t, cron_spool_type; 
     90files_type(user_cron_spool_t) 
     91 
    7892######################################## 
    7993# 
    80 # Cron Local policy 
     94# Admin crontab local policy 
     95
     96 
     97# Manipulate other users crontab. 
     98allow $2 self:passwd crontab; 
     99 
     100# Allow our crontab domain to unlink a user cron spool file. 
     101allow admin_crontab_t cron_spool_type:file { getattr read unlink }; 
     102 
     103# Manipulate other users crontab. 
     104selinux_get_fs_mount(admin_crontab_t) 
     105selinux_validate_context(admin_crontab_t) 
     106selinux_compute_access_vector(admin_crontab_t) 
     107selinux_compute_create_context(admin_crontab_t) 
     108selinux_compute_relabel_context(admin_crontab_t) 
     109selinux_compute_user_contexts(admin_crontab_t) 
     110 
     111tunable_policy(`fcron_crond', ` 
     112        # fcron wants an instant update of a crontab change for the administrator 
     113        # also crontab does a security check for crontab -u 
     114        allow admin_crontab_t self:process setfscreate; 
     115') 
     116 
     117######################################## 
     118
     119# Cron daemon local policy 
    81120# 
    82121 
     
    222261# 
    223262 
    224 allow system_crond_t self:capability { dac_override dac_read_search chown setgid setuid fowner net_bind_service fsetid }; 
    225 allow system_crond_t self:process { signal_perms setsched }; 
    226 allow system_crond_t self:fifo_file rw_fifo_file_perms; 
    227 allow system_crond_t self:passwd rootok; 
     263allow system_cronjob_t self:capability { dac_override dac_read_search chown setgid setuid fowner net_bind_service fsetid }; 
     264allow system_cronjob_t self:process { signal_perms setsched }; 
     265allow system_cronjob_t self:fifo_file rw_fifo_file_perms; 
     266allow system_cronjob_t self:passwd rootok; 
    228267 
    229268# This is to handle creation of files in /var/log directory. 
    230269#  Used currently by rpm script log files 
    231 allow system_crond_t cron_log_t:file manage_file_perms; 
    232 logging_log_filetrans(system_crond_t,cron_log_t,file) 
     270allow system_cronjob_t cron_log_t:file manage_file_perms; 
     271logging_log_filetrans(system_cronjob_t,cron_log_t,file) 
    233272 
    234273# This is to handle /var/lib/misc directory.  Used currently 
    235274# by prelink var/lib files for cron  
    236 allow system_crond_t cron_var_lib_t:file manage_file_perms; 
    237 files_var_lib_filetrans(system_crond_t,cron_var_lib_t,file) 
    238  
    239 allow system_crond_t system_cron_spool_t:file read_file_perms; 
     275allow system_cronjob_t cron_var_lib_t:file manage_file_perms; 
     276files_var_lib_filetrans(system_cronjob_t,cron_var_lib_t,file) 
     277 
     278allow system_cronjob_t system_cron_spool_t:file read_file_perms; 
    240279# The entrypoint interface is not used as this is not 
    241280# a regular entrypoint.  Since crontab files are 
     
    245284# performs an entrypoint permission check 
    246285# for this purpose. 
    247 allow system_crond_t system_cron_spool_t:file entrypoint; 
     286allow system_cronjob_t system_cron_spool_t:file entrypoint; 
    248287 
    249288# Permit a transition from the crond_t domain to this domain. 
     
    251290# via setexeccon.  There is no way to set up an automatic 
    252291# transition, since crontabs are configuration files, not executables. 
    253 allow crond_t system_crond_t:process transition; 
    254 dontaudit crond_t system_crond_t:process { noatsecure siginh rlimitinh }; 
    255 allow crond_t system_crond_t:fd use; 
    256 allow system_crond_t crond_t:fd use; 
    257 allow system_crond_t crond_t:fifo_file rw_file_perms; 
    258 allow system_crond_t crond_t:process sigchld; 
     292allow crond_t system_cronjob_t:process transition; 
     293dontaudit crond_t system_cronjob_t:process { noatsecure siginh rlimitinh }; 
     294allow crond_t system_cronjob_t:fd use; 
     295allow system_cronjob_t crond_t:fd use; 
     296allow system_cronjob_t crond_t:fifo_file rw_file_perms; 
     297allow system_cronjob_t crond_t:process sigchld; 
    259298 
    260299# Write /var/lock/makewhatis.lock. 
    261 allow system_crond_t system_crond_lock_t:file manage_file_perms; 
    262 files_lock_filetrans(system_crond_t,system_crond_lock_t,file) 
     300allow system_cronjob_t system_cronjob_lock_t:file manage_file_perms; 
     301files_lock_filetrans(system_cronjob_t,system_cronjob_lock_t,file) 
    263302 
    264303# write temporary files 
    265 manage_files_pattern(system_crond_t,crond_tmp_t,system_crond_tmp_t) 
    266 manage_lnk_files_pattern(system_crond_t,crond_tmp_t,system_crond_tmp_t) 
    267 filetrans_pattern(system_crond_t,crond_tmp_t,system_crond_tmp_t,{ file lnk_file }) 
    268 files_tmp_filetrans(system_crond_t,system_crond_tmp_t,file) 
     304manage_files_pattern(system_cronjob_t,crond_tmp_t,system_cronjob_tmp_t) 
     305manage_lnk_files_pattern(system_cronjob_t,crond_tmp_t,system_cronjob_tmp_t) 
     306filetrans_pattern(system_cronjob_t,crond_tmp_t,system_cronjob_tmp_t,{ file lnk_file }) 
     307files_tmp_filetrans(system_cronjob_t,system_cronjob_tmp_t,file) 
    269308 
    270309# Read from /var/spool/cron. 
    271 allow system_crond_t cron_spool_t:dir list_dir_perms; 
    272 allow system_crond_t cron_spool_t:file read_file_perms; 
    273  
    274 kernel_read_kernel_sysctls(system_crond_t) 
    275 kernel_read_system_state(system_crond_t) 
    276 kernel_read_software_raid_state(system_crond_t) 
     310allow system_cronjob_t cron_spool_t:dir list_dir_perms; 
     311allow system_cronjob_t cron_spool_t:file read_file_perms; 
     312 
     313kernel_read_kernel_sysctls(system_cronjob_t) 
     314kernel_read_system_state(system_cronjob_t) 
     315kernel_read_software_raid_state(system_cronjob_t) 
    277316 
    278317# ps does not need to access /boot when run from cron 
    279 files_dontaudit_search_boot(system_crond_t) 
    280  
    281 corecmd_exec_all_executables(system_crond_t) 
    282  
    283 corenet_all_recvfrom_unlabeled(system_crond_t) 
    284 corenet_all_recvfrom_netlabel(system_crond_t) 
    285 corenet_tcp_sendrecv_all_if(system_crond_t) 
    286 corenet_udp_sendrecv_all_if(system_crond_t) 
    287 corenet_tcp_sendrecv_all_nodes(system_crond_t) 
    288 corenet_udp_sendrecv_all_nodes(system_crond_t) 
    289 corenet_tcp_sendrecv_all_ports(system_crond_t) 
    290 corenet_udp_sendrecv_all_ports(system_crond_t) 
    291  
    292 dev_getattr_all_blk_files(system_crond_t) 
    293 dev_getattr_all_chr_files(system_crond_t) 
    294 dev_read_urand(system_crond_t) 
    295  
    296 fs_getattr_all_fs(system_crond_t) 
    297 fs_getattr_all_files(system_crond_t) 
    298 fs_getattr_all_symlinks(system_crond_t) 
    299 fs_getattr_all_pipes(system_crond_t) 
    300 fs_getattr_all_sockets(system_crond_t) 
     318files_dontaudit_search_boot(system_cronjob_t) 
     319 
     320corecmd_exec_all_executables(system_cronjob_t) 
     321 
     322corenet_all_recvfrom_unlabeled(system_cronjob_t) 
     323corenet_all_recvfrom_netlabel(system_cronjob_t) 
     324corenet_tcp_sendrecv_all_if(system_cronjob_t) 
     325corenet_udp_sendrecv_all_if(system_cronjob_t) 
     326corenet_tcp_sendrecv_all_nodes(system_cronjob_t) 
     327corenet_udp_sendrecv_all_nodes(system_cronjob_t) 
     328corenet_tcp_sendrecv_all_ports(system_cronjob_t) 
     329corenet_udp_sendrecv_all_ports(system_cronjob_t) 
     330 
     331dev_getattr_all_blk_files(system_cronjob_t) 
     332dev_getattr_all_chr_files(system_cronjob_t) 
     333dev_read_urand(system_cronjob_t) 
     334 
     335fs_getattr_all_fs(system_cronjob_t) 
     336fs_getattr_all_files(system_cronjob_t) 
     337fs_getattr_all_symlinks(system_cronjob_t) 
     338fs_getattr_all_pipes(system_cronjob_t) 
     339fs_getattr_all_sockets(system_cronjob_t) 
    301340 
    302341# quiet other ps operations 
    303 domain_dontaudit_read_all_domains_state(system_crond_t) 
    304  
    305 files_exec_etc_files(system_crond_t) 
    306 files_read_etc_files(system_crond_t) 
    307 files_read_etc_runtime_files(system_crond_t) 
    308 files_list_all(system_crond_t) 
    309 files_getattr_all_dirs(system_crond_t) 
    310 files_getattr_all_files(system_crond_t) 
    311 files_getattr_all_symlinks(system_crond_t) 
    312 files_getattr_all_pipes(system_crond_t) 
    313 files_getattr_all_sockets(system_crond_t) 
    314 files_read_usr_files(system_crond_t) 
    315 files_read_var_files(system_crond_t) 
     342domain_dontaudit_read_all_domains_state(system_cronjob_t) 
     343 
     344files_exec_etc_files(system_cronjob_t) 
     345files_read_etc_files(system_cronjob_t) 
     346files_read_etc_runtime_files(system_cronjob_t) 
     347files_list_all(system_cronjob_t) 
     348files_getattr_all_dirs(system_cronjob_t) 
     349files_getattr_all_files(system_cronjob_t) 
     350files_getattr_all_symlinks(system_cronjob_t) 
     351files_getattr_all_pipes(system_cronjob_t) 
     352files_getattr_all_sockets(system_cronjob_t) 
     353files_read_usr_files(system_cronjob_t) 
     354files_read_var_files(system_cronjob_t) 
    316355# for nscd: 
    317 files_dontaudit_search_pids(system_crond_t) 
     356files_dontaudit_search_pids(system_cronjob_t) 
    318357# Access other spool directories like 
    319358# /var/spool/anacron and /var/spool/slrnpull. 
    320 files_manage_generic_spool(system_crond_t) 
    321  
    322 init_use_script_fds(system_crond_t) 
    323 init_read_utmp(system_crond_t) 
    324 init_dontaudit_rw_utmp(system_crond_t) 
     359files_manage_generic_spool(system_cronjob_t) 
     360 
     361init_use_script_fds(system_cronjob_t) 
     362init_read_utmp(system_cronjob_t) 
     363init_dontaudit_rw_utmp(system_cronjob_t) 
    325364# prelink tells init to restart it self, we either need to allow or dontaudit 
    326 init_write_initctl(system_crond_t) 
    327  
    328 auth_use_nsswitch(system_crond_t) 
    329  
    330 libs_use_ld_so(system_crond_t) 
    331 libs_use_shared_libs(system_crond_t) 
    332 libs_exec_lib_files(system_crond_t) 
    333 libs_exec_ld_so(system_crond_t) 
    334  
    335 logging_read_generic_logs(system_crond_t) 
    336 logging_send_syslog_msg(system_crond_t) 
    337  
    338 miscfiles_read_localization(system_crond_t) 
    339 miscfiles_manage_man_pages(system_crond_t) 
    340  
    341 seutil_read_config(system_crond_t) 
     365init_write_initctl(system_cronjob_t) 
     366 
     367auth_use_nsswitch(system_cronjob_t) 
     368 
     369libs_use_ld_so(system_cronjob_t) 
     370libs_use_shared_libs(system_cronjob_t) 
     371libs_exec_lib_files(system_cronjob_t) 
     372libs_exec_ld_so(system_cronjob_t) 
     373 
     374logging_read_generic_logs(system_cronjob_t) 
     375logging_send_syslog_msg(system_cronjob_t) 
     376 
     377miscfiles_read_localization(system_cronjob_t) 
     378miscfiles_manage_man_pages(system_cronjob_t) 
     379 
     380seutil_read_config(system_cronjob_t) 
    342381 
    343382ifdef(`distro_redhat', ` 
     
    345384        # via redirection of standard out. 
    346385        optional_policy(` 
    347                 rpm_manage_log(system_crond_t) 
     386                rpm_manage_log(system_cronjob_t) 
    348387        ') 
    349388') 
    350389 
    351390tunable_policy(`cron_can_relabel',` 
    352         seutil_domtrans_setfiles(system_crond_t) 
     391        seutil_domtrans_setfiles(system_cronjob_t) 
    353392',` 
    354         selinux_get_fs_mount(system_crond_t) 
    355         selinux_validate_context(system_crond_t) 
    356         selinux_compute_access_vector(system_crond_t) 
    357         selinux_compute_create_context(system_crond_t) 
    358         selinux_compute_relabel_context(system_crond_t) 
    359         selinux_compute_user_contexts(system_crond_t) 
    360         seutil_read_file_contexts(system_crond_t) 
     393        selinux_get_fs_mount(system_cronjob_t) 
     394        selinux_validate_context(system_cronjob_t) 
     395        selinux_compute_access_vector(system_cronjob_t) 
     396        selinux_compute_create_context(system_cronjob_t) 
     397        selinux_compute_relabel_context(system_cronjob_t) 
     398        selinux_compute_user_contexts(system_cronjob_t) 
     399        seutil_read_file_contexts(system_cronjob_t) 
    361400') 
    362401 
    363402optional_policy(` 
    364403        # Needed for certwatch 
    365         apache_exec_modules(system_crond_t) 
    366         apache_read_config(system_crond_t) 
    367         apache_read_log(system_crond_t) 
    368         apache_read_sys_content(system_crond_t) 
    369 ') 
    370  
    371 optional_policy(` 
    372         cyrus_manage_data(system_crond_t) 
    373 ') 
    374  
    375 optional_policy(` 
    376         ftp_read_log(system_crond_t) 
    377 ') 
    378  
    379 optional_policy(` 
    380         inn_manage_log(system_crond_t) 
    381         inn_manage_pid(system_crond_t) 
    382         inn_read_config(system_crond_t) 
    383 ') 
    384  
    385 optional_policy(` 
    386         mrtg_append_create_logs(system_crond_t) 
    387 ') 
    388  
    389 optional_policy(` 
    390         mta_send_mail(system_crond_t) 
    391 ') 
    392  
    393 optional_policy(` 
    394         mysql_read_config(system_crond_t) 
    395 ') 
    396  
    397 optional_policy(` 
    398         postfix_read_config(system_crond_t) 
     404        apache_exec_modules(system_cronjob_t) 
     405        apache_read_config(system_cronjob_t) 
     406        apache_read_log(system_cronjob_t) 
     407        apache_read_sys_content(system_cronjob_t) 
     408') 
     409 
     410optional_policy(` 
     411        cyrus_manage_data(system_cronjob_t) 
     412') 
     413 
     414optional_policy(` 
     415        ftp_read_log(system_cronjob_t) 
     416') 
     417 
     418optional_policy(` 
     419        inn_manage_log(system_cronjob_t) 
     420        inn_manage_pid(system_cronjob_t) 
     421        inn_read_config(system_cronjob_t) 
     422') 
     423 
     424optional_policy(` 
     425        mrtg_append_create_logs(system_cronjob_t) 
     426') 
     427 
     428optional_policy(` 
     429        mta_send_mail(system_cronjob_t) 
     430') 
     431 
     432optional_policy(` 
     433        mysql_read_config(system_cronjob_t) 
     434') 
     435 
     436optional_policy(` 
     437        postfix_read_config(system_cronjob_t) 
    399438')       
    400439 
    401440optional_policy(` 
    402         prelink_read_cache(system_crond_t) 
    403         prelink_manage_log(system_crond_t) 
    404         prelink_delete_cache(system_crond_t) 
    405 ') 
    406  
    407 optional_policy(` 
    408         samba_read_config(system_crond_t) 
    409         samba_read_log(system_crond_t) 
    410         #samba_read_secrets(system_crond_t) 
    411 ') 
    412  
    413 optional_policy(` 
    414         slocate_create_append_log(system_crond_t) 
     441        prelink_read_cache(system_cronjob_t) 
     442        prelink_manage_log(system_cronjob_t) 
     443        prelink_delete_cache(system_cronjob_t) 
     444') 
     445 
     446optional_policy(` 
     447        samba_read_config(system_cronjob_t) 
     448        samba_read_log(system_cronjob_t) 
     449        #samba_read_secrets(system_cronjob_t) 
     450') 
     451 
     452optional_policy(` 
     453        slocate_create_append_log(system_cronjob_t) 
    415454') 
    416455 
    417456optional_policy(` 
    418457        # cjp: why? 
    419         squid_domtrans(system_crond_t) 
    420 ') 
    421  
    422 optional_policy(` 
    423         sysstat_manage_log(system_crond_t) 
    424 ') 
    425  
    426 optional_policy(` 
    427         unconfined_domain(system_crond_t) 
    428  
    429         userdom_priveleged_home_dir_manager(system_crond_t) 
     458        squid_domtrans(system_cronjob_t) 
     459') 
     460 
     461optional_policy(` 
     462        sysstat_manage_log(system_cronjob_t) 
     463') 
     464 
     465optional_policy(` 
     466        unconfined_domain(system_cronjob_t) 
     467 
     468        userdom_priveleged_home_dir_manager(system_cronjob_t) 
    430469') 
    431470 
    432471ifdef(`TODO',` 
    433472ifdef(`mta.te', ` 
    434 allow system_crond_t mail_spool_t:lnk_file read; 
    435 allow mta_user_agent system_crond_t:fd use; 
     473allow system_cronjob_t mail_spool_t:lnk_file read; 
     474allow mta_user_agent system_cronjob_t:fd use; 
    436475r_dir_file(system_mail_t, crond_tmp_t) 
    437476') 
    438477') dnl end TODO 
     478 
     479######################################## 
     480# 
     481# User cronjobs local policy 
     482# 
     483 
     484allow cronjob_t self:capability dac_override; 
     485allow cronjob_t self:process { signal_perms setsched }; 
     486allow cronjob_t self:fifo_file rw_fifo_file_perms; 
     487allow cronjob_t self:unix_stream_socket create_stream_socket_perms; 
     488allow cronjob_t self:unix_dgram_socket create_socket_perms; 
     489 
     490# The entrypoint interface is not used as this is not 
     491# a regular entrypoint.  Since crontab files are 
     492# not directly executed, crond must ensure that 
     493# the crontab file has a type that is appropriate 
     494# for the domain of the user cron job.  It 
     495# performs an entrypoint permission check 
     496# for this purpose. 
     497allow cronjob_t user_cron_spool_t:file entrypoint; 
     498 
     499# Permit a transition from the crond_t domain to this domain. 
     500# The transition is requested explicitly by the modified crond  
     501# via setexeccon.  There is no way to set up an automatic 
     502# transition, since crontabs are configuration files, not executables. 
     503allow crond_t cronjob_t:process transition; 
     504dontaudit crond_t cronjob_t:process { noatsecure siginh rlimitinh }; 
     505allow crond_t cronjob_t:fd use; 
     506allow cronjob_t crond_t:fd use; 
     507allow cronjob_t crond_t:fifo_file rw_file_perms; 
     508allow cronjob_t crond_t:process sigchld; 
     509 
     510kernel_read_system_state(cronjob_t) 
     511kernel_read_kernel_sysctls(cronjob_t) 
     512 
     513# ps does not need to access /boot when run from cron 
     514files_dontaudit_search_boot(cronjob_t) 
     515 
     516corenet_all_recvfrom_unlabeled(cronjob_t) 
     517corenet_all_recvfrom_netlabel(cronjob_t) 
     518corenet_tcp_sendrecv_all_if(cronjob_t) 
     519corenet_udp_sendrecv_all_if(cronjob_t) 
     520corenet_tcp_sendrecv_all_nodes(cronjob_t) 
     521corenet_udp_sendrecv_all_nodes(cronjob_t) 
     522corenet_tcp_sendrecv_all_ports(cronjob_t) 
     523corenet_udp_sendrecv_all_ports(cronjob_t) 
     524corenet_tcp_connect_all_ports(cronjob_t) 
     525corenet_sendrecv_all_client_packets(cronjob_t) 
     526 
     527dev_read_urand(cronjob_t) 
     528 
     529fs_getattr_all_fs(cronjob_t) 
     530 
     531corecmd_exec_all_executables(cronjob_t) 
     532 
     533# quiet other ps operations 
     534domain_dontaudit_read_all_domains_state(cronjob_t) 
     535domain_dontaudit_getattr_all_domains(cronjob_t) 
     536 
     537files_read_usr_files(cronjob_t) 
     538files_exec_etc_files(cronjob_t) 
     539# for nscd: 
     540files_dontaudit_search_pids(cronjob_t) 
     541 
     542libs_use_ld_so(cronjob_t) 
     543libs_use_shared_libs(cronjob_t) 
     544libs_exec_lib_files(cronjob_t) 
     545libs_exec_ld_so(cronjob_t) 
     546 
     547files_read_etc_runtime_files(cronjob_t) 
     548files_read_var_files(cronjob_t) 
     549files_search_spool(cronjob_t) 
     550 
     551logging_search_logs(cronjob_t) 
     552 
     553seutil_read_config(cronjob_t) 
     554 
     555miscfiles_read_localization(cronjob_t) 
     556 
     557userdom_manage_user_tmp_files($1,cronjob_t) 
     558userdom_manage_user_tmp_symlinks($1,cronjob_t) 
     559userdom_manage_user_tmp_pipes($1,cronjob_t) 
     560userdom_manage_user_tmp_sockets($1,cronjob_t) 
     561# Run scripts in user home directory and access shared libs. 
     562userdom_exec_user_home_content_files($1,cronjob_t) 
     563# Access user files and dirs. 
     564#userdom_manage_user_home_subdir_dirs($1,cronjob_t) 
     565userdom_manage_user_home_content_files($1,cronjob_t) 
     566userdom_manage_user_home_content_symlinks($1,cronjob_t) 
     567userdom_manage_user_home_content_pipes($1,cronjob_t) 
     568userdom_manage_user_home_content_sockets($1,cronjob_t) 
     569#userdom_user_home_dir_filetrans_user_home_content($1,cronjob_t,notdevfile_class_set) 
     570 
     571tunable_policy(`fcron_crond', ` 
     572        allow crond_t user_cron_spool_t:file manage_file_perms; 
     573') 
     574 
     575# need a per-role version of this: 
     576#optional_policy(` 
     577#       mono_domtrans(cronjob_t) 
     578#') 
     579 
     580optional_policy(` 
     581        dbus_stub(cronjob_t) 
     582 
     583        allow cronjob_t $2:dbus send_msg; 
     584')               
     585 
     586optional_policy(` 
     587        nis_use_ypbind(cronjob_t) 
     588') 
  • branches/rbacsep/policy/modules/services/dbus.fc

    r2412 r2686  
    22 
    33# Sorting does not work correctly if I combine these next two roles 
    4 /usr/bin/dbus-daemon(-1)? --    gen_context(system_u:object_r:system_dbusd_exec_t,s0) 
    5 /bin/dbus-daemon        --      gen_context(system_u:object_r:system_dbusd_exec_t,s0) 
     4/usr/bin/dbus-daemon(-1)? --    gen_context(system_u:object_r:dbusd_exec_t,s0) 
     5/bin/dbus-daemon        --      gen_context(system_u:object_r:dbusd_exec_t,s0) 
    66 
    77/var/lib/dbus(/.*)?             gen_context(system_u:object_r:system_dbusd_var_lib_t,s0) 
  • branches/rbacsep/policy/modules/services/dbus.te

    r2675 r2686  
    1414files_type(dbusd_etc_t) 
    1515 
     16type session_dbusd_t; 
     17type dbusd_exec_t alias system_dbusd_exec_t; 
     18domain_type(session_dbusd_t) 
     19domain_entry_file(session_dbusd_t, dbusd_exec_t) 
     20 
     21type session_dbusd_tmp_t; 
     22files_tmp_file(session_dbusd_tmp_t) 
     23 
    1624type system_dbusd_t alias dbusd_t; 
    17 type system_dbusd_exec_t; 
    18 init_system_domain(system_dbusd_t,system_dbusd_exec_t) 
     25init_system_domain(system_dbusd_t, dbusd_exec_t) 
    1926 
    2027type system_dbusd_tmp_t; 
     
    3037# 
    3138# Local policy 
     39# 
     40 
     41allow session_dbusd_t self:process { getattr sigkill signal }; 
     42dontaudit session_dbusd_t self:process ptrace; 
     43allow session_dbusd_t self:file { getattr read write }; 
     44allow session_dbusd_t self:fifo_file rw_fifo_file_perms; 
     45allow session_dbusd_t self:dbus { send_msg acquire_svc }; 
     46allow session_dbusd_t self:unix_stream_socket create_stream_socket_perms; 
     47allow session_dbusd_t self:unix_dgram_socket create_socket_perms; 
     48allow session_dbusd_t self:tcp_socket create_stream_socket_perms; 
     49allow session_dbusd_t self:netlink_selinux_socket create_socket_perms; 
     50 
     51# For connecting to the bus 
     52allow $2 session_dbusd_t:unix_stream_socket connectto; 
     53 
     54# SE-DBus specific permissions 
     55allow session_dbusd_t self:dbus send_msg; 
     56allow $2 session_dbusd_t:dbus { send_msg acquire_svc }; 
     57allow $2 system_dbusd_t:dbus { send_msg acquire_svc }; 
     58 
     59allow session_dbusd_t dbusd_etc_t:dir list_dir_perms; 
     60read_files_pattern(session_dbusd_t, dbusd_etc_t, dbusd_etc_t) 
     61read_lnk_files_pattern(session_dbusd_t, dbusd_etc_t, dbusd_etc_t) 
     62 
     63manage_dirs_pattern(session_dbusd_t,session_dbusd_tmp_t,session_dbusd_tmp_t) 
     64manage_files_pattern(session_dbusd_t,session_dbusd_tmp_t,session_dbusd_tmp_t) 
     65files_tmp_filetrans(session_dbusd_t, session_dbusd_tmp_t, { file dir }) 
     66 
     67domtrans_pattern($2, system_dbusd_exec_t, session_dbusd_t) 
     68allow $2 session_dbusd_t:process { sigkill signal }; 
     69 
     70# cjp: this seems very broken 
     71corecmd_bin_domtrans(session_dbusd_t, $2) 
     72allow session_dbusd_t $2:process sigkill; 
     73allow $2 session_dbusd_t:fd use; 
     74allow $2 session_dbusd_t:fifo_file rw_fifo_file_perms; 
     75allow $2 session_dbusd_t:process sigchld; 
     76 
     77kernel_read_system_state(session_dbusd_t) 
     78kernel_read_kernel_sysctls(session_dbusd_t) 
     79 
     80corecmd_list_bin(session_dbusd_t) 
     81corecmd_read_bin_symlinks(session_dbusd_t) 
     82corecmd_read_bin_files(session_dbusd_t) 
     83corecmd_read_bin_pipes(session_dbusd_t) 
     84corecmd_read_bin_sockets(session_dbusd_t) 
     85 
     86corenet_all_recvfrom_unlabeled(session_dbusd_t) 
     87corenet_all_recvfrom_netlabel(session_dbusd_t) 
     88corenet_tcp_sendrecv_all_if(session_dbusd_t) 
     89corenet_tcp_sendrecv_all_nodes(session_dbusd_t)&nb