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