selinux-policy/strict/macros/program/gift_macros.te

107 lines
2.6 KiB
Plaintext
Raw Normal View History

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