Blob Blame History Raw

policy_module(hotplug,1.3.1)

########################################
#
# Declarations
#

type hotplug_t;
type hotplug_exec_t;
kernel_domtrans_to(hotplug_t,hotplug_exec_t)
init_daemon_domain(hotplug_t,hotplug_exec_t)

type hotplug_etc_t;
files_config_file(hotplug_etc_t)
init_daemon_domain(hotplug_t,hotplug_etc_t)

type hotplug_var_run_t;
files_pid_file(hotplug_var_run_t)

########################################
#
# Local policy
#

allow hotplug_t self:capability { net_admin sys_tty_config mknod sys_rawio };
dontaudit hotplug_t self:capability { sys_module sys_admin sys_tty_config };
# for access("/etc/bashrc", X_OK) on Red Hat
dontaudit hotplug_t self:capability { dac_override dac_read_search };
allow hotplug_t self:process { setpgid getsession getattr signal_perms };
allow hotplug_t self:fifo_file rw_file_perms;
allow hotplug_t self:netlink_route_socket r_netlink_socket_perms;
allow hotplug_t self:udp_socket create_socket_perms;
allow hotplug_t self:tcp_socket connected_stream_socket_perms;

allow hotplug_t hotplug_etc_t:file r_file_perms;
allow hotplug_t hotplug_etc_t:dir r_dir_perms;
allow hotplug_t hotplug_etc_t:lnk_file r_file_perms;
can_exec(hotplug_t,hotplug_etc_t)

can_exec(hotplug_t,hotplug_exec_t)

allow hotplug_t hotplug_var_run_t:file manage_file_perms;
allow hotplug_t hotplug_var_run_t:dir rw_dir_perms;
files_pid_filetrans(hotplug_t,hotplug_var_run_t,file)

kernel_sigchld(hotplug_t)
kernel_setpgid(hotplug_t)
kernel_read_system_state(hotplug_t)
kernel_read_kernel_sysctls(hotplug_t)
kernel_read_net_sysctls(hotplug_t)

files_read_kernel_modules(hotplug_t)

corenet_non_ipsec_sendrecv(hotplug_t)
corenet_tcp_sendrecv_all_if(hotplug_t)
corenet_udp_sendrecv_all_if(hotplug_t)
corenet_tcp_sendrecv_all_nodes(hotplug_t)
corenet_udp_sendrecv_all_nodes(hotplug_t)
corenet_tcp_sendrecv_all_ports(hotplug_t)
corenet_udp_sendrecv_all_ports(hotplug_t)

dev_rw_sysfs(hotplug_t)
dev_read_usbfs(hotplug_t)
dev_setattr_printer_dev(hotplug_t)
dev_setattr_sound_dev(hotplug_t)
# for SSP:
dev_read_urand(hotplug_t)

fs_getattr_all_fs(hotplug_t)
fs_search_auto_mountpoints(hotplug_t)

storage_setattr_fixed_disk_dev(hotplug_t)
storage_setattr_removable_dev(hotplug_t)

term_dontaudit_use_console(hotplug_t)

corecmd_exec_bin(hotplug_t)
corecmd_exec_shell(hotplug_t)
corecmd_exec_sbin(hotplug_t)
corecmd_exec_ls(hotplug_t)

domain_use_interactive_fds(hotplug_t)
# for ps
domain_dontaudit_read_all_domains_state(hotplug_t)
domain_dontaudit_getattr_all_domains(hotplug_t)

files_read_etc_files(hotplug_t)
files_manage_etc_runtime_files(hotplug_t)
files_etc_filetrans_etc_runtime(hotplug_t,file)
files_exec_etc_files(hotplug_t)
# for when filesystems are not mounted early in the boot:
files_dontaudit_search_isid_type_dirs(hotplug_t)

init_use_fds(hotplug_t)
init_use_script_ptys(hotplug_t)
init_read_script_state(hotplug_t)
# Allow hotplug (including /sbin/ifup-local) to start/stop services and
# run sendmail -q
init_domtrans_script(hotplug_t)
# kernel threads inherit from shared descriptor table used by init
init_dontaudit_rw_initctl(hotplug_t)

logging_send_syslog_msg(hotplug_t)
logging_search_logs(hotplug_t)

libs_use_ld_so(hotplug_t)
libs_use_shared_libs(hotplug_t)
# Read /usr/lib/gconv/.*
libs_read_lib_files(hotplug_t)

miscfiles_read_hwdata(hotplug_t)
miscfiles_read_localization(hotplug_t)

modutils_domtrans_insmod(hotplug_t)
modutils_read_module_deps(hotplug_t)

seutil_dontaudit_search_config(hotplug_t)

sysnet_read_config(hotplug_t)

userdom_dontaudit_use_unpriv_user_fds(hotplug_t)
userdom_dontaudit_search_sysadm_home_dirs(hotplug_t)

ifdef(`distro_redhat', `
	optional_policy(`
		# for arping used for static IP addresses on PCMCIA ethernet
		netutils_domtrans(hotplug_t)
		fs_rw_tmpfs_chr_files(hotplug_t)
	')
	files_getattr_generic_locks(hotplug_t)
')

ifdef(`targeted_policy', `
	term_dontaudit_use_unallocated_ttys(hotplug_t)
	term_dontaudit_use_generic_ptys(hotplug_t)

	optional_policy(`
		consoletype_exec(hotplug_t)
	')
')

optional_policy(`
	dbus_system_bus_client_template(hotplug,hotplug_t)
')

optional_policy(`
	fstools_domtrans(hotplug_t)
')

optional_policy(`
	hal_dgram_send(hotplug_t)
')

optional_policy(`
	hostname_exec(hotplug_t)
')

optional_policy(`
	iptables_domtrans(hotplug_t)
')

optional_policy(`
	mount_domtrans(hotplug_t)
')

optional_policy(`
	mta_send_mail(hotplug_t)
')

optional_policy(`
	nis_use_ypbind(hotplug_t)
')

optional_policy(`
	nscd_socket_use(hotplug_t)
')

optional_policy(`
	seutil_sigchld_newrole(hotplug_t)
')

optional_policy(`
	sysnet_domtrans_dhcpc(hotplug_t)
	sysnet_signal_dhcpc(hotplug_t)
	sysnet_kill_dhcpc(hotplug_t)
	sysnet_signull_dhcpc(hotplug_t)
	sysnet_sigstop_dhcpc(hotplug_t)
	sysnet_sigchld_dhcpc(hotplug_t)
	sysnet_read_dhcpc_pid(hotplug_t)
	sysnet_rw_dhcp_config(hotplug_t)
	sysnet_domtrans_ifconfig(hotplug_t)
')

optional_policy(`
	udev_domtrans(hotplug_t)
	udev_helper_domtrans(hotplug_t)
	udev_read_db(hotplug_t)
')

optional_policy(`
	updfstab_domtrans(hotplug_t)
')

optional_policy(`
	usbmodules_domtrans(hotplug_t)
')