Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# GNOME related types 
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author: Ivan Gyurdiev <ivg2@cornell.edu>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# gnome_domain(role_prefix) - create GNOME domain (run for each role)
Chris PeBenito ab58ad
# gnome_application(app_prefix, role_prefix) - common stuff for gnome apps
Chris PeBenito ab58ad
# gnome_file_dialog(role_prefix) - gnome file dialog rules
Chris PeBenito ab58ad
# gnome_private_store(app_prefix, role_prefix) - store private files in .gnome2_private
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gnome_domain', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Types for .gnome2 and .gnome2_private.
Chris PeBenito ab58ad
# For backwards compatibility, allow unrestricted
Chris PeBenito ab58ad
# access from ROLE_t. However, content inside
Chris PeBenito ab58ad
# *should* be labeled per application eventually.
Chris PeBenito ab58ad
# For .gnome2_private, use the private_store macro below. 
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type $1_gnome_settings_t, file_type, $1_file_type, sysadmfile;
Chris PeBenito ab58ad
create_dir_file($1_t, $1_gnome_settings_t)
Chris PeBenito ab58ad
allow $1_t $1_gnome_settings_t:{ dir file } { relabelfrom relabelto };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type $1_gnome_secret_t, file_type, $1_file_type, sysadmfile;
Chris PeBenito ab58ad
create_dir_file($1_t, $1_gnome_secret_t)
Chris PeBenito ab58ad
allow $1_t $1_gnome_secret_t:{ dir file } { relabelfrom relabelto };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# GConf domain
Chris PeBenito ab58ad
gconfd_domain($1)
Chris PeBenito ab58ad
gconf_client($1, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Bonobo-activation-server
Chris PeBenito ab58ad
bonobo_domain($1)
Chris PeBenito ab58ad
bonobo_client($1, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# GNOME vfs daemon
Chris PeBenito ab58ad
gnome_vfs_domain($1)
Chris PeBenito ab58ad
gnome_vfs_client($1, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# ICE is necessary for session management
Chris PeBenito ab58ad
ice_domain($1, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gnome_application', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# If launched from a terminal
Chris PeBenito ab58ad
access_terminal($1_t, $2)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Forking is generally okay
Chris PeBenito ab58ad
allow $1_t self:process { sigchld sigkill signal setrlimit getsched setsched fork };
Chris PeBenito ab58ad
allow $1_t self:fifo_file rw_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Shlib, locale, sysctl, proc
Chris PeBenito ab58ad
uses_shlib($1_t)
Chris PeBenito ab58ad
read_locale($1_t)
Chris PeBenito ab58ad
read_sysctl($1_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_t { self proc_t }:dir { search read getattr };
Chris PeBenito ab58ad
allow $1_t { self proc_t }:{ file lnk_file } { read getattr };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Most gnome apps use bonobo
Chris PeBenito ab58ad
bonobo_client($1, $2)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Within-process bonobo-activation of components
Chris PeBenito ab58ad
bonobo_connect($1, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Session management happens over ICE
Chris PeBenito ab58ad
# FIXME: More specific context is needed for gnome-session
Chris PeBenito ab58ad
ice_connect($1, $2)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Most talk to GConf
Chris PeBenito ab58ad
gconf_client($1, $2)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow getattr/read/search of .gnome2 and .gnome2_private
Chris PeBenito ab58ad
# Reading files should *not* be allowed - instead, more specific
Chris PeBenito ab58ad
# types should be created to handle such requests
Chris PeBenito ab58ad
allow $1_t { $2_gnome_settings_t $2_gnome_secret_t }:dir r_dir_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Access /etc/mtab, /etc/nsswitch.conf
Chris PeBenito ab58ad
allow $1_t etc_t:file { read getattr };
Chris PeBenito ab58ad
allow $1_t etc_runtime_t:file { read getattr };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Themes, gtkrc
Chris PeBenito ab58ad
allow $1_t usr_t:{ file lnk_file } r_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl gnome_application
Chris PeBenito ab58ad
Chris PeBenito ab58ad
################################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gnome_file_dialog', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# GNOME Open/Save As dialogs 
Chris PeBenito ab58ad
dontaudit_getattr($1_t)
Chris PeBenito ab58ad
dontaudit_search_dir($1_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Bonobo connection to gnome_vfs daemon
Chris PeBenito ab58ad
bonobo_connect($1, $2_gnome_vfs)
Chris PeBenito ab58ad
 
Chris PeBenito ab58ad
') dnl gnome_file_dialog
Chris PeBenito ab58ad
Chris PeBenito ab58ad
################################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gnome_private_store', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Type for storing secret data
Chris PeBenito ab58ad
# (different from home, not directly accessible from ROLE_t)
Chris PeBenito ab58ad
type $1_secret_t, file_type, $2_file_type, sysadmfile;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Put secret files in .gnome2_private
Chris PeBenito ab58ad
file_type_auto_trans($1_t, $2_gnome_secret_t, $1_secret_t, file);
Chris PeBenito ab58ad
allow $2_t $1_secret_t:file unlink;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl gnome_private_store