Blob Blame History Raw
policy_module(ethereal, 2.0.0)

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

type ethereal_t;
type ethereal_exec_t;
typealias ethereal_t alias { user_ethereal_t staff_ethereal_t sysadm_ethereal_t };
typealias ethereal_t alias { auditadm_ethereal_t secadm_ethereal_t };
application_domain(ethereal_t, ethereal_exec_t)
ubac_constrained(ethereal_t)

type ethereal_home_t;
typealias ethereal_home_t alias { user_ethereal_home_t staff_ethereal_home_t sysadm_ethereal_home_t };
typealias ethereal_home_t alias { auditadm_ethereal_home_t secadm_ethereal_home_t };
files_poly_member(ethereal_home_t)
userdom_user_home_content(ethereal_home_t)

type ethereal_tmp_t;
typealias ethereal_tmp_t alias { user_ethereal_tmp_t staff_ethereal_tmp_t sysadm_ethereal_tmp_t };
typealias ethereal_tmp_t alias { auditadm_ethereal_tmp_t secadm_ethereal_tmp_t };
files_tmp_file(ethereal_tmp_t)
ubac_constrained(ethereal_tmp_t)

type ethereal_tmpfs_t;
typealias ethereal_tmpfs_t alias { user_ethereal_tmpfs_t staff_ethereal_tmpfs_t sysadm_ethereal_tmpfs_t };
typealias ethereal_tmpfs_t alias { auditadm_ethereal_tmpfs_t secadm_ethereal_tmpfs_t };
files_tmpfs_file(ethereal_tmpfs_t)
ubac_constrained(ethereal_tmpfs_t)

type tethereal_t;
type tethereal_exec_t;
application_domain(tethereal_t, tethereal_exec_t)

type tethereal_tmp_t;
files_tmp_file(tethereal_tmp_t)

##############################
#
# Local Policy
#

allow ethereal_t self:capability { net_admin net_raw setgid };
allow ethereal_t self:process { signal getsched };
allow ethereal_t self:fifo_file { getattr read write };
allow ethereal_t self:shm destroy;
allow ethereal_t self:shm create_shm_perms;
allow ethereal_t self:netlink_route_socket { nlmsg_read create_socket_perms };
allow ethereal_t self:packet_socket { setopt bind ioctl getopt create read };
allow ethereal_t self:tcp_socket create_socket_perms;
allow ethereal_t self:udp_socket create_socket_perms;

# Re-execute itself (why?)
can_exec(ethereal_t, ethereal_exec_t)
corecmd_search_bin(ethereal_t)

# /home/.ethereal
manage_dirs_pattern(ethereal_t, ethereal_home_t, ethereal_home_t)
manage_files_pattern(ethereal_t, ethereal_home_t, ethereal_home_t)
manage_lnk_files_pattern(ethereal_t, ethereal_home_t, ethereal_home_t)
userdom_user_home_dir_filetrans(ethereal_t, ethereal_home_t, dir)

# Store temporary files
manage_dirs_pattern(ethereal_t, ethereal_tmp_t, ethereal_tmp_t)
manage_files_pattern(ethereal_t, ethereal_tmp_t, ethereal_tmp_t)
files_tmp_filetrans(ethereal_t, ethereal_tmp_t, { dir file })

manage_dirs_pattern(ethereal_t, ethereal_tmpfs_t, ethereal_tmpfs_t)
manage_files_pattern(ethereal_t, ethereal_tmpfs_t, ethereal_tmpfs_t)
manage_lnk_files_pattern(ethereal_t, ethereal_tmpfs_t, ethereal_tmpfs_t)
manage_sock_files_pattern(ethereal_t, ethereal_tmpfs_t, ethereal_tmpfs_t)
manage_fifo_files_pattern(ethereal_t, ethereal_tmpfs_t, ethereal_tmpfs_t)
fs_tmpfs_filetrans(ethereal_t, ethereal_tmpfs_t, { dir file lnk_file sock_file fifo_file })

kernel_read_kernel_sysctls(ethereal_t)
kernel_read_system_state(ethereal_t)
kernel_read_sysctl(ethereal_t)

corenet_tcp_connect_generic_port(ethereal_t)
corenet_tcp_sendrecv_generic_if(ethereal_t)

dev_read_urand(ethereal_t)

files_read_etc_files(ethereal_t)
files_read_usr_files(ethereal_t)

fs_list_inotifyfs(ethereal_t)
fs_search_auto_mountpoints(ethereal_t)

libs_read_lib_files(ethereal_t)

miscfiles_read_fonts(ethereal_t)
miscfiles_read_localization(ethereal_t)

seutil_use_newrole_fds(ethereal_t)

sysnet_read_config(ethereal_t)

userdom_manage_user_home_content_files(ethereal_t)
userdom_use_user_terminals(ethereal_t)

tunable_policy(`use_nfs_home_dirs',`
	fs_manage_nfs_dirs(ethereal_t)
	fs_manage_nfs_files(ethereal_t)
	fs_manage_nfs_symlinks(ethereal_t)
')

tunable_policy(`use_samba_home_dirs',`
	fs_manage_cifs_dirs(ethereal_t)
	fs_manage_cifs_files(ethereal_t)
	fs_manage_cifs_symlinks(ethereal_t)
')

optional_policy(`
	nscd_socket_use(ethereal_t)
')

# Manual transition from userhelper 
optional_policy(`
	userhelper_use_fd(ethereal_t)
	userhelper_sigchld(ethereal_t)
')

optional_policy(`
	xserver_user_x_domain_template(ethereal, ethereal_t, ethereal_tmpfs_t)
	xserver_create_xdm_tmp_sockets(ethereal_t)
')

########################################
#
# Tethereal policy
#

allow tethereal_t tethereal_t : capability { dac_override dac_read_search setgid setuid net_raw };
allow tethereal_t self:unix_stream_socket create_stream_socket_perms;
allow tethereal_t self:netlink_route_socket create_netlink_socket_perms;
allow tethereal_t self:packet_socket create_socket_perms;
allow tethereal_t self:tcp_socket create_socket_perms;
allow tethereal_t self:udp_socket create_socket_perms;

# Store temporary files
manage_dirs_pattern(tethereal_t, tethereal_tmp_t, tethereal_tmp_t)
manage_files_pattern(tethereal_t, tethereal_tmp_t, tethereal_tmp_t)
files_tmp_filetrans(tethereal_t, tethereal_tmp_t, { dir file })

# /proc
kernel_read_all_sysctls(tethereal_t)
kernel_read_system_state(tethereal_t)

# Read ethereal files in /usr
files_read_usr_files(tethereal_t)
# /etc/nsswitch.conf
files_read_etc_files(tethereal_t)

miscfiles_read_localization(tethereal_t)

seutil_use_newrole_fds(tethereal_t)

sysnet_dns_name_resolve(tethereal_t)

userdom_use_user_terminals(tethereal_t)

optional_policy(`
	nscd_socket_use(tethereal_t)
')