Changeset 2618

Show
Ignore:
Timestamp:
02/20/08 08:36:48 (10 months ago)
Author:
pebenito
Message:

xselinux: collapse extra attributes into x_domain where possible.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/xselinux/policy/modules/services/xserver.if

    r2609 r2618  
    1717                type xkb_var_lib_t, xserver_exec_t, xserver_log_t; 
    1818 
    19                 attribute x_server_domain, xdevice_type, xresource_type
     19                attribute x_server_domain
    2020                type x_rootwindow_t, x_rootcolormap_t, x_rootscreen_t; 
    2121                class x_drawable all_x_drawable_perms; 
     
    2929        # 
    3030 
    31         attribute $1_xwindow_type
     31        attribute $1_x_domain
    3232        attribute $1_input_xevent_type; 
    3333 
    34         type $1_xserver_t, x_server_domain, xdevice_type, xresource_type
     34        type $1_xserver_t, x_server_domain
    3535        domain_type($1_xserver_t) 
    3636        domain_entry_file($1_xserver_t,xserver_exec_t) 
     
    194194                # but typeattribute doesnt work in conditionals 
    195195                gen_require(` 
    196                         attribute x_server_domain, xdrawable_type; 
    197                         attribute xscreen_type, xgc_type, xfont_type, xcolormap_type; 
    198                         attribute xproperty_type, xselection_type, xcursor_type; 
    199                         attribute xclient_type, xdevice_type, xserver_type; 
    200                         attribute xextension_type, xresource_type, xevent_type; 
     196                        attribute x_server_domain, x_domain; 
     197                        attribute xscreen_type, xfont_type; 
     198                        attribute xproperty_type, xselection_type; 
     199                        attribute xextension_type, xevent_type; 
     200 
     201                        type x_rootcolormap_t, x_rootscreen_t; 
     202                        type x_rootwindow_t, remote_xclient_t; 
    201203                ') 
    202204                allow $1_xserver_t x_server_domain:x_server *; 
    203                 allow $1_xserver_t xdrawable_type:x_drawable *; 
    204                 allow $1_xserver_t xscreen_type:x_screen *; 
    205                 allow $1_xserver_t xgc_type:x_gc *; 
     205                allow $1_xserver_t { x_domain x_rootwindow_t }:x_drawable *; 
     206                allow $1_xserver_t { xscreen_type x_rootscreen_t }:x_screen *; 
     207                allow $1_xserver_t x_domain:x_gc *; 
    206208                allow $1_xserver_t xfont_type:x_font *; 
    207                 allow $1_xserver_t xcolormap_type:x_colormap *; 
     209                allow $1_xserver_t { x_domain x_rootcolormap_t }:x_colormap *; 
    208210                allow $1_xserver_t xproperty_type:x_property *; 
    209211                allow $1_xserver_t xselection_type:x_selection *; 
    210                 allow $1_xserver_t xcursor_type:x_cursor *; 
    211                 allow $1_xserver_t xclient_type:x_client *; 
    212                 allow $1_xserver_t xdevice_type:x_device *; 
     212                allow $1_xserver_t x_domain:x_cursor *; 
     213                allow $1_xserver_t { x_domain remote_xclient_t }:x_client *; 
     214                allow $1_xserver_t { x_domain x_server_domain }:x_device *; 
    213215                allow $1_xserver_t xextension_type:x_extension *; 
    214                 allow $1_xserver_t xresource_type:x_resource *; 
     216                allow $1_xserver_t { x_domain x_server_domain }:x_resource *; 
    215217                allow $1_xserver_t xevent_type:{ x_event x_synthetic_event } *; 
    216218        ') 
     
    468470        tunable_policy(`xserver_object_manager',` 
    469471                # Device rules 
    470                 allow $1_xwindow_type $2:x_device { read getattr setattr setfocus grab bell }; 
    471  
    472                 allow $2 $1_input_xevent_type:x_event send; 
    473                 allow $2 $1_xwindow_type:x_drawable send; 
    474  
    475                 allow $2 input_xevent_t:x_event send; 
    476                 allow $2 x_rootwindow_t:x_drawable send; 
     472                allow $1_x_domain $2:x_device { read getattr setattr setfocus grab bell }; 
     473 
     474                allow $2 { input_xevent_t $1_input_xevent_type }:x_event send; 
     475                allow $2 { x_rootwindow_t $1_x_domain }:x_drawable send; 
    477476        ') 
    478477') 
     
    657656                type clipboard_xselection_t, default_xselection_t; 
    658657 
    659                 attribute x_server_domain, xdevice_type, xdrawable_type, xgc_type
    660                 attribute xcursor_type, xresource_type, xcolormap_type, xproperty_type; 
    661                 attribute xevent_type, xclient_type, xextension_type; 
    662                 attribute $1_xwindow_type, $1_input_xevent_type; 
     658                attribute x_server_domain, x_domain
     659                attribute xproperty_type; 
     660                attribute xevent_type, xextension_type; 
     661                attribute $1_x_domain, $1_input_xevent_type; 
    663662 
    664663                class x_drawable all_x_drawable_perms; 
     
    685684 
    686685        # Type attributes 
    687         typeattribute $3 $1_xwindow_type; 
    688         typeattribute $3 xdevice_type; 
    689         typeattribute $3 xdrawable_type; 
    690         typeattribute $3 xgc_type; 
    691         typeattribute $3 xcursor_type; 
    692         typeattribute $3 xresource_type; 
    693         typeattribute $3 xcolormap_type; 
    694         typeattribute $3 xclient_type; 
     686        typeattribute $3 $1_x_domain, x_domain; 
    695687 
    696688        # Types for properties 
     
    713705        # everyone can get the input focus of everyone else 
    714706        # this is a fundamental brokenness in the X protocol 
    715         allow $3 xdevice_type:x_device getfocus; 
     707        allow $3 { x_domain x_server_domain }:x_device getfocus; 
    716708        # everyone can grab the server 
    717709        # everyone does it, it is basically a free DOS attack 
     
    807799                # but typeattribute doesnt work in conditionals 
    808800                gen_require(` 
    809                         attribute x_server_domain, xdrawable_type; 
    810                         attribute xscreen_type, xgc_type, xfont_type, xcolormap_type; 
    811                         attribute xproperty_type, xselection_type, xcursor_type; 
    812                         attribute xclient_type, xdevice_type, xserver_type; 
    813                         attribute xextension_type, xresource_type, xevent_type; 
     801                        attribute x_server_domain, x_domain; 
     802                        attribute xscreen_type, xfont_type; 
     803                        attribute xproperty_type, xselection_type; 
     804                        attribute xextension_type, xevent_type; 
     805 
     806                        type x_rootcolormap_t, x_rootscreen_t; 
     807                        type x_rootwindow_t, remote_xclient_t; 
    814808                ') 
    815809                allow $3 x_server_domain:x_server *; 
    816                 allow $3 xdrawable_type:x_drawable *; 
    817                 allow $3 xscreen_type:x_screen *; 
    818                 allow $3 xgc_type:x_gc *; 
     810                allow $3 { x_domain x_rootwindow_t }:x_drawable *; 
     811                allow $3 { xscreen_type x_rootscreen_t }:x_screen *; 
     812                allow $3 x_domain:x_gc *; 
    819813                allow $3 xfont_type:x_font *; 
    820                 allow $3 xcolormap_type:x_colormap *; 
     814                allow $3 { x_domain x_rootcolormap_t }:x_colormap *; 
    821815                allow $3 xproperty_type:x_property *; 
    822816                allow $3 xselection_type:x_selection *; 
    823                 allow $3 xcursor_type:x_cursor *; 
    824                 allow $3 xclient_type:x_client *; 
    825                 allow $3 xdevice_type:x_device *; 
     817                allow $3 x_domain:x_cursor *; 
     818                allow $3 { x_domain remote_xclient_t }:x_client *; 
     819                allow $3 { x_domain x_server_domain }:x_device *; 
    826820                allow $3 xextension_type:x_extension *; 
    827                 allow $3 xresource_type:x_resource *; 
     821                allow $3 { x_domain x_server_domain }:x_resource *; 
    828822                allow $3 xevent_type:{ x_event x_synthetic_event } *; 
    829823        ') 
  • branches/xselinux/policy/modules/services/xserver.te

    r2609 r2618  
    3939 
    4040# Per-object attributes 
    41 attribute xdrawable_type
     41attribute x_domain
    4242attribute xscreen_type; 
    43 attribute xgc_type; 
    4443attribute xfont_type; 
    45 attribute xcolormap_type; 
    4644attribute xproperty_type; 
    4745attribute xselection_type; 
    48 attribute xcursor_type; 
    49 attribute xclient_type; 
    50 attribute xdevice_type; 
    51 attribute xserver_type; 
    5246attribute xextension_type; 
    53 attribute xresource_type; 
    5447attribute xevent_type; 
    5548 
     
    7366type output_xext_t, xextension_type; 
    7467type property_xevent_t, xevent_type; 
    75 type remote_xclient_t, xclient_type
     68type remote_xclient_t
    7669type screensaver_xext_t, xextension_type; 
    7770type security_xext_t, xextension_type; 
     
    8174type unknown_xevent_t, xevent_type; 
    8275type unknown_xext_t, xextension_type; 
    83 type x_rootcolormap_t, xcolormap_type
    84 type x_rootscreen_t, xscreen_type
    85 type x_rootwindow_t, xdrawable_type
     76type x_rootcolormap_t
     77type x_rootscreen_t
     78type x_rootwindow_t
    8679 
    8780type xauth_exec_t; 
     
    509502 
    510503allow xserver_unconfined_type x_server_domain:x_server *; 
    511 allow xserver_unconfined_type xdrawable_type:x_drawable *; 
    512 allow xserver_unconfined_type xscreen_type:x_screen *; 
    513 allow xserver_unconfined_type xgc_type:x_gc *; 
     504allow xserver_unconfined_type { x_domain x_rootwindow_t }:x_drawable *; 
     505allow xserver_unconfined_type { xscreen_type x_rootscreen_t }:x_screen *; 
     506allow xserver_unconfined_type x_domain:x_gc *; 
    514507allow xserver_unconfined_type xfont_type:x_font *; 
    515 allow xserver_unconfined_type xcolormap_type:x_colormap *; 
     508allow xserver_unconfined_type { x_domain x_rootcolormap_t }:x_colormap *; 
    516509allow xserver_unconfined_type xproperty_type:x_property *; 
    517510allow xserver_unconfined_type xselection_type:x_selection *; 
    518 allow xserver_unconfined_type xcursor_type:x_cursor *; 
    519 allow xserver_unconfined_type xclient_type:x_client *; 
    520 allow xserver_unconfined_type xdevice_type:x_device *; 
     511allow xserver_unconfined_type x_domain:x_cursor *; 
     512allow xserver_unconfined_type { x_domain remote_xclient_t }:x_client *; 
     513allow xserver_unconfined_type { x_domain x_server_domain }:x_device *; 
    521514allow xserver_unconfined_type xextension_type:x_extension *; 
    522 allow xserver_unconfined_type xresource_type:x_resource *; 
     515allow xserver_unconfined_type { x_domain x_server_domain }:x_resource *; 
    523516allow xserver_unconfined_type xevent_type:{ x_event x_synthetic_event } *; 
    524517