Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Macros for irc domains.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# irc_domain(domain_prefix)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Define a derived domain for the irc program when executed
Chris PeBenito ab58ad
# by a user domain.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# The type declaration for the executable type for this program is
Chris PeBenito ab58ad
# provided separately in domains/program/irc.te. 
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
undefine(`irc_domain')
Chris PeBenito ab58ad
ifdef(`irc.te', `
Chris PeBenito ab58ad
define(`irc_domain',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Home domain
Chris PeBenito ab58ad
home_domain($1, irc)
Chris PeBenito ab58ad
file_type_auto_trans($1_irc_t, $1_home_dir_t, $1_irc_home_t, dir)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Derived domain based on the calling user domain and the program.
Chris PeBenito ab58ad
type $1_irc_t, domain;
Chris PeBenito ab58ad
type $1_irc_exec_t, file_type, sysadmfile, $1_file_type;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_t $1_irc_exec_t:file { relabelfrom relabelto create_file_perms };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Transition from the user domain to this domain.
Chris PeBenito ab58ad
domain_auto_trans($1_t, { irc_exec_t $1_irc_exec_t }, $1_irc_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# The user role is authorized for this domain.
Chris PeBenito ab58ad
role $1_r types $1_irc_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Inherit and use descriptors from gnome-pty-helper.
Chris PeBenito ab58ad
ifdef(`gnome-pty-helper.te', `allow $1_irc_t $1_gph_t:fd use;')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Inherit and use descriptors from newrole.
Chris PeBenito ab58ad
ifdef(`newrole.te', `allow $1_irc_t newrole_t:fd use;')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# allow ps to show irc
Chris PeBenito ab58ad
can_ps($1_t, $1_irc_t)
Chris PeBenito ab58ad
allow $1_t $1_irc_t:process signal;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Use the network.
Chris PeBenito ab58ad
can_network_client($1_irc_t)
Chris PeBenito ab58ad
allow $1_irc_t port_type:tcp_socket name_connect;
Chris PeBenito ab58ad
can_ypbind($1_irc_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_irc_t usr_t:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
access_terminal($1_irc_t, $1)
Chris PeBenito ab58ad
uses_shlib($1_irc_t)
Chris PeBenito ab58ad
allow $1_irc_t etc_t:file { read getattr };
Chris PeBenito ab58ad
read_locale($1_irc_t)
Chris PeBenito ab58ad
allow $1_irc_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
allow $1_irc_t var_t:dir search;
Chris PeBenito ab58ad
allow $1_irc_t device_t:dir search;
Chris PeBenito ab58ad
allow $1_irc_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito ab58ad
allow $1_irc_t privfd:fd use;
Chris PeBenito ab58ad
allow $1_irc_t proc_t:dir search;
Chris PeBenito ab58ad
allow $1_irc_t { self proc_t }:lnk_file read;
Chris PeBenito ab58ad
allow $1_irc_t self:dir search;
Chris PeBenito ab58ad
dontaudit $1_irc_t var_run_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# allow utmp access
Chris PeBenito ab58ad
allow $1_irc_t initrc_var_run_t:file { getattr read };
Chris PeBenito ab58ad
dontaudit $1_irc_t initrc_var_run_t:file lock;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# access files under /tmp
Chris PeBenito ab58ad
file_type_auto_trans($1_irc_t, tmp_t, $1_tmp_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
ifdef(`ircd.te', `
Chris PeBenito ab58ad
can_tcp_connect($1_irc_t, ircd_t)
Chris PeBenito ab58ad
')dnl end ifdef irc.te
Chris PeBenito ab58ad
')dnl end macro definition
Chris PeBenito ab58ad
Chris PeBenito ab58ad
', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`irc_domain',`')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')dnl end ifdef irc.te