Changeset 2684

Show
Ignore:
Timestamp:
05/15/08 08:51:09 (6 months ago)
Author:
pebenito
Message:

rbacsep: cut-n-paste collapse admin layer.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rbacsep/policy/modules/admin/su.te

    r2553 r2684  
    11 
    22policy_module(su,1.8.0) 
     3 
     4gen_require(` 
     5        bool secure_mode; 
     6') 
    37 
    48######################################## 
     
    711# 
    812 
    9 attribute su_domain_type; 
     13type su_t; 
     14type su_exec_t; 
     15application_domain(su_t, su_exec_t) 
     16domain_interactive_fd(su_t) 
    1017 
    11 type su_exec_t; 
    12 corecmd_executable_file(su_exec_t) 
     18######################################## 
     19
     20# Local policy 
     21
     22 
     23allow su_t self:capability { audit_control audit_write setuid setgid net_bind_service chown dac_override fowner sys_nice sys_resource }; 
     24dontaudit su_t self:capability sys_tty_config; 
     25allow su_t self:process { setexec setsched setrlimit }; 
     26allow su_t self:fifo_file rw_fifo_file_perms; 
     27allow su_t self:netlink_audit_socket { nlmsg_relay create_netlink_socket_perms }; 
     28allow su_t self:key { search write }; 
     29 
     30# Transition from the user domain to this domain. 
     31domtrans_pattern($2, su_exec_t, su_t) 
     32 
     33allow $2 su_t:process signal; 
     34 
     35# By default, revert to the calling domain when a shell is executed. 
     36corecmd_shell_domtrans(su_t,$2) 
     37allow $2 su_t:fd use; 
     38allow $2 su_t:fifo_file rw_file_perms; 
     39allow $2 su_t:process sigchld; 
     40 
     41kernel_read_system_state(su_t) 
     42kernel_read_kernel_sysctls(su_t) 
     43kernel_search_key(su_t) 
     44kernel_link_key(su_t) 
     45 
     46# for SSP 
     47dev_read_urand(su_t) 
     48 
     49fs_search_auto_mountpoints(su_t) 
     50 
     51# needed for pam_rootok 
     52selinux_compute_access_vector(su_t) 
     53 
     54auth_domtrans_user_chk_passwd($1,su_t) 
     55auth_dontaudit_read_shadow(su_t) 
     56auth_use_nsswitch(su_t) 
     57auth_rw_faillog(su_t) 
     58 
     59corecmd_search_bin(su_t) 
     60 
     61domain_use_interactive_fds(su_t) 
     62 
     63files_read_etc_files(su_t) 
     64files_read_etc_runtime_files(su_t) 
     65files_search_var_lib(su_t) 
     66files_dontaudit_getattr_tmp_dirs(su_t) 
     67 
     68init_dontaudit_use_fds(su_t) 
     69# Write to utmp. 
     70init_rw_utmp(su_t) 
     71 
     72mls_file_write_all_levels(su_t) 
     73 
     74libs_use_ld_so(su_t) 
     75libs_use_shared_libs(su_t) 
     76 
     77logging_send_syslog_msg(su_t) 
     78 
     79miscfiles_read_localization(su_t) 
     80 
     81userdom_use_user_terminals($1,su_t) 
     82userdom_search_user_home_dirs($1,su_t) 
     83 
     84ifdef(`distro_rhel4',` 
     85        domain_role_change_exemption(su_t) 
     86        domain_subj_id_change_exemption(su_t) 
     87        domain_obj_id_change_exemption(su_t) 
     88 
     89        selinux_get_fs_mount(su_t) 
     90        selinux_validate_context(su_t) 
     91        selinux_compute_create_context(su_t) 
     92        selinux_compute_relabel_context(su_t) 
     93        selinux_compute_user_contexts(su_t) 
     94 
     95        # Relabel ttys and ptys. 
     96        term_relabel_all_user_ttys(su_t) 
     97        term_relabel_all_user_ptys(su_t) 
     98        # Close and re-open ttys and ptys to get the fd into the correct domain. 
     99        term_use_all_user_ttys(su_t) 
     100        term_use_all_user_ptys(su_t) 
     101 
     102        seutil_read_config(su_t) 
     103        seutil_read_default_contexts(su_t) 
     104 
     105        if(secure_mode) { 
     106                # Only allow transitions to unprivileged user domains. 
     107                userdom_spec_domtrans_unpriv_users(su_t) 
     108        } else { 
     109                # Allow transitions to all user domains 
     110                userdom_spec_domtrans_all_users(su_t) 
     111        } 
     112 
     113        optional_policy(` 
     114                unconfined_domtrans(su_t) 
     115                unconfined_signal(su_t) 
     116        ') 
     117') 
     118 
     119tunable_policy(`allow_polyinstantiation',` 
     120        fs_mount_xattr_fs(su_t) 
     121        fs_unmount_xattr_fs(su_t) 
     122') 
     123 
     124tunable_policy(`use_nfs_home_dirs',` 
     125        fs_search_nfs(su_t) 
     126') 
     127 
     128tunable_policy(`use_samba_home_dirs',` 
     129        fs_search_cifs(su_t) 
     130') 
     131 
     132optional_policy(` 
     133        cron_read_pipes(su_t) 
     134') 
     135 
     136optional_policy(` 
     137        kerberos_use(su_t) 
     138') 
     139 
     140# Modify .Xauthority file (via xauth program). 
     141optional_policy(` 
     142        xserver_user_home_dir_filetrans_user_xauth($1, su_t) 
     143        xserver_domtrans_user_xauth($1, su_t) 
     144') 
  • branches/rbacsep/policy/modules/admin/sudo.te

    r2553 r2684  
    55# 
    66# Declarations 
     7# 
    78 
     9type sudo_t; 
    810type sudo_exec_t; 
    9 application_executable_file(sudo_exec_t) 
     11application_domain(sudo_t, sudo_exec_t) 
     12domain_interactive_fd(sudo_t) 
    1013 
    11 # Remaining policy in per user domain template. 
     14############################## 
     15
     16# Local Policy 
     17
     18 
     19# Use capabilities. 
     20allow sudo_t self:capability { fowner setuid setgid dac_override sys_resource }; 
     21allow sudo_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; 
     22allow sudo_t self:process { setexec setrlimit }; 
     23allow sudo_t self:fd use; 
     24allow sudo_t self:fifo_file rw_fifo_file_perms; 
     25allow sudo_t self:shm create_shm_perms; 
     26allow sudo_t self:sem create_sem_perms; 
     27allow sudo_t self:msgq create_msgq_perms; 
     28allow sudo_t self:msg { send receive }; 
     29allow sudo_t self:unix_dgram_socket create_socket_perms; 
     30allow sudo_t self:unix_stream_socket create_stream_socket_perms; 
     31allow sudo_t self:unix_dgram_socket sendto; 
     32allow sudo_t self:unix_stream_socket connectto; 
     33allow sudo_t self:netlink_audit_socket { create bind write nlmsg_read read }; 
     34 
     35# Enter this derived domain from the user domain 
     36domtrans_pattern($2, sudo_exec_t, sudo_t) 
     37 
     38# By default, revert to the calling domain when a shell is executed. 
     39corecmd_shell_domtrans(sudo_t,$2) 
     40allow $2 sudo_t:fd use; 
     41allow $2 sudo_t:fifo_file rw_file_perms; 
     42allow $2 sudo_t:process sigchld; 
     43 
     44kernel_read_kernel_sysctls(sudo_t) 
     45kernel_read_system_state(sudo_t) 
     46kernel_search_key(sudo_t) 
     47 
     48dev_read_urand(sudo_t) 
     49 
     50fs_search_auto_mountpoints(sudo_t) 
     51fs_getattr_xattr_fs(sudo_t) 
     52 
     53auth_domtrans_chk_passwd(sudo_t) 
     54# sudo stores a token in the pam_pid directory 
     55auth_manage_pam_pid(sudo_t) 
     56auth_use_nsswitch(sudo_t) 
     57 
     58corecmd_read_bin_symlinks(sudo_t) 
     59corecmd_getattr_all_executables(sudo_t) 
     60 
     61domain_use_interactive_fds(sudo_t) 
     62domain_sigchld_interactive_fds(sudo_t) 
     63domain_getattr_all_entry_files(sudo_t) 
     64 
     65files_read_etc_files(sudo_t) 
     66files_read_var_files(sudo_t) 
     67files_read_usr_symlinks(sudo_t) 
     68files_getattr_usr_files(sudo_t) 
     69# for some PAM modules and for cwd 
     70files_dontaudit_search_home(sudo_t) 
     71 
     72init_rw_utmp(sudo_t) 
     73 
     74libs_use_ld_so(sudo_t) 
     75libs_use_shared_libs(sudo_t) 
     76 
     77logging_send_syslog_msg(sudo_t) 
     78 
     79miscfiles_read_localization(sudo_t) 
     80 
     81userdom_manage_user_home_content_files($1,sudo_t) 
     82userdom_manage_user_home_content_symlinks($1,sudo_t) 
     83userdom_manage_user_tmp_files($1,sudo_t) 
     84userdom_manage_user_tmp_symlinks($1,sudo_t) 
     85userdom_use_user_terminals($1,sudo_t) 
     86userdom_use_unpriv_users_fds(sudo_t) 
     87# for some PAM modules and for cwd 
     88userdom_dontaudit_search_all_users_home_content(sudo_t)