policy_module(finger)

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

type fingerd_t;
type fingerd_exec_t;
init_daemon_domain(fingerd_t, fingerd_exec_t)
inetd_tcp_service_domain(fingerd_t, fingerd_exec_t)

type fingerd_etc_t;
files_config_file(fingerd_etc_t)

type fingerd_log_t;
logging_log_file(fingerd_log_t)

type fingerd_runtime_t alias fingerd_var_run_t;
files_runtime_file(fingerd_runtime_t)

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

allow fingerd_t self:capability { setgid setuid };
dontaudit fingerd_t self:capability { fsetid sys_tty_config };
allow fingerd_t self:process signal_perms;
allow fingerd_t self:fifo_file rw_fifo_file_perms;
allow fingerd_t self:tcp_socket connected_stream_socket_perms;

manage_files_pattern(fingerd_t, fingerd_runtime_t, fingerd_runtime_t)
files_runtime_filetrans(fingerd_t, fingerd_runtime_t, file)

allow fingerd_t fingerd_etc_t:dir list_dir_perms;
read_files_pattern(fingerd_t, fingerd_etc_t, fingerd_etc_t)
read_lnk_files_pattern(fingerd_t, fingerd_etc_t, fingerd_etc_t)

allow fingerd_t fingerd_log_t:file append_file_perms;
allow fingerd_t fingerd_log_t:file create_file_perms;
allow fingerd_t fingerd_log_t:file setattr_file_perms;
logging_log_filetrans(fingerd_t, fingerd_log_t, file)

kernel_read_kernel_sysctls(fingerd_t)
kernel_read_system_state(fingerd_t)

corenet_all_recvfrom_netlabel(fingerd_t)
corenet_tcp_sendrecv_generic_if(fingerd_t)
corenet_tcp_sendrecv_generic_node(fingerd_t)
corenet_tcp_bind_generic_node(fingerd_t)

corenet_sendrecv_fingerd_server_packets(fingerd_t)
corenet_tcp_bind_fingerd_port(fingerd_t)

corecmd_exec_bin(fingerd_t)
corecmd_exec_shell(fingerd_t)

dev_read_sysfs(fingerd_t)

domain_use_interactive_fds(fingerd_t)

files_read_etc_runtime_files(fingerd_t)

fs_getattr_all_fs(fingerd_t)
fs_search_auto_mountpoints(fingerd_t)

term_getattr_all_ttys(fingerd_t)
term_getattr_all_ptys(fingerd_t)

auth_read_lastlog(fingerd_t)

init_read_utmp(fingerd_t)
init_dontaudit_write_utmp(fingerd_t)

logging_send_syslog_msg(fingerd_t)

mta_getattr_spool(fingerd_t)

miscfiles_read_localization(fingerd_t)

userdom_dontaudit_use_unpriv_user_fds(fingerd_t)

optional_policy(`
	cron_system_entry(fingerd_t, fingerd_exec_t)
')

optional_policy(`
	logrotate_exec(fingerd_t)
')

optional_policy(`
	seutil_sigchld_newrole(fingerd_t)
')

optional_policy(`
	tcpd_wrapped_domain(fingerd_t, fingerd_exec_t)
')

