policy_module(memcached)

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

type memcached_t;
type memcached_exec_t;
init_daemon_domain(memcached_t, memcached_exec_t)

type memcached_initrc_exec_t;
init_script_file(memcached_initrc_exec_t)

type memcached_runtime_t alias memcached_var_run_t;
files_runtime_file(memcached_runtime_t)

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

allow memcached_t self:capability { setgid setuid };
dontaudit memcached_t self:capability sys_tty_config;
allow memcached_t self:process { setrlimit signal_perms };
allow memcached_t self:tcp_socket { accept listen };
allow memcached_t self:udp_socket { accept listen };
allow memcached_t self:fifo_file rw_fifo_file_perms;
allow memcached_t self:unix_stream_socket create_stream_socket_perms;

manage_dirs_pattern(memcached_t, memcached_runtime_t, memcached_runtime_t)
manage_files_pattern(memcached_t, memcached_runtime_t, memcached_runtime_t)
manage_sock_files_pattern(memcached_t, memcached_runtime_t, memcached_runtime_t)
files_runtime_filetrans(memcached_t, memcached_runtime_t, dir)

kernel_read_kernel_sysctls(memcached_t)
kernel_read_system_state(memcached_t)

corenet_all_recvfrom_netlabel(memcached_t)
corenet_tcp_sendrecv_generic_if(memcached_t)
corenet_udp_sendrecv_generic_if(memcached_t)
corenet_tcp_sendrecv_generic_node(memcached_t)
corenet_udp_sendrecv_generic_node(memcached_t)
corenet_tcp_bind_generic_node(memcached_t)
corenet_udp_bind_generic_node(memcached_t)

corenet_sendrecv_memcache_server_packets(memcached_t)
corenet_tcp_bind_memcache_port(memcached_t)
corenet_udp_bind_memcache_port(memcached_t)

dev_read_sysfs(memcached_t)

term_dontaudit_use_all_ptys(memcached_t)
term_dontaudit_use_all_ttys(memcached_t)
term_dontaudit_use_console(memcached_t)

auth_use_nsswitch(memcached_t)

miscfiles_read_localization(memcached_t)
