policy_module(ncftool)

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

attribute_role ncftool_roles;
roleattribute system_r ncftool_roles;

type ncftool_t;
type ncftool_exec_t;
application_domain(ncftool_t, ncftool_exec_t)
domain_obj_id_change_exemption(ncftool_t)
domain_system_change_exemption(ncftool_t)
role ncftool_roles types ncftool_t;

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

allow ncftool_t self:capability net_admin;
allow ncftool_t self:process signal;
allow ncftool_t self:fifo_file manage_fifo_file_perms;
allow ncftool_t self:unix_stream_socket create_stream_socket_perms;
allow ncftool_t self:netlink_route_socket create_netlink_socket_perms;
allow ncftool_t self:tcp_socket create_stream_socket_perms;

kernel_read_kernel_sysctls(ncftool_t)
kernel_read_modprobe_sysctls(ncftool_t)
kernel_read_network_state(ncftool_t)
kernel_read_system_state(ncftool_t)
kernel_request_load_module(ncftool_t)
kernel_rw_net_sysctls(ncftool_t)

corecmd_exec_bin(ncftool_t)
corecmd_exec_shell(ncftool_t)

domain_read_all_domains_state(ncftool_t)

dev_read_sysfs(ncftool_t)

files_read_etc_files(ncftool_t)
files_read_etc_runtime_files(ncftool_t)
files_read_usr_files(ncftool_t)

miscfiles_read_localization(ncftool_t)

sysnet_delete_dhcpc_runtime_files(ncftool_t)
sysnet_run_dhcpc(ncftool_t, ncftool_roles)
sysnet_run_ifconfig(ncftool_t, ncftool_roles)
sysnet_etc_filetrans_config(ncftool_t)
sysnet_manage_config(ncftool_t)
sysnet_read_dhcpc_state(ncftool_t)
sysnet_read_dhcpc_runtime_files(ncftool_t)
sysnet_signal_dhcpc(ncftool_t)

userdom_use_user_terminals(ncftool_t)
userdom_read_user_tmp_files(ncftool_t)

optional_policy(`
	brctl_run(ncftool_t, ncftool_roles)
')

optional_policy(`
	consoletype_exec(ncftool_t)
')

optional_policy(`
	dbus_system_bus_client(ncftool_t)
')

optional_policy(`
	iptables_initrc_domtrans(ncftool_t)
')

optional_policy(`
	modutils_read_module_config(ncftool_t)
	modutils_run(ncftool_t, ncftool_roles)
')

optional_policy(`
	netutils_run(ncftool_t, ncftool_roles)
')
