Chris PeBenito ab58ad
# Home macros
Chris PeBenito ab58ad
Chris PeBenito ab58ad
################################################
Chris PeBenito ab58ad
# network_home(source)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allows source domain to use a network home
Chris PeBenito ab58ad
# This includes privileges of create and execute
Chris PeBenito ab58ad
# as well as the ability to create sockets and fifo
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`network_home', `
Chris PeBenito ab58ad
allow $1 autofs_t:dir { search getattr };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (use_nfs_home_dirs) {
Chris PeBenito ab58ad
create_dir_file($1, nfs_t)
Chris PeBenito ab58ad
can_exec($1, nfs_t)
Chris PeBenito ab58ad
allow $1 nfs_t:{ sock_file fifo_file } create_file_perms;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (use_samba_home_dirs) {
Chris PeBenito ab58ad
create_dir_file($1, cifs_t)
Chris PeBenito ab58ad
can_exec($1, cifs_t)
Chris PeBenito ab58ad
allow $1 cifs_t:{ sock_file fifo_file } create_file_perms;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
') dnl network_home
Chris PeBenito ab58ad
Chris PeBenito ab58ad
################################################
Chris PeBenito ab58ad
# write_network_home(source)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allows source domain to create directories and
Chris PeBenito ab58ad
# files on network file system
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`write_network_home', `
Chris PeBenito ab58ad
allow $1 home_root_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (use_nfs_home_dirs) {
Chris PeBenito ab58ad
create_dir_file($1, nfs_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
if (use_samba_home_dirs) {
Chris PeBenito ab58ad
create_dir_file($1, cifs_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
allow $1 autofs_t:dir { search getattr };
Chris PeBenito ab58ad
') dnl write_network_home
Chris PeBenito ab58ad
Chris PeBenito ab58ad
################################################
Chris PeBenito ab58ad
# read_network_home(source)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Allows source domain to read directories and
Chris PeBenito ab58ad
# files on network file system
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`read_network_home', `
Chris PeBenito ab58ad
allow $1 home_root_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (use_nfs_home_dirs) {
Chris PeBenito ab58ad
r_dir_file($1, nfs_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
if (use_samba_home_dirs) {
Chris PeBenito ab58ad
r_dir_file($1, cifs_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
allow $1 autofs_t:dir { search getattr };
Chris PeBenito ab58ad
') dnl read_network_home
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##################################################
Chris PeBenito ab58ad
# home_domain_ro_access(source, user, app)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Gives source access to the read-only home
Chris PeBenito ab58ad
# domain of app for the given user type
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`home_domain_ro_access', `
Chris PeBenito ab58ad
allow $1 { home_root_t $2_home_dir_t }:dir { search getattr };
Chris PeBenito ab58ad
read_network_home($1)
Chris PeBenito ab58ad
r_dir_file($1, $2_$3_ro_home_t)
Chris PeBenito ab58ad
') dnl home_domain_ro_access
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################################
Chris PeBenito ab58ad
# home_domain_access(source, user, app)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Gives source full access to the home
Chris PeBenito ab58ad
# domain of app for the given user type
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Requires transition in caller
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`home_domain_access', `
Chris PeBenito ab58ad
allow $1 { home_root_t $2_home_dir_t }:dir { search getattr };
Chris PeBenito ab58ad
write_network_home($1)
Chris PeBenito ab58ad
create_dir_file($1, $2_$3_home_t)
Chris PeBenito ab58ad
') dnl home_domain_access
Chris PeBenito ab58ad
Chris PeBenito ab58ad
####################################################################
Chris PeBenito ab58ad
# home_domain (prefix, app)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Creates a domain in the prefix home where an application can
Chris PeBenito ab58ad
# store its settings. It is accessible by the prefix domain.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Requires transition in caller
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`home_domain', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Declare home domain
Chris PeBenito ab58ad
type $1_$2_home_t, file_type, $1_file_type, sysadmfile, polymember;
Chris PeBenito ab58ad
typealias $1_$2_home_t alias $1_$2_rw_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# User side access
Chris PeBenito ab58ad
create_dir_file($1_t, $1_$2_home_t)
Chris PeBenito ab58ad
allow $1_t $1_$2_home_t:{ dir file lnk_file } { relabelfrom relabelto };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# App side access
Chris PeBenito ab58ad
home_domain_access($1_$2_t, $1, $2)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
####################################################################
Chris PeBenito ab58ad
# home_domain_ro (user, app)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Creates a read-only domain in the user home where an application can
Chris PeBenito ab58ad
# store its settings. It is fully accessible by the user, but
Chris PeBenito ab58ad
# it is read-only for the application.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`home_domain_ro', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Declare home domain
Chris PeBenito ab58ad
type $1_$2_ro_home_t, file_type, $1_file_type, sysadmfile;
Chris PeBenito ab58ad
typealias $1_$2_ro_home_t alias $1_$2_ro_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# User side access
Chris PeBenito ab58ad
create_dir_file($1_t, $1_$2_ro_home_t)
Chris PeBenito ab58ad
allow $1_t $1_$2_ro_home_t:{ dir file lnk_file } { relabelfrom relabelto };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# App side access
Chris PeBenito ab58ad
home_domain_ro_access($1_$2_t, $1, $2)
Chris PeBenito ab58ad
')