Blob Blame History Raw

policy_module(uml, 2.0.1)

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

type uml_t;
type uml_exec_t;
typealias uml_t alias { user_uml_t staff_uml_t sysadm_uml_t };
typealias uml_t alias { auditadm_uml_t secadm_uml_t };
application_domain(uml_t, uml_exec_t)
ubac_constrained(uml_t)

type uml_ro_t;
typealias uml_ro_t alias { user_uml_ro_t staff_uml_ro_t sysadm_uml_ro_t };
typealias uml_ro_t alias { auditadm_uml_ro_t secadm_uml_ro_t };
files_type(uml_ro_t)
ubac_constrained(uml_ro_t)

type uml_rw_t;
typealias uml_rw_t alias { user_uml_rw_t staff_uml_rw_t sysadm_uml_rw_t };
typealias uml_rw_t alias { auditadm_uml_rw_t secadm_uml_rw_t };
files_type(uml_rw_t)
ubac_constrained(uml_rw_t)

type uml_tmp_t;
typealias uml_tmp_t alias { user_uml_tmp_t staff_uml_tmp_t sysadm_uml_tmp_t };
typealias uml_tmp_t alias { auditadm_uml_tmp_t secadm_uml_tmp_t };
files_tmp_file(uml_tmp_t)
ubac_constrained(uml_tmp_t)

type uml_tmpfs_t;
typealias uml_tmpfs_t alias { user_uml_tmpfs_t staff_uml_tmpfs_t sysadm_uml_tmpfs_t };
typealias uml_tmpfs_t alias { auditadm_uml_tmpfs_t secadm_uml_tmpfs_t };
files_tmpfs_file(uml_tmpfs_t)
ubac_constrained(uml_tmpfs_t)

type uml_devpts_t;
typealias uml_devpts_t alias { user_uml_devpts_t staff_uml_devpts_t sysadm_uml_devpts_t };
typealias uml_devpts_t alias { auditadm_uml_devpts_t secadm_uml_devpts_t };
term_pty(uml_devpts_t)
ubac_constrained(uml_devpts_t)

type uml_switch_t;
type uml_switch_exec_t;
init_daemon_domain(uml_switch_t, uml_switch_exec_t)

type uml_switch_var_run_t;
files_pid_file(uml_switch_var_run_t)

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

allow uml_t self:fifo_file rw_fifo_file_perms;
allow uml_t self:process { signal_perms ptrace };
allow uml_t self:unix_stream_socket create_stream_socket_perms;
allow uml_t self:unix_dgram_socket create_socket_perms;
# Use the network.
allow uml_t self:tcp_socket create_stream_socket_perms;
allow uml_t self:udp_socket create_socket_perms;
# for mconsole
allow uml_t self:unix_dgram_socket sendto;

# allow the UML thing to happen
allow uml_t uml_devpts_t:chr_file { rw_file_perms setattr };
term_create_pty(uml_t, uml_devpts_t)

manage_dirs_pattern(uml_t, uml_tmp_t, uml_tmp_t)
manage_files_pattern(uml_t, uml_tmp_t, uml_tmp_t)
files_tmp_filetrans(uml_t, uml_tmp_t, { file dir })
can_exec(uml_t, uml_tmp_t)

manage_files_pattern(uml_t, uml_tmpfs_t, uml_tmpfs_t)
manage_lnk_files_pattern(uml_t, uml_tmpfs_t, uml_tmpfs_t)
manage_fifo_files_pattern(uml_t, uml_tmpfs_t, uml_tmpfs_t)
manage_sock_files_pattern(uml_t, uml_tmpfs_t, uml_tmpfs_t)
fs_tmpfs_filetrans(uml_t, uml_tmpfs_t, { file lnk_file sock_file fifo_file })
can_exec(uml_t, uml_tmpfs_t)

# access config files
allow uml_t { uml_ro_t uml_ro_t }:dir list_dir_perms;
read_files_pattern(uml_t, { uml_ro_t uml_ro_t }, { uml_ro_t uml_ro_t })
read_lnk_files_pattern(uml_t, { uml_ro_t uml_ro_t }, { uml_ro_t uml_ro_t })

manage_dirs_pattern(uml_t, uml_rw_t, uml_rw_t)
manage_files_pattern(uml_t, uml_rw_t, uml_rw_t)
manage_lnk_files_pattern(uml_t, uml_rw_t, uml_rw_t)
manage_fifo_files_pattern(uml_t, uml_rw_t, uml_rw_t)
manage_sock_files_pattern(uml_t, uml_rw_t, uml_rw_t)
userdom_user_home_dir_filetrans(uml_t, uml_rw_t, { file lnk_file sock_file fifo_file })

can_exec(uml_t, { uml_exec_t uml_exec_t })

kernel_read_system_state(uml_t)
# for SKAS - need something better
kernel_write_proc_files(uml_t)

# for xterm
corecmd_exec_bin(uml_t)

corenet_all_recvfrom_unlabeled(uml_t)
corenet_all_recvfrom_netlabel(uml_t)
corenet_tcp_sendrecv_generic_if(uml_t)
corenet_udp_sendrecv_generic_if(uml_t)
corenet_tcp_sendrecv_generic_node(uml_t)
corenet_udp_sendrecv_generic_node(uml_t)
corenet_tcp_sendrecv_all_ports(uml_t)
corenet_udp_sendrecv_all_ports(uml_t)
corenet_tcp_connect_all_ports(uml_t)
corenet_sendrecv_all_client_packets(uml_t)
corenet_rw_tun_tap_dev(uml_t)

domain_use_interactive_fds(uml_t)

# for xterm
files_read_etc_files(uml_t)
files_dontaudit_read_etc_runtime_files(uml_t)
# putting uml data under /var is usual...
files_search_var(uml_t)

fs_getattr_xattr_fs(uml_t)

init_read_utmp(uml_t)
init_dontaudit_write_utmp(uml_t)

# for xterm
libs_exec_lib_files(uml_t)

# Inherit and use descriptors from newrole.
seutil_use_newrole_fds(uml_t)

# Use the network.
sysnet_read_config(uml_t)

userdom_use_user_terminals(uml_t)

optional_policy(`
	nis_use_ypbind(uml_t)
')

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

dontaudit uml_switch_t self:capability sys_tty_config;
allow uml_switch_t self:process signal_perms;
allow uml_switch_t self:unix_dgram_socket create_socket_perms;
allow uml_switch_t self:unix_stream_socket create_stream_socket_perms;

manage_files_pattern(uml_switch_t, uml_switch_var_run_t, uml_switch_var_run_t)
manage_sock_files_pattern(uml_switch_t, uml_switch_var_run_t, uml_switch_var_run_t)
files_pid_filetrans(uml_switch_t, uml_switch_var_run_t, file)

kernel_read_kernel_sysctls(uml_switch_t)
kernel_list_proc(uml_switch_t)
kernel_read_proc_symlinks(uml_switch_t)

dev_read_sysfs(uml_switch_t)

domain_use_interactive_fds(uml_switch_t)

fs_getattr_all_fs(uml_switch_t)
fs_search_auto_mountpoints(uml_switch_t)

term_dontaudit_use_console(uml_switch_t)

init_use_fds(uml_switch_t)
init_use_script_ptys(uml_switch_t)

logging_send_syslog_msg(uml_switch_t)

miscfiles_read_localization(uml_switch_t)

userdom_dontaudit_use_unpriv_user_fds(uml_switch_t)
userdom_dontaudit_search_user_home_dirs(uml_switch_t)

optional_policy(`
	seutil_sigchld_newrole(uml_switch_t)
')

optional_policy(`
	udev_read_db(uml_switch_t)
')