Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Macros for giFT
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author: Ivan Gyurdiev <ivg2@cornell.edu>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# gift_domains(domain_prefix)
Chris PeBenito ab58ad
# declares a domain for giftui and giftd
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#########################
Chris PeBenito ab58ad
#  gift_domain(user)    #
Chris PeBenito ab58ad
#########################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gift_domain', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Type transition
Chris PeBenito ab58ad
type $1_gift_t, domain, nscd_client_domain;
Chris PeBenito ab58ad
domain_auto_trans($1_t, gift_exec_t, $1_gift_t)
Chris PeBenito ab58ad
role $1_r types $1_gift_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# X access, Home files, GNOME, /tmp
Chris PeBenito ab58ad
x_client_domain($1_gift, $1)
Chris PeBenito ab58ad
gnome_application($1_gift, $1)
Chris PeBenito ab58ad
home_domain($1, gift)
Chris PeBenito ab58ad
file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow the user domain to signal/ps.
Chris PeBenito ab58ad
can_ps($1_t, $1_gift_t)
Chris PeBenito ab58ad
allow $1_t $1_gift_t:process signal_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Launch gift daemon
Chris PeBenito ab58ad
allow $1_gift_t bin_t:dir search;
Chris PeBenito ab58ad
domain_auto_trans($1_gift_t, giftd_exec_t, $1_giftd_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Connect to gift daemon
Chris PeBenito ab58ad
can_network_client_tcp($1_gift_t, giftd_port_t)
Chris PeBenito ab58ad
allow $1_gift_t giftd_port_t:tcp_socket name_connect;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Read /proc/meminfo
Chris PeBenito ab58ad
allow $1_gift_t proc_t:dir search;
Chris PeBenito ab58ad
allow $1_gift_t proc_t:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# giftui looks in .icons, .themes.
Chris PeBenito ab58ad
dontaudit $1_gift_t $1_home_t:dir { getattr read search };
Chris PeBenito ab58ad
dontaudit $1_gift_t $1_home_t:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl gift_domain
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
#  giftd_domain(user)    #
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`giftd_domain', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
type $1_giftd_t, domain;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Transition from user type
Chris PeBenito ab58ad
domain_auto_trans($1_t, giftd_exec_t, $1_giftd_t)
Chris PeBenito ab58ad
role $1_r types $1_giftd_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Self permissions, allow fork
Chris PeBenito ab58ad
allow $1_giftd_t self:process { fork signal sigchld setsched };
Chris PeBenito ab58ad
allow $1_giftd_t self:unix_stream_socket create_socket_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
read_sysctl($1_giftd_t)
Chris PeBenito ab58ad
read_locale($1_giftd_t)
Chris PeBenito ab58ad
uses_shlib($1_giftd_t)
Chris PeBenito ab58ad
access_terminal($1_giftd_t, $1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Read /proc/meminfo
Chris PeBenito ab58ad
allow $1_giftd_t proc_t:dir search;
Chris PeBenito ab58ad
allow $1_giftd_t proc_t:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Read /etc/mtab
Chris PeBenito ab58ad
allow $1_giftd_t etc_runtime_t:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Access home domain
Chris PeBenito ab58ad
home_domain_access($1_giftd_t, $1, gift)
Chris PeBenito ab58ad
file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Serve content on various p2p networks. Ports can be random.
Chris PeBenito ab58ad
can_network_server($1_giftd_t)
Chris PeBenito ab58ad
allow $1_giftd_t self:udp_socket listen;
Chris PeBenito ab58ad
allow $1_giftd_t port_type:{ tcp_socket udp_socket } name_bind;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Connect to various p2p networks. Ports can be random.
Chris PeBenito ab58ad
can_network_client($1_giftd_t)
Chris PeBenito ab58ad
allow $1_giftd_t port_type:tcp_socket name_connect;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Plugins
Chris PeBenito ab58ad
r_dir_file($1_giftd_t, usr_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Connect to xdm
Chris PeBenito ab58ad
can_pipe_xdm($1_giftd_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
') dnl giftd_domain
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
#  gift_domains(user)    #
Chris PeBenito ab58ad
##########################
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`gift_domains', `
Chris PeBenito ab58ad
gift_domain($1)
Chris PeBenito ab58ad
giftd_domain($1)
Chris PeBenito ab58ad
') dnl gift_domains