Blob Blame History Raw

policy_module(iptables, 1.0)

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

type iptables_t;
type iptables_exec_t;
init_system_domain(iptables_t,iptables_exec_t)
role system_r types iptables_t;

type iptables_tmp_t;
files_tmp_file(iptables_tmp_t)

type iptables_var_run_t;
files_pid_file(iptables_var_run_t)

########################################
#
# Iptables local policy
#

allow iptables_t self:capability { net_admin net_raw };
dontaudit iptables_t self:capability sys_tty_config;
allow iptables_t self:process { sigchld sigkill sigstop signull signal };

allow iptables_t iptables_var_run_t:dir rw_dir_perms;
files_create_pid(iptables_t,iptables_var_run_t)

can_exec(iptables_t,iptables_exec_t)

allow iptables_t iptables_tmp_t:dir create_dir_perms;
allow iptables_t iptables_tmp_t:file create_file_perms;
files_create_tmp_files(iptables_t, iptables_tmp_t, { file dir })

allow iptables_t self:rawip_socket create_socket_perms;

kernel_read_system_state(iptables_t)
kernel_read_network_state(iptables_t)
kernel_read_hardware_state(iptables_t)
kernel_read_kernel_sysctl(iptables_t)
kernel_read_modprobe_sysctl(iptables_t)
kernel_use_fd(iptables_t)

fs_getattr_xattr_fs(iptables_t)

term_dontaudit_use_console(iptables_t)

domain_use_wide_inherit_fd(iptables_t)

files_read_generic_etc_files(iptables_t)

init_use_fd(iptables_t)
init_use_script_pty(iptables_t)
# to allow rules to be saved on reboot:
init_rw_script_tmp_files(iptables_t)

libs_use_ld_so(iptables_t)
libs_use_shared_libs(iptables_t)

logging_send_syslog_msg(iptables_t)
# system-config-network appends to /var/log
#logging_append_system_logs(iptables_t)

miscfiles_read_localization(iptables_t)

sysnet_domtrans_ifconfig(iptables_t)

userdom_use_all_user_fd(iptables_t)

tunable_policy(`use_dns',`
	allow iptables_t self:udp_socket create_socket_perms;

	corenet_udp_sendrecv_all_if(iptables_t)
	corenet_raw_sendrecv_all_if(iptables_t)
	corenet_udp_sendrecv_all_nodes(iptables_t)
	corenet_raw_sendrecv_all_nodes(iptables_t)
	corenet_udp_bind_all_nodes(iptables_t)
	corenet_udp_sendrecv_dns_port(iptables_t)

	sysnet_read_config(iptables_t)
')

optional_policy(`modutils.te', `
	corecmd_search_sbin(iptables_t)
	modutils_domtrans_insmod(iptables_t)
')

optional_policy(`selinux.te',`
	selinux_newrole_sigchld(iptables_t)
')

optional_policy(`udev.te', `
	udev_read_db(iptables_t)
')

ifdef(`targeted_policy', `
	term_dontaudit_use_unallocated_tty(iptables_t)
	term_dontaudit_use_generic_pty(iptables_t)

	files_dontaudit_read_root_file(iptables_t)
')

ifdef(`TODO',`

optional_policy(`rhgb.te', `
allow iptables_t rhgb_t:process sigchld;
allow iptables_t rhgb_t:fd use;
allow iptables_t rhgb_t:fifo_file rw_file_perms;
')

allow iptables_t autofs_t:dir { search getattr };

# for iptables -L
can_ypbind(iptables_t)

optional_policy(`gnome-pty-helper.te',`
	allow iptables_t sysadm_gph_t:fd use;
')

optional_policy(`firstboot.te', `
	allow iptables_t firstboot_t:fifo_file write;
')
') dnl ifdef TODO