|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Macros for mount
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Author: Brian May <bam@snoopy.apana.org.au>
|
|
Chris PeBenito |
ab58ad |
# Extended by Russell Coker <russell@coker.com.au>
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# mount_domain(domain_prefix,dst_domain_prefix)
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Define a derived domain for the mount program for anyone.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
define(`mount_domain', `
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Rules for the $2_t domain, used by the $1_t domain.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# $2_t is the domain for the mount process.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# This macro will not be included by all users and it may be included twice if
|
|
Chris PeBenito |
ab58ad |
# called from other macros, so we need protection for this do not call this
|
|
Chris PeBenito |
ab58ad |
# macro if $2_def is defined
|
|
Chris PeBenito |
ab58ad |
define(`$2_def', `')
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
type $2_t, domain, privlog $3, nscd_client_domain;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $2_t sysfs_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
uses_shlib($2_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
role $1_r types $2_t;
|
|
Chris PeBenito |
ab58ad |
# when mount is run by $1 goto $2_t domain
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_t, mount_exec_t, $2_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $2_t proc_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $2_t proc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Allow mounting of cdrom by user
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
allow $2_t device_type:blk_file getattr;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
tmp_domain($2)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Use capabilities.
|
|
Chris PeBenito |
ab58ad |
allow $2_t self:capability { net_bind_service sys_rawio sys_admin dac_override chown };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $2_t self:unix_stream_socket create_socket_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Create and modify /etc/mtab.
|
|
Chris PeBenito |
ab58ad |
file_type_auto_trans($2_t, etc_t, etc_runtime_t, file)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $2_t etc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
read_locale($2_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $2_t home_root_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $2_t $1_home_dir_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $2_t noexattrfile:filesystem { mount unmount };
|
|
Chris PeBenito |
ab58ad |
allow $2_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
ab58ad |
allow $2_t removable_t:filesystem { mount unmount };
|
|
Chris PeBenito |
ab58ad |
allow $2_t mnt_t:dir { mounton search };
|
|
Chris PeBenito |
ab58ad |
allow $2_t sbin_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access the terminal.
|
|
Chris PeBenito |
ab58ad |
access_terminal($2_t, $1)
|
|
Chris PeBenito |
ab58ad |
ifdef(`gnome-pty-helper.te', `allow $2_t $1_gph_t:fd use;')
|
|
Chris PeBenito |
ab58ad |
allow $2_t var_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $2_t var_run_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`distro_redhat',`
|
|
Chris PeBenito |
ab58ad |
ifdef(`pamconsole.te',`
|
|
Chris PeBenito |
ab58ad |
r_dir_file($2_t,pam_var_console_t)
|
|
Chris PeBenito |
ab58ad |
# mount config by default sets fscontext=removable_t
|
|
Chris PeBenito |
ab58ad |
allow $2_t dosfs_t:filesystem relabelfrom;
|
|
Chris PeBenito |
ab58ad |
') dnl end pamconsole.te
|
|
Chris PeBenito |
ab58ad |
') dnl end distro_redhat
|
|
Chris PeBenito |
ab58ad |
') dnl end mount_domain
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# mount_loopback_privs(domain_prefix,dst_domain_prefix)
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Add loopback mounting privileges to a particular derived
|
|
Chris PeBenito |
ab58ad |
# mount domain.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
define(`mount_loopback_privs',`
|
|
Chris PeBenito |
ab58ad |
type $1_$2_source_t, file_type, sysadmfile, $1_file_type;
|
|
Chris PeBenito |
ab58ad |
allow $1_t $1_$2_source_t:file create_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow $1_t $1_$2_source_t:file { relabelto relabelfrom };
|
|
Chris PeBenito |
ab58ad |
allow $2_t $1_$2_source_t:file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
|