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