Blob Blame History Raw

policy_module(firstboot,1.1.0)

gen_require(`
	class passwd rootok;
')

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

type firstboot_t;
type firstboot_exec_t;
init_system_domain(firstboot_t,firstboot_exec_t)
domain_obj_id_change_exempt(firstboot_t)
domain_subj_id_change_exempt(firstboot_t)
role system_r types firstboot_t;

type firstboot_etc_t;
files_config_file(firstboot_etc_t)

type firstboot_rw_t;
files_type(firstboot_rw_t)

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

allow firstboot_t self:capability { dac_override setgid };
allow firstboot_t self:process setfscreate;
allow firstboot_t self:file { read write };
allow firstboot_t self:fifo_file { getattr read write };
allow firstboot_t self:tcp_socket create_stream_socket_perms;
allow firstboot_t self:unix_stream_socket { connect create };
allow firstboot_t self:passwd rootok;

allow firstboot_t firstboot_etc_t:file { getattr read };

allow firstboot_t firstboot_rw_t:dir create_dir_perms;
allow firstboot_t firstboot_rw_t:file create_file_perms;
files_filetrans_etc(firstboot_t,firstboot_rw_t,file)

# The big hammer
unconfined_domain_template(firstboot_t) 

kernel_read_system_state(firstboot_t)
kernel_read_kernel_sysctls(firstboot_t)

corenet_tcp_sendrecv_all_if(firstboot_t)
corenet_raw_sendrecv_all_if(firstboot_t)
corenet_tcp_sendrecv_all_nodes(firstboot_t)
corenet_raw_sendrecv_all_nodes(firstboot_t)
corenet_tcp_sendrecv_all_ports(firstboot_t)
corenet_non_ipsec_sendrecv(firstboot_t)
corenet_tcp_bind_all_nodes(firstboot_t)

dev_read_urand(firstboot_t)

selinux_get_fs_mount(firstboot_t)
selinux_validate_context(firstboot_t)
selinux_compute_access_vector(firstboot_t)
selinux_compute_create_context(firstboot_t)
selinux_compute_relabel_context(firstboot_t)
selinux_compute_user_contexts(firstboot_t)

auth_dontaudit_getattr_shadow(firstboot_t)

corecmd_exec_bin(firstboot_t)
corecmd_exec_sbin(firstboot_t)

domain_exec_all_entry_files(firstboot_t)

files_exec_etc_files(firstboot_t)
files_manage_etc_files(firstboot_t)
files_read_etc_runtime_files(firstboot_t)
files_read_usr_files(firstboot_t)
files_manage_var_dirs(firstboot_t)
files_manage_var_files(firstboot_t)
files_manage_var_symlinks(firstboot_t)

init_domtrans_script(firstboot_t)
init_rw_utmp(firstboot_t)

libs_use_ld_so(firstboot_t)
libs_use_shared_libs(firstboot_t)
libs_exec_ld_so(firstboot_t)
libs_exec_lib_files(firstboot_t)

locallogin_use_fd(firstboot_t)

logging_send_syslog_msg(firstboot_t)

miscfiles_read_localization(firstboot_t)

modutils_domtrans_insmod(firstboot_t)
modutils_read_module_conf(firstboot_t)
modutils_read_mods_deps(firstboot_t)

# Add/remove user home directories
userdom_filetrans_generic_user_home_dir(firstboot_t)
userdom_manage_generic_user_home_dir(firstboot_t)
userdom_filetrans_generic_user_home(firstboot_t,{ dir file lnk_file fifo_file sock_file })
userdom_manage_generic_user_home_dirs(firstboot_t)
userdom_manage_generic_user_home_files(firstboot_t)
userdom_manage_generic_user_home_symlinks(firstboot_t)
userdom_manage_generic_user_home_pipes(firstboot_t)
userdom_manage_generic_user_home_sockets(firstboot_t)

ifdef(`targeted_policy',`
	unconfined_domtrans(firstboot_t)
')

optional_policy(`nis',`
	nis_use_ypbind(firstboot_t)
')

optional_policy(`samba',`
	samba_rw_config(firstboot_t)
')

optional_policy(`usermanage',`
	usermanage_domtrans_chfn(firstboot_t)
	usermanage_domtrans_groupadd(firstboot_t)
	usermanage_domtrans_passwd(firstboot_t)
	usermanage_domtrans_useradd(firstboot_t)
')

ifdef(`TODO',`
allow firstboot_t proc_t:file write;

ifdef(`printconf.te', `
	can_exec(firstboot_t, printconf_t)
')

ifdef(`userhelper.te', `
	role system_r types sysadm_userhelper_t;
	domain_auto_trans(firstboot_t, userhelper_exec_t, sysadm_userhelper_t)
')

ifdef(`xserver.te', `
	domain_auto_trans(firstboot_t, xserver_exec_t, xdm_xserver_t)
')
') dnl end TODO