|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Macros for all user login domains.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# base_user_domain(domain_prefix)
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Define derived types and rules for an ordinary user domain.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# The type declaration and role authorization for the domain must be
|
|
Chris PeBenito |
31b7c0 |
# provided separately. Likewise, domain transitions into this domain
|
|
Chris PeBenito |
31b7c0 |
# must be specified separately.
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# base_user_domain() is also called by the admin_domain() macro
|
|
Chris PeBenito |
31b7c0 |
undefine(`base_user_domain')
|
|
Chris PeBenito |
31b7c0 |
define(`base_user_domain', `
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Type for network-obtained content
|
|
Chris PeBenito |
31b7c0 |
type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable, polymember;
|
|
Chris PeBenito |
31b7c0 |
type $1_untrusted_content_tmp_t, file_type, $1_file_type, sysadmfile, tmpfile, customizable, polymember;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow user to relabel untrusted content
|
|
Chris PeBenito |
31b7c0 |
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:dir { create_dir_perms relabelto relabelfrom };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:file { getattr unlink relabelto relabelfrom rename };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Read content
|
|
Chris PeBenito |
31b7c0 |
read_content($1_t, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Write trusted content. This includes proper transition
|
|
Chris PeBenito |
31b7c0 |
# for /home, and /tmp, so no other transition is necessary (or allowed)
|
|
Chris PeBenito |
31b7c0 |
write_trusted($1_t, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Maybe the home directory is networked
|
|
Chris PeBenito |
31b7c0 |
network_home($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Transition for { lnk, fifo, sock }. The rest is covered by write_trusted.
|
|
Chris PeBenito |
31b7c0 |
# Relabel files in the home directory
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans($1_t, $1_home_dir_t, $1_home_t, { fifo_file sock_file lnk_file });
|
|
Chris PeBenito |
31b7c0 |
allow $1_t $1_home_t:{ notdevfile_class_set dir } { relabelfrom relabelto };
|
|
Chris PeBenito |
31b7c0 |
can_setfscreate($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`ftpd.te' , `
|
|
Chris PeBenito |
31b7c0 |
if (ftpd_is_daemon) {
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans(ftpd_t, $1_home_dir_t, $1_home_t)
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:capability { setgid chown fowner };
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t self:capability { sys_nice fsetid };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# $1_r is authorized for $1_t for the initial login domain.
|
|
Chris PeBenito |
31b7c0 |
role $1_r types $1_t;
|
|
Chris PeBenito |
31b7c0 |
allow system_r $1_r;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, usercanread)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Grant permissions within the domain.
|
|
Chris PeBenito |
31b7c0 |
general_domain_access($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (allow_execmem) {
|
|
Chris PeBenito |
31b7c0 |
# Allow making anonymous memory executable, e.g.
|
|
Chris PeBenito |
31b7c0 |
# for runtime-code generation or executable stack.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:process execmem;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (allow_execmem && allow_execstack) {
|
|
Chris PeBenito |
31b7c0 |
# Allow making the stack executable via mprotect.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t self:process execstack;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow text relocations on system shared libraries, e.g. libGL.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t texrel_shlib_t:file execmod;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# kdeinit wants this access
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
allow $1_t device_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Find CDROM devices
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, sysctl_dev_t)
|
|
Chris PeBenito |
31b7c0 |
# for eject
|
|
Chris PeBenito |
31b7c0 |
allow $1_t fixed_disk_device_t:blk_file getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t fs_type:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t event_device_t:chr_file { getattr read ioctl };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# open office is looking for the following
|
|
Chris PeBenito |
31b7c0 |
allow $1_t dri_device_t:chr_file getattr;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t dri_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Supress ls denials:
|
|
Chris PeBenito |
31b7c0 |
# getattr() - ls -l
|
|
Chris PeBenito |
31b7c0 |
# search_dir() - symlink path resolution
|
|
Chris PeBenito |
31b7c0 |
# read_dir() - deep ls: ls parent/...
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
dontaudit_getattr($1_t)
|
|
Chris PeBenito |
31b7c0 |
dontaudit_search_dir($1_t)
|
|
Chris PeBenito |
31b7c0 |
dontaudit_read_dir($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# allow ptrace
|
|
Chris PeBenito |
31b7c0 |
can_ptrace($1_t, $1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow user to run restorecon and relabel files
|
|
Chris PeBenito |
31b7c0 |
can_getsecurity($1_t)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, default_context_t)
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, file_context_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t usbtty_device_t:chr_file read;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# GNOME checks for usb and other devices
|
|
Chris PeBenito |
31b7c0 |
rw_dir_file($1_t,usbfs_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, noexattrfile)
|
|
Chris PeBenito |
31b7c0 |
# Bind to a Unix domain socket in /tmp.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t $1_tmp_t:unix_stream_socket name_bind;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Use the type when relabeling terminal devices.
|
|
Chris PeBenito |
31b7c0 |
type_change $1_t tty_device_t:chr_file $1_tty_device_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Debian login is from shadow utils and does not allow resetting the perms.
|
|
Chris PeBenito |
31b7c0 |
# have to fix this!
|
|
Chris PeBenito |
31b7c0 |
type_change $1_t ttyfile:chr_file $1_tty_device_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for running TeX programs
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, tetex_data_t)
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, tetex_data_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Use the type when relabeling pty devices.
|
|
Chris PeBenito |
31b7c0 |
type_change $1_t server_pty:chr_file $1_devpts_t;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
tmpfs_domain($1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`cardmgr.te', `
|
|
Chris PeBenito |
31b7c0 |
# to allow monitoring of pcmcia status
|
|
Chris PeBenito |
31b7c0 |
allow $1_t cardmgr_var_run_t:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Modify mail spool file.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t mail_spool_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t mail_spool_t:file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t mail_spool_t:lnk_file read;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Allow graphical boot to check battery lifespan
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
ifdef(`apmd.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t apmd_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t apmd_var_run_t:sock_file write;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Allow the query of filesystem quotas
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
allow $1_t fs_type:filesystem quotaget;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Run helper programs.
|
|
Chris PeBenito |
31b7c0 |
can_exec_any($1_t)
|
|
Chris PeBenito |
31b7c0 |
# Run programs developed by other users in the same domain.
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, $1_home_t)
|
|
Chris PeBenito |
31b7c0 |
can_exec($1_t, $1_tmp_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Run user programs that require different permissions in their own domain.
|
|
Chris PeBenito |
31b7c0 |
# These rules were moved into the individual program domains.
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Instantiate derived domains for a number of programs.
|
|
Chris PeBenito |
31b7c0 |
# These derived domains encode both information about the calling
|
|
Chris PeBenito |
31b7c0 |
# user domain and the program, and allow us to maintain separation
|
|
Chris PeBenito |
31b7c0 |
# between different instances of the program being run by different
|
|
Chris PeBenito |
31b7c0 |
# user domains.
|
|
Chris PeBenito |
31b7c0 |
ifdef(`gnome-pty-helper.te', `gph_domain($1, $1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`chkpwd.te', `chkpwd_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`fingerd.te', `fingerd_macro($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`mta.te', `mail_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`exim.te', `exim_user_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`crontab.te', `crontab_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`screen.te', `screen_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`tvtime.te', `tvtime_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`mozilla.te', `mozilla_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`thunderbird.te', `thunderbird_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`samba.te', `samba_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`gpg.te', `gpg_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`xauth.te', `xauth_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`iceauth.te', `iceauth_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`startx.te', `xserver_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`lpr.te', `lpr_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`ssh.te', `ssh_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`irc.te', `irc_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`using_spamassassin', `spamassassin_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`pyzor.te', `pyzor_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`razor.te', `razor_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`uml.te', `uml_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`cdrecord.te', `cdrecord_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`mplayer.te', `mplayer_domains($1)')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
fontconfig_domain($1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# GNOME
|
|
Chris PeBenito |
31b7c0 |
ifdef(`gnome.te', `
|
|
Chris PeBenito |
31b7c0 |
gnome_domain($1)
|
|
Chris PeBenito |
31b7c0 |
ifdef(`games.te', `games_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`gift.te', `gift_domains($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`evolution.te', `evolution_domains($1)')
|
|
Chris PeBenito |
31b7c0 |
ifdef(`ethereal.te', `ethereal_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# ICE communication channel
|
|
Chris PeBenito |
31b7c0 |
ice_domain($1, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# ORBit communication channel (independent of GNOME)
|
|
Chris PeBenito |
31b7c0 |
orbit_domain($1, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Instantiate a derived domain for user cron jobs.
|
|
Chris PeBenito |
31b7c0 |
ifdef(`crond.te', `crond_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`vmware.te', `vmware_domain($1)')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (user_direct_mouse) {
|
|
Chris PeBenito |
31b7c0 |
# Read the mouse.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t mouse_device_t:chr_file r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
# Access other miscellaneous devices.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t misc_device_t:{ chr_file blk_file } rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t device_t:lnk_file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
can_resmgrd_connect($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# evolution and gnome-session try to create a netlink socket
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t self:netlink_socket create_socket_perms;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t self:netlink_route_socket create_netlink_socket_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Use the network.
|
|
Chris PeBenito |
31b7c0 |
can_network($1_t)
|
|
Chris PeBenito |
31b7c0 |
allow $1_t port_type:tcp_socket name_connect;
|
|
Chris PeBenito |
31b7c0 |
can_ypbind($1_t)
|
|
Chris PeBenito |
31b7c0 |
can_winbind($1_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`pamconsole.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t pam_var_console_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t var_lock_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Grant permissions to access the system DBus
|
|
Chris PeBenito |
31b7c0 |
ifdef(`dbusd.te', `
|
|
Chris PeBenito |
31b7c0 |
dbusd_client(system, $1)
|
|
Chris PeBenito |
31b7c0 |
can_network_server_tcp($1_dbusd_t)
|
|
Chris PeBenito |
31b7c0 |
allow $1_dbusd_t reserved_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t system_dbusd_t:dbus { send_msg acquire_svc };
|
|
Chris PeBenito |
31b7c0 |
dbusd_client($1, $1)
|
|
Chris PeBenito |
31b7c0 |
allow $1_t $1_dbusd_t:dbus { send_msg acquire_svc };
|
|
Chris PeBenito |
31b7c0 |
dbusd_domain($1)
|
|
Chris PeBenito |
31b7c0 |
ifdef(`hald.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t hald_t:dbus send_msg;
|
|
Chris PeBenito |
31b7c0 |
allow hald_t $1_t:dbus send_msg;
|
|
Chris PeBenito |
31b7c0 |
') dnl end ifdef hald.te
|
|
Chris PeBenito |
31b7c0 |
') dnl end ifdef dbus.te
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# allow port_t name binding for UDP because it is not very usable otherwise
|
|
Chris PeBenito |
31b7c0 |
allow $1_t port_t:udp_socket name_bind;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Gnome pannel binds to the following
|
|
Chris PeBenito |
31b7c0 |
ifdef(`cups.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t { cupsd_etc_t cupsd_rw_etc_t }:file { read getattr };
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# for perl
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t net_conf_t:file ioctl;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Communicate within the domain.
|
|
Chris PeBenito |
31b7c0 |
can_udp_send($1_t, self)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Connect to inetd.
|
|
Chris PeBenito |
31b7c0 |
ifdef(`inetd.te', `
|
|
Chris PeBenito |
31b7c0 |
can_tcp_connect($1_t, inetd_t)
|
|
Chris PeBenito |
31b7c0 |
can_udp_send($1_t, inetd_t)
|
|
Chris PeBenito |
31b7c0 |
can_udp_send(inetd_t, $1_t)
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Connect to portmap.
|
|
Chris PeBenito |
31b7c0 |
ifdef(`portmap.te', `can_tcp_connect($1_t, portmap_t)')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Inherit and use sockets from inetd
|
|
Chris PeBenito |
31b7c0 |
ifdef(`inetd.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t inetd_t:fd use;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t inetd_t:tcp_socket rw_stream_socket_perms;')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Very permissive allowing every domain to see every type.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t kernel_t:system ipc_info;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# When the user domain runs ps, there will be a number of access
|
|
Chris PeBenito |
31b7c0 |
# denials when ps tries to search /proc. Do not audit these denials.
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t domain:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t domain:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t domain:process { getattr getsession };
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Cups daemon running as user tries to write /etc/printcap
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t usr_t:file setattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Use X
|
|
Chris PeBenito |
31b7c0 |
x_client_domain($1, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`xserver.te', `
|
|
Chris PeBenito |
31b7c0 |
allow $1_t xserver_misc_device_t:{ chr_file blk_file } rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`xdm.te', `
|
|
Chris PeBenito |
31b7c0 |
# Connect to the X server run by the X Display Manager.
|
|
Chris PeBenito |
31b7c0 |
can_unix_connect($1_t, xdm_t)
|
|
Chris PeBenito |
31b7c0 |
# certain apps want to read xdm.pid file
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, xdm_var_run_t)
|
|
Chris PeBenito |
31b7c0 |
allow $1_t xdm_var_lib_t:file { getattr read };
|
|
Chris PeBenito |
31b7c0 |
allow xdm_t $1_home_dir_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
ifdef(`xauth.te', `
|
|
Chris PeBenito |
31b7c0 |
file_type_auto_trans(xdm_t, $1_home_dir_t, $1_xauth_home_t, file)
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
')dnl end ifdef xdm.te
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Access the sound device.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t sound_device_t:chr_file { getattr read write ioctl };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Access the power device.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t power_device_t:chr_file { getattr read write ioctl };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
allow $1_t var_log_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t logfile:file getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Check to see if cdrom is mounted
|
|
Chris PeBenito |
31b7c0 |
allow $1_t mnt_t:dir { getattr search };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Get attributes of file systems.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t fs_type:filesystem getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Read and write /dev/tty and /dev/null.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t devtty_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t null_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t zero_device_t:chr_file { rw_file_perms execute };
|
|
Chris PeBenito |
31b7c0 |
allow $1_t { random_device_t urandom_device_t }:chr_file ra_file_perms;
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Added to allow reading of cdrom
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
allow $1_t rpc_pipefs_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t nfsd_fs_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t binfmt_misc_fs_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# /initrd is left mounted, various programs try to look at it
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t ramfs_t:dir getattr;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Emacs wants this access
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
allow $1_t wtmp_t:file r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t wtmp_t:file write;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Read the devpts root directory.
|
|
Chris PeBenito |
31b7c0 |
allow $1_t devpts_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
r_dir_file($1_t, src_t)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Allow user to read default_t files
|
|
Chris PeBenito |
31b7c0 |
# This is different from reading default_t content,
|
|
Chris PeBenito |
31b7c0 |
# because it also includes sockets, fifos, and links
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
if (read_default_t) {
|
|
Chris PeBenito |
31b7c0 |
allow $1_t default_t:dir r_dir_perms;
|
|
Chris PeBenito |
31b7c0 |
allow $1_t default_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
31b7c0 |
}
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
# Read fonts
|
|
Chris PeBenito |
31b7c0 |
read_fonts($1_t, $1)
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
read_sysctl($1_t);
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Caused by su - init scripts
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t initrc_devpts_t:chr_file { ioctl read write };
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
# Running ifconfig as a user generates the following
|
|
Chris PeBenito |
31b7c0 |
#
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t self:socket create;
|
|
Chris PeBenito |
31b7c0 |
dontaudit $1_t sysctl_net_t:dir search;
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
ifdef(`rpcd.te', `
|
|
Chris PeBenito |
31b7c0 |
create_dir_file($1_t, nfsd_rw_t)
|
|
Chris PeBenito |
31b7c0 |
')
|
|
Chris PeBenito |
31b7c0 |
|
|
Chris PeBenito |
31b7c0 |
')dnl end base_user_domain macro
|
|
Chris PeBenito |
31b7c0 |
|