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 763c44
fs_get_persistent_fs_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 3b857e
# for when /usr is not mounted:
Chris PeBenito 3b857e
files_ignore_search_isid_type_dir(hostname_t)
Chris PeBenito 3b857e
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 f5c42b
userdomain_use_all_users_file_descriptors(hostname_t)
Chris PeBenito f5c42b
Chris PeBenito 254bbc
ifdef(`distro_redhat', `
Chris PeBenito 763c44
	fs_use_tmpfs_character_devices(hostname_t)
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito 254bbc
ifdef(`targeted_policy', `
Chris PeBenito 0c73cd
	terminal_ignore_use_general_physical_terminal(hostname_t)
Chris PeBenito 0c73cd
	terminal_ignore_use_general_pseudoterminal(hostname_t)
Chris PeBenito 0c73cd
	files_ignore_read_rootfs_file(hostname_t)
Chris PeBenito 0c73cd
')
Chris PeBenito 15e3d8
Chris PeBenito f5c42b
tunable_policy(`use_dns',`
Chris PeBenito 0c73cd
	allow hostname_t self:udp_socket { create ioctl read getattr write setattr append bind getopt setopt shutdown connect };
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_all_interfaces(hostname_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_raw_on_all_interfaces(hostname_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_all_nodes(hostname_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_raw_on_all_nodes(hostname_t)
Chris PeBenito 0c73cd
	corenetwork_bind_udp_on_all_nodes(hostname_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_dns_port(hostname_t)
Chris PeBenito 0c73cd
	sysnetwork_read_network_config(hostname_t)
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito 2812bf
optional_policy(`hotplug.te',`
Chris PeBenito 0c73cd
	hotplug_ignore_use_file_descriptors(hostname_t)
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 15e3d8
optional_policy(`selinux.te',`
Chris PeBenito 0c73cd
	selinux_newrole_sigchld(hostname_t)
Chris PeBenito 15e3d8
')
Chris PeBenito 15e3d8
Chris PeBenito 13e94c
optional_policy(`udev.te', `
Chris PeBenito 0c73cd
	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
allow hostname_t autofs_t:dir { search getattr };
Chris PeBenito 15e3d8
##end daemon_base_domain
Chris PeBenito 15e3d8
') dnl end TODO