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