Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Bonobo
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author: Ivan Gyurdiev <ivg2@cornell.edu>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# bonobo_domain(role_prefix) - invoke per role
Chris PeBenito ab58ad
# bonobo_client(app_prefix, role_prefix) - invoke per client app
Chris PeBenito ab58ad
# bonobo_connect(type1_prefix, type2_prefix) - 
Chris PeBenito ab58ad
# 	connect two bonobo clients, the channel is bidirectional
Chris PeBenito ab58ad
Chris PeBenito ab58ad
######################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`bonobo_domain', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Protect against double inclusion for faster compile
Chris PeBenito ab58ad
ifdef(`bonobo_domain_$1', `', `
Chris PeBenito ab58ad
define(`bonobo_domain_$1')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Type for daemon
Chris PeBenito ab58ad
type $1_bonobo_t, domain, nscd_client_domain;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Transition from caller
Chris PeBenito ab58ad
domain_auto_trans($1_t, bonobo_exec_t, $1_bonobo_t)
Chris PeBenito ab58ad
role $1_r types $1_bonobo_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Shared libraries, gconv-modules
Chris PeBenito ab58ad
uses_shlib($1_bonobo_t)
Chris PeBenito ab58ad
allow $1_bonobo_t lib_t:file r_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
read_locale($1_bonobo_t)
Chris PeBenito ab58ad
read_sysctl($1_bonobo_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Session management 
Chris PeBenito ab58ad
# FIXME: More specific context is needed for gnome-session
Chris PeBenito ab58ad
ice_connect($1_bonobo, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# nsswitch.conf
Chris PeBenito ab58ad
allow $1_bonobo_t etc_t:file { read getattr };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Fork to start apps
Chris PeBenito ab58ad
allow $1_bonobo_t self:process { fork sigchld setpgid getsched signal };
Chris PeBenito ab58ad
allow $1_bonobo_t self:fifo_file rw_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# ??? 
Chris PeBenito ab58ad
allow $1_bonobo_t root_t:dir search;
Chris PeBenito ab58ad
allow $1_bonobo_t home_root_t:dir search;
Chris PeBenito ab58ad
allow $1_bonobo_t $1_home_dir_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# libexec ??? 
Chris PeBenito ab58ad
allow $1_bonobo_t bin_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# ORBit sockets for bonobo
Chris PeBenito ab58ad
orbit_domain($1_bonobo, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Bonobo can launch evolution
Chris PeBenito ab58ad
ifdef(`evolution.te', `
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, evolution_exec_t, $1_evolution_t)
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, evolution_alarm_exec_t, $1_evolution_alarm_t)
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, evolution_webcal_exec_t, $1_evolution_webcal_t)
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, evolution_server_exec_t, $1_evolution_server_t)
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, evolution_exchange_exec_t, $1_evolution_exchange_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Bonobo can launch GNOME vfs daemon
Chris PeBenito ab58ad
ifdef(`gnome_vfs.te', `
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, gnome_vfs_exec_t, $1_gnome_vfs_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
  
Chris PeBenito ab58ad
# Transition to ROLE_t on bin_t apps
Chris PeBenito ab58ad
# FIXME: The goal is to get rid of this rule, as it
Chris PeBenito ab58ad
# defeats the purpose of a separate domain. It is only
Chris PeBenito ab58ad
# here temporarily, since bonobo runs as ROLE_t by default anyway
Chris PeBenito ab58ad
domain_auto_trans($1_bonobo_t, bin_t, $1_t) 
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_pipe_xdm($1_bonobo_t)
Chris PeBenito ab58ad
  
Chris PeBenito ab58ad
') dnl ifdef bonobo_domain_args
Chris PeBenito ab58ad
') dnl bonobo_domain
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#####################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`bonobo_client', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Protect against double inclusion for faster compile
Chris PeBenito ab58ad
ifdef(`bonobo_client_$1_$2', `', `
Chris PeBenito ab58ad
define(`bonobo_client_$1_$2')
Chris PeBenito ab58ad
# Connect over bonobo
Chris PeBenito ab58ad
bonobo_connect($1, $2_gconfd, $1)
Chris PeBenito ab58ad
 
Chris PeBenito ab58ad
# Create ORBit sockets
Chris PeBenito ab58ad
orbit_domain($1, $2)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Connect to bonobo
Chris PeBenito ab58ad
orbit_connect($1, $2_bonobo)
Chris PeBenito ab58ad
orbit_connect($2_bonobo, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Lock /tmp/bonobo-activation-register.lock
Chris PeBenito ab58ad
# Stat /tmp/bonobo-activation-server.ior
Chris PeBenito ab58ad
# FIXME: this should probably be of type $2_bonobo..
Chris PeBenito ab58ad
# Note that this is file, not sock_file
Chris PeBenito ab58ad
allow $1_t $2_orbit_tmp_t:file { getattr read write lock };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
domain_auto_trans($1_t, bonobo_exec_t, $2_bonobo_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl ifdef bonobo_client_args
Chris PeBenito ab58ad
') dnl bonobo_client
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#####################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`bonobo_connect', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# FIXME: Should there be a macro for unidirectional conn. ?
Chris PeBenito ab58ad
Chris PeBenito ab58ad
orbit_connect($1, $2)
Chris PeBenito ab58ad
orbit_connect($2, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl bonobo_connect