selinux-policy/policy/modules/services/hal.te
Chris PeBenito 1900668638 trunk: Unified labeled networking policy from Paul Moore.
The latest revision of the labeled policy patches which enable both labeled 
and unlabeled policy support for NetLabel.  This revision takes into account
Chris' feedback from the first version and reduces the number of interface
calls in each domain down to two at present: one for unlabeled access, one for
NetLabel access.  The older, transport layer specific interfaces, are still  
present for use by third-party modules but are not used in the default policy
modules.

trunk: Use netmsg initial SID for MLS-only Netlabel packets, from Paul Moore.

This patch changes the policy to use the netmsg initial SID as the "base"
SID/context for NetLabel packets which only have MLS security attributes.
Currently we use the unlabeled initial SID which makes it very difficult to
distinquish between actual unlabeled packets and those packets which have MLS
security attributes.
2007-06-27 15:23:21 +00:00

381 lines
8.9 KiB
Plaintext

policy_module(hal,1.6.3)
########################################
#
# Declarations
#
type hald_t;
type hald_exec_t;
init_daemon_domain(hald_t,hald_exec_t)
type hald_acl_t;
type hald_acl_exec_t;
domain_type(hald_acl_t)
domain_entry_file(hald_acl_t,hald_acl_exec_t)
role system_r types hald_acl_t;
type hald_cache_t;
files_pid_file(hald_cache_t)
type hald_log_t;
files_type(hald_log_t)
type hald_mac_t;
type hald_mac_exec_t;
domain_type(hald_mac_t)
domain_entry_file(hald_mac_t,hald_mac_exec_t)
role system_r types hald_mac_t;
type hald_sonypic_t;
type hald_sonypic_exec_t;
domain_type(hald_sonypic_t)
domain_entry_file(hald_sonypic_t,hald_sonypic_exec_t)
role system_r types hald_sonypic_t;
type hald_tmp_t;
files_tmp_file(hald_tmp_t)
type hald_var_run_t;
files_pid_file(hald_var_run_t)
type hald_var_lib_t;
files_type(hald_var_lib_t)
########################################
#
# Local policy
#
# execute openvt which needs setuid
allow hald_t self:capability { chown setuid setgid kill net_admin sys_admin sys_nice dac_override dac_read_search mknod sys_rawio sys_tty_config };
dontaudit hald_t self:capability {sys_ptrace sys_tty_config };
allow hald_t self:process signal_perms;
allow hald_t self:fifo_file rw_fifo_file_perms;
allow hald_t self:unix_stream_socket { create_stream_socket_perms connectto };
allow hald_t self:unix_dgram_socket create_socket_perms;
allow hald_t self:netlink_kobject_uevent_socket create_socket_perms;
allow hald_t self:tcp_socket create_stream_socket_perms;
allow hald_t self:udp_socket create_socket_perms;
# For backwards compatibility with older kernels
allow hald_t self:netlink_socket create_socket_perms;
manage_files_pattern(hald_t,hald_cache_t,hald_cache_t)
# log files for hald
allow hald_t hald_log_t:file manage_file_perms;
logging_log_filetrans(hald_t,hald_log_t,file)
manage_dirs_pattern(hald_t,hald_tmp_t,hald_tmp_t)
manage_files_pattern(hald_t,hald_tmp_t,hald_tmp_t)
files_tmp_filetrans(hald_t, hald_tmp_t, { file dir })
# var/lib files for hald
manage_dirs_pattern(hald_t,hald_var_lib_t,hald_var_lib_t)
manage_files_pattern(hald_t,hald_var_lib_t,hald_var_lib_t)
manage_sock_files_pattern(hald_t,hald_var_lib_t,hald_var_lib_t)
manage_files_pattern(hald_t,hald_var_run_t,hald_var_run_t)
files_pid_filetrans(hald_t,hald_var_run_t,file)
kernel_read_system_state(hald_t)
kernel_read_network_state(hald_t)
kernel_rw_kernel_sysctl(hald_t)
kernel_read_fs_sysctls(hald_t)
kernel_rw_irq_sysctls(hald_t)
kernel_rw_vm_sysctls(hald_t)
kernel_write_proc_files(hald_t)
auth_read_pam_console_data(hald_t)
corecmd_exec_all_executables(hald_t)
corenet_all_recvfrom_unlabeled(hald_t)
corenet_all_recvfrom_netlabel(hald_t)
corenet_tcp_sendrecv_all_if(hald_t)
corenet_udp_sendrecv_all_if(hald_t)
corenet_tcp_sendrecv_all_nodes(hald_t)
corenet_udp_sendrecv_all_nodes(hald_t)
corenet_tcp_sendrecv_all_ports(hald_t)
corenet_udp_sendrecv_all_ports(hald_t)
dev_rw_usbfs(hald_t)
dev_read_urand(hald_t)
dev_read_input(hald_t)
dev_read_mouse(hald_t)
dev_rw_printer(hald_t)
dev_read_lvm_control(hald_t)
dev_getattr_all_chr_files(hald_t)
dev_manage_generic_chr_files(hald_t)
dev_rw_generic_usb_dev(hald_t)
dev_setattr_generic_usb_dev(hald_t)
dev_setattr_usbfs_files(hald_t)
dev_rw_power_management(hald_t)
# hal is now execing pm-suspend
dev_rw_sysfs(hald_t)
domain_use_interactive_fds(hald_t)
domain_read_all_domains_state(hald_t)
domain_dontaudit_ptrace_all_domains(hald_t)
files_exec_etc_files(hald_t)
files_read_etc_files(hald_t)
files_rw_etc_runtime_files(hald_t)
files_manage_mnt_dirs(hald_t)
files_manage_mnt_files(hald_t)
files_manage_mnt_symlinks(hald_t)
files_search_var_lib(hald_t)
files_read_usr_files(hald_t)
# hal is now execing pm-suspend
files_create_boot_flag(hald_t)
files_getattr_all_dirs(hald_t)
files_read_kernel_img(hald_t)
fs_getattr_all_fs(hald_t)
fs_search_all(hald_t)
fs_list_inotifyfs(hald_t)
fs_list_auto_mountpoints(hald_t)
files_getattr_all_mountpoints(hald_t)
mls_file_read_up(hald_t)
selinux_get_fs_mount(hald_t)
selinux_validate_context(hald_t)
selinux_compute_access_vector(hald_t)
selinux_compute_create_context(hald_t)
selinux_compute_relabel_context(hald_t)
selinux_compute_user_contexts(hald_t)
storage_raw_read_removable_device(hald_t)
storage_raw_write_removable_device(hald_t)
storage_raw_read_fixed_disk(hald_t)
storage_raw_write_fixed_disk(hald_t)
# hal_probe_serial causes these
term_setattr_unallocated_ttys(hald_t)
term_dontaudit_use_unallocated_ttys(hald_t)
auth_use_nsswitch(hald_t)
init_domtrans_script(hald_t)
init_read_utmp(hald_t)
#hal runs shutdown, probably need a shutdown domain
init_rw_utmp(hald_t)
init_telinit(hald_t)
libs_use_ld_so(hald_t)
libs_use_shared_libs(hald_t)
libs_exec_ld_so(hald_t)
libs_exec_lib_files(hald_t)
logging_send_audit_msgs(hald_t)
logging_send_syslog_msg(hald_t)
logging_search_logs(hald_t)
miscfiles_read_localization(hald_t)
miscfiles_read_hwdata(hald_t)
modutils_domtrans_insmod(hald_t)
seutil_read_config(hald_t)
seutil_read_default_contexts(hald_t)
sysnet_read_config(hald_t)
userdom_dontaudit_use_unpriv_user_fds(hald_t)
userdom_dontaudit_search_sysadm_home_dirs(hald_t)
ifdef(`targeted_policy',`
term_dontaudit_use_generic_ptys(hald_t)
files_dontaudit_read_root_files(hald_t)
')
optional_policy(`
alsa_read_rw_config(hald_t)
')
optional_policy(`
bootloader_domtrans(hald_t)
')
optional_policy(`
# For /usr/libexec/hald-addon-acpi
# writes to /var/run/acpid.socket
apm_stream_connect(hald_t)
')
optional_policy(`
bind_search_cache(hald_t)
')
optional_policy(`
bluetooth_domtrans(hald_t)
')
optional_policy(`
clock_domtrans(hald_t)
')
optional_policy(`
cups_domtrans_config(hald_t)
cups_signal_config(hald_t)
')
optional_policy(`
dbus_system_bus_client_template(hald,hald_t)
dbus_send_system_bus(hald_t)
dbus_connect_system_bus(hald_t)
allow hald_t self:dbus send_msg;
init_dbus_chat_script(hald_t)
optional_policy(`
networkmanager_dbus_chat(hald_t)
')
')
optional_policy(`
# For /usr/libexec/hald-probe-smbios
dmidecode_domtrans(hald_t)
')
optional_policy(`
hotplug_read_config(hald_t)
')
optional_policy(`
lvm_domtrans(hald_t)
')
optional_policy(`
mount_domtrans(hald_t)
')
optional_policy(`
ntp_domtrans(hald_t)
')
optional_policy(`
pcmcia_manage_pid(hald_t)
pcmcia_manage_pid_chr_files(hald_t)
')
optional_policy(`
rpc_search_nfs_state_data(hald_t)
')
optional_policy(`
seutil_sigchld_newrole(hald_t)
')
optional_policy(`
udev_domtrans(hald_t)
udev_read_db(hald_t)
')
optional_policy(`
updfstab_domtrans(hald_t)
')
optional_policy(`
vbetool_domtrans(hald_t)
')
########################################
#
# Hal acl local policy
#
allow hald_acl_t self:capability { dac_override fowner };
allow hald_acl_t self:fifo_file read_fifo_file_perms;
domtrans_pattern(hald_t, hald_acl_exec_t, hald_acl_t)
allow hald_t hald_acl_t:process signal;
allow hald_acl_t hald_t:unix_stream_socket connectto;
manage_dirs_pattern(hald_acl_t,hald_var_lib_t,hald_var_lib_t)
manage_files_pattern(hald_acl_t,hald_var_lib_t,hald_var_lib_t)
files_search_var_lib(hald_acl_t)
corecmd_exec_bin(hald_acl_t)
dev_getattr_all_chr_files(hald_acl_t)
dev_setattr_video_dev(hald_acl_t)
dev_setattr_sound_dev(hald_acl_t)
dev_setattr_generic_usb_dev(hald_acl_t)
dev_setattr_usbfs_files(hald_acl_t)
files_read_usr_files(hald_acl_t)
files_read_etc_files(hald_acl_t)
storage_getattr_removable_dev(hald_acl_t)
storage_setattr_removable_dev(hald_acl_t)
auth_use_nsswitch(hald_acl_t)
libs_use_ld_so(hald_acl_t)
libs_use_shared_libs(hald_acl_t)
miscfiles_read_localization(hald_acl_t)
ifdef(`targeted_policy',`
term_dontaudit_use_console(hald_acl_t)
term_dontaudit_use_generic_ptys(hald_acl_t)
')
########################################
#
# Local hald mac policy
#
domtrans_pattern(hald_t, hald_mac_exec_t, hald_mac_t)
allow hald_t hald_mac_t:process signal;
allow hald_mac_t hald_t:unix_stream_socket connectto;
manage_dirs_pattern(hald_mac_t,hald_var_lib_t,hald_var_lib_t)
manage_files_pattern(hald_mac_t,hald_var_lib_t,hald_var_lib_t)
files_search_var_lib(hald_mac_t)
dev_write_raw_memory(hald_mac_t)
files_read_usr_files(hald_mac_t)
libs_use_ld_so(hald_mac_t)
libs_use_shared_libs(hald_mac_t)
miscfiles_read_localization(hald_mac_t)
ifdef(`targeted_policy',`
term_dontaudit_use_console(hald_mac_t)
term_dontaudit_use_generic_ptys(hald_mac_t)
')
########################################
#
# Local hald sonypic policy
#
domtrans_pattern(hald_t, hald_sonypic_exec_t, hald_sonypic_t)
allow hald_t hald_sonypic_t:process signal;
allow hald_sonypic_t hald_t:unix_stream_socket connectto;
dev_read_video_dev(hald_sonypic_t)
dev_write_video_dev(hald_sonypic_t)
manage_dirs_pattern(hald_sonypic_t,hald_var_lib_t,hald_var_lib_t)
manage_files_pattern(hald_sonypic_t,hald_var_lib_t,hald_var_lib_t)
files_search_var_lib(hald_sonypic_t)
files_read_usr_files(hald_sonypic_t)
libs_use_ld_so(hald_sonypic_t)
libs_use_shared_libs(hald_sonypic_t)
miscfiles_read_localization(hald_sonypic_t)
ifdef(`targeted_policy',`
term_dontaudit_use_console(hald_sonypic_t)
term_dontaudit_use_generic_ptys(hald_sonypic_t)
')