Here is my current diff on xserver policy.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I threw away my XACe changes from my patch and decided to start again.
Here is my current xserver patch
I am looking at the X Server stuff and I have several questions about using this policy.
First most X Apps will run under staff_t.
Some will run in an equivalence class staff_java_t, staff_mono_t.
These should have all the same access between each other
staff_t == staff_java_t == staff_mono_t
How do I do that with Xace policy interface.
I have staff_mozilla_t, and staff_nsplugin_t what interface to I add to these to allow them to work with staff_t defined above? How about if I want to stop nsplugin from reading the cut buffer of staff_t? I also want to stop nsplugin from sniffing the keyboard (xspy), and doing any screen capture.
When I sudo to root, I use unconfined_t. It starts X Apps up like system-config-selinux. How do I define the interactions between this X Client and my staff_* windows?
My xserver runs as xdm_xserver_t but the current interfaces look like they expect it to be labeled staff_xserver_t?
Last time I went through this exercise I ended up with a maze of twisty little passages.
I don't think that anything I asked above is all that complicated but I believe getting the policy correct will be difficult. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkhAZkcACgkQrlYvE4MpobNY2QCgtyEO5rLrsGO6Aa2uMGLw9wUz +OAAoKqcO1hhxQDBfMrHJn3ruM/xsmYw
=smnl
-----END PGP SIGNATURE-----
Subject: [PATCH] refpolicy: services_xserver changes --text follows this line--
policy/modules/services/xserver.fc +19 -15
@@ -1,13 +1,14 @@ # # HOME_DIR # -HOME_DIR/\.fonts\.conf -- gen_context(system_u:object_r:ROLE_fonts_config_t,s0) -HOME_DIR/\.fonts(/.*)? gen_context(system_u:object_r:ROLE_fonts_t,s0) -HOME_DIR/\.fonts/auto(/.*)? gen_context(system_u:object_r:ROLE_fonts_cache_t,s0) -HOME_DIR/\.fonts\.cache-.* -- gen_context(system_u:object_r:ROLE_fonts_cache_t,s0) -HOME_DIR/\.ICEauthority.* -- gen_context(system_u:object_r:ROLE_iceauth_home_t,s0) -HOME_DIR/\.xauth.* -- gen_context(system_u:object_r:ROLE_xauth_home_t,s0) -HOME_DIR/\.Xauthority.* -- gen_context(system_u:object_r:ROLE_xauth_home_t,s0) +HOME_DIR/\.fonts(/.*)? gen_context(system_u:object_r:fonts_home_t,s0) +HOME_DIR/\.fontconfig(/.*)? gen_context(system_u:object_r:fonts_config_home_t,s0) +HOME_DIR/\.fonts\.conf -- gen_context(system_u:object_r:fonts_config_home_t,s0) +HOME_DIR/\.fonts/auto(/.*)? gen_context(system_u:object_r:fonts_cache_home_t,s0) +HOME_DIR/\.fonts\.cache-.* -- gen_context(system_u:object_r:fonts_cache_home_t,s0) +HOME_DIR/\.ICEauthority.* -- gen_context(system_u:object_r:iceauth_home_t,s0) +HOME_DIR/\.xauth.* -- gen_context(system_u:object_r:xauth_home_t,s0) +HOME_DIR/\.Xauthority.* -- gen_context(system_u:object_r:xauth_home_t,s0) # # /dev
@@ -32,11 +33,6 @@ /etc/X11/wdm/Xstartup.* -- gen_context(system_u:object_r:xsession_exec_t,s0) /etc/X11/Xsession[^/]* -- gen_context(system_u:object_r:xsession_exec_t,s0) -ifdef(`distro_redhat',` -/etc/gdm/PostSession/.* -- gen_context(system_u:object_r:xsession_exec_t,s0) -/etc/gdm/PreSession/.* -- gen_context(system_u:object_r:xsession_exec_t,s0) -') - # # /opt #
@@ -58,7 +54,8 @@ # /usr/(s)?bin/gdm-binary -- gen_context(system_u:object_r:xdm_exec_t,s0) -/usr/(s)?bin/[xgkw]dm -- gen_context(system_u:object_r:xdm_exec_t,s0) +/usr/bin/[xgkw]dm -- gen_context(system_u:object_r:xdm_exec_t,s0) +/usr/sbin/[xgkw]dm -- gen_context(system_u:object_r:xdm_exec_t,s0) /usr/bin/gpe-dm -- gen_context(system_u:object_r:xdm_exec_t,s0) /usr/bin/iceauth -- gen_context(system_u:object_r:iceauth_exec_t,s0) /usr/bin/Xair -- gen_context(system_u:object_r:xserver_exec_t,s0)
@@ -89,16 +86,23 @@ /var/[xgk]dm(/.*)? gen_context(system_u:object_r:xserver_log_t,s0) -/var/lib/[xkw]dm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) +/var/lib/[gxkw]dm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) /var/lib/xkb(/.*)? gen_context(system_u:object_r:xkb_var_lib_t,s0) +/var/lib/xorg(/.*)? gen_context(system_u:object_r:xserver_var_lib_t,s0) -/var/log/[kw]dm\.log -- gen_context(system_u:object_r:xserver_log_t,s0) +/var/log/[kw]dm\.log.* -- gen_context(system_u:object_r:xserver_log_t,s0) /var/log/gdm(/.*)? gen_context(system_u:object_r:xserver_log_t,s0) /var/log/XFree86.* -- gen_context(system_u:object_r:xserver_log_t,s0) /var/log/Xorg.* -- gen_context(system_u:object_r:xserver_log_t,s0) +/var/log/nvidia-installer\.log.* -- gen_context(system_u:object_r:xserver_log_t,s0) +/var/run/gdm(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) +/var/run/gdm_socket -s gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/[gx]dm\.pid -- gen_context(system_u:object_r:xdm_var_run_t,s0) +/var/run/video.rom -- gen_context(system_u:object_r:xserver_var_run_t,s0) /var/run/xdmctl(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) +/var/run/xauth(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) +/var/run/xorg(/.*)? gen_context(system_u:object_r:xserver_var_run_t,s0) ifdef(`distro_suse',` /var/lib/pam_devperm/:0 -- gen_context(system_u:object_r:xdm_var_lib_t,s0)
policy/modules/services/xserver.if +357 -62
620 lines not on this page · raw message
policy/modules/services/xserver.te +169 -21
390 lines not on this page · raw message
Quoted 9 lines · Daniel J Walsh
I threw away my XACe changes from my patch and decided to start again.
Here is my current xserver patch
I am looking at the X Server stuff and I have several questions about using this policy.
First most X Apps will run under
staff_t.
Quoted 7 lines
Some will run in an equivalence class
staff_java_t,staff_mono_t.These should have all the same access between each other
staff_t==staff_java_t==staff_mono_tHow do I do that with Xace policy interface.
1) Transition all the X objects created by those domains into the same type, or
2) Assign a common attribute to those domains, and somehow split up xserver_common_x_domain_template() so you can issue the allow rules once for the attribute.
Every object in X is labeled either through a type transition or from a name in the x_contexts file.
The root window and certain other objects, such as the default colormap, are labeled in a type transition from the server's domain. Chris has these objects going to $1_rootwindow_t. All other new windows are labeled in a type transition with the creating domain as the subject and the parent window as the related object.
Events are first labeled from the x_contexts file; for example a ButtonPress event would be labeled input_xevent_t. However, each event is then relabeled in a type transition with the type of the window (where it is being delivered) as the subject and the previous type as the related object. This is where the "user_input_xevent_t" types come from.
Window properties are first labeled from the x_contexts file, then relabeled in a transition with the domain creating them as the subject and the previous type as the related object. This is where the "user_foo_xproperty_t" types come from.
I could go on but my documentation will have all of this in it.
Quoted 3 lines
I have
staff_mozilla_t, andstaff_nsplugin_twhat interface to I add to these to allow them to work withstaff_tdefined above?
Don't think such an interface exists, presently.
Quoted 2 lines
How about if I
want to stop nsplugin from reading the cut buffer ofstaff_t?
I'm assuming you mean "I want to prevent nsplugin from accessing data that a staff_t application has exposed on the clipboard."
Several options here:
1) Deny nsplugin "read" access on the PRIMARY, SECONDARY, and CLIPBOARD selections. These selections are labeled by name (selabel) from the x_contexts file, currently "clipboard_xselection_t". In this case any nsplugin that calls ConvertSelection() will cause a denial and a BadAccess X protocol error will be sent back, which will probably abort the plugin, and firefox. I kind of doubt this is what you want, as people do paste things into nsplugins (I'm picturing someone pasting a filename into some Adobe Acrobat dialog box).
3) Use an active selection manager, such as the one that Ted Toth is working on. This program seizes ownership of the clipboard whenever it changes, so it can intercept paste requests and pop up a confirmation dialog or deny the request.
2) Set up selection polyinstantiation, separating staff_t from nsplugin using a type_member rule. In this case nsplugin will have its own selection instances, and will not be able to see staff_t pastes. To support pasting, you will need a selection manager that "see" across the polyinstantiation (using special XSELinux extension requests).
Quoted 3 lines
I also
want to stop nsplugin from sniffing the keyboard (xspy), and doing any screen capture.
Deny "read" access on x_device, and deny "read" access on non-nsplugin x_drawable objects (including the root window).
The "read" access on devices is a problem because of common usage by applications of requests that require this privilege, such as XQueryPointer. I am working with upstream to try and come up with new semantics for these requests that will prevent input from leaking between X clients.
Quoted 4 lines
When I sudo to root, I use
unconfined_t. It starts X Apps up like system-config-selinux. How do I define the interactions between this X Client and my staff_* windows?
The unconfined_t windows are labeled in a type_transition from the root window as described above.
The window manager will need permissions over the unconfined_t window objects. This does not mean the window manager needs to run as unconfined itself. The type of the x_device objects (treated as a subject when input events are being posted) will need to have permission to send input events to the unconfined_t windows.
Any other interactions are the result of nosing around by other applications. For example, I have observed gnome-screensaver register for input events on _every_ window on the entire screen. Other applications might call XQueryTree on the entire window hierarchy (the equivalent of "find / -print"). These behaviors will cause denials; the only solution is to fix the applications.
Quoted 3 lines
My xserver runs as
xdm_xserver_tbut the current interfaces look like they expect it to be labeledstaff_xserver_t?
You'll have to ask Chris about this. My understanding is that xdm_xserver_t is supported as a "special case." I'm anxious to collapse these down to one type through rbac separation, fixing X server launch via GDM, or otherwise.
Quoted 6 lines
Last time I went through this exercise I ended up with a maze of twisty little passages.
I don't think that anything I asked above is all that complicated but I believe getting the policy correct will be difficult.
The stuff I wrote isn't the be-all and end-all, so feel free to start from scratch.
Signature · 8 lines
Eamon Walsh <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.