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