Chris PeBenito 15e3d8
# Copyright (C) 2005 Tresys Technology, LLC
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
policy_module(hostname,1.0)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
########################################
Chris PeBenito 15e3d8
#
Chris PeBenito 15e3d8
# Declarations
Chris PeBenito 15e3d8
#
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
type hostname_t;
Chris PeBenito 15e3d8
type hostname_exec_t;
Chris PeBenito ff3138
init_make_system_domain(hostname_t,hostname_exec_t)
Chris PeBenito 15e3d8
role system_r types hostname_t;
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
########################################
Chris PeBenito 15e3d8
#
Chris PeBenito 15e3d8
# Local policy
Chris PeBenito 15e3d8
#
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
# for setting the hostname
Chris PeBenito 15e3d8
allow hostname_t self:process { sigchld sigkill sigstop signull signal };
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
allow hostname_t self:capability sys_admin;
Chris PeBenito 15e3d8
dontaudit hostname_t self:capability sys_tty_config;
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
sysnetwork_read_network_config(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
kernel_read_kernel_sysctl(hostname_t)
Chris PeBenito 15e3d8
kernel_read_hardware_state(hostname_t)
Chris PeBenito 15e3d8
kernel_ignore_use_file_descriptors(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
files_read_general_system_config(hostname_t)
Chris PeBenito 15e3d8
files_ignore_search_system_state_data_directory(hostname_t)
Chris PeBenito 15e3d8
filesystem_get_persistent_filesystem_attributes(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
terminal_ignore_use_console(hostname_t)
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(hostname_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
init_use_file_descriptors(hostname_t)
Chris PeBenito 15e3d8
init_script_use_pseudoterminal(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
domain_use_widely_inheritable_file_descriptors(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
libraries_use_dynamic_loader(hostname_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
logging_send_system_log_message(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
miscfiles_read_localization(hostname_t)
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
tunable_policy(`targeted_policy', `
Chris PeBenito 15e3d8
terminal_ignore_use_general_physical_terminal(hostname_t)
Chris PeBenito 15e3d8
terminal_ignore_use_general_pseudoterminal(hostname_t)
Chris PeBenito 15e3d8
files_ignore_read_rootfs_file(hostname_t)
Chris PeBenito 15e3d8
')dnl end targeted_policy tunable
Chris PeBenito 15e3d8
Chris PeBenito 2812bf
optional_policy(`hotplug.te',`
Chris PeBenito 13e94c
hotplug_ignore_use_file_descriptors(hostname_t)
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
optional_policy(`selinux.te',`
Chris PeBenito 15e3d8
selinux_newrole_sigchld(hostname_t)
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 13e94c
optional_policy(`udev.te', `
Chris PeBenito 13e94c
udev_read_database(hostname_t)
Chris PeBenito 13e94c
')
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
ifdef(`TODO',`
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
##daemon_base_domain(hostname, , nosysadm)
Chris PeBenito 15e3d8
##must remembe to go back and take care of the nosysadm part
Chris PeBenito 15e3d8
allow hostname_t proc_t:dir { read getattr lock search ioctl };
Chris PeBenito 15e3d8
allow hostname_t proc_t:lnk_file read;
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
optional_policy(`rhgb.te', `
Chris PeBenito 15e3d8
allow hostname_t rhgb_t:process sigchld;
Chris PeBenito 15e3d8
allow hostname_t rhgb_t:fd use;
Chris PeBenito 15e3d8
allow hostname_t rhgb_t:fifo_file { read write };
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
dontaudit hostname_t unpriv_userdomain:fd use;
Chris PeBenito 15e3d8
allow hostname_t autofs_t:dir { search getattr };
Chris PeBenito 15e3d8
##end daemon_base_domain
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
##can_resolve(hostname_t)
Chris PeBenito 15e3d8
ifdef(`use_dns',`
Chris PeBenito 15e3d8
base_can_network(hostname_t, udp, `dns_port_t')
Chris PeBenito 15e3d8
allow hostname_t self:udp_socket { connect };
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
##end can_resolve
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
allow hostname_t userdomain:fd use;
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
# for when /usr is not mounted
Chris PeBenito 15e3d8
dontaudit hostname_t file_t:dir search;
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
tunable_policy(`distro_redhat', `
Chris PeBenito 15e3d8
allow hostname_t tmpfs_t:chr_file { ioctl read getattr lock write append };
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
') dnl end TODO