147 lines
4.2 KiB
Text
147 lines
4.2 KiB
Text
|
policy_module(varnishd, 1.2.0)
|
||
|
|
||
|
########################################
|
||
|
#
|
||
|
# Declarations
|
||
|
#
|
||
|
|
||
|
## <desc>
|
||
|
## <p>
|
||
|
## Determine whether varnishd can
|
||
|
## use the full TCP network.
|
||
|
## </p>
|
||
|
## </desc>
|
||
|
gen_tunable(varnishd_connect_any, false)
|
||
|
|
||
|
type varnishd_t;
|
||
|
type varnishd_exec_t;
|
||
|
init_daemon_domain(varnishd_t, varnishd_exec_t)
|
||
|
|
||
|
type varnishd_initrc_exec_t;
|
||
|
init_script_file(varnishd_initrc_exec_t)
|
||
|
|
||
|
type varnishd_etc_t;
|
||
|
files_config_file(varnishd_etc_t)
|
||
|
|
||
|
type varnishd_tmp_t;
|
||
|
files_tmp_file(varnishd_tmp_t)
|
||
|
|
||
|
type varnishd_var_lib_t;
|
||
|
files_type(varnishd_var_lib_t)
|
||
|
|
||
|
type varnishd_var_run_t;
|
||
|
files_pid_file(varnishd_var_run_t)
|
||
|
|
||
|
type varnishlog_t;
|
||
|
type varnishlog_exec_t;
|
||
|
init_daemon_domain(varnishlog_t, varnishlog_exec_t)
|
||
|
|
||
|
type varnishlog_initrc_exec_t;
|
||
|
init_script_file(varnishlog_initrc_exec_t)
|
||
|
|
||
|
type varnishlog_var_run_t;
|
||
|
files_pid_file(varnishlog_var_run_t)
|
||
|
|
||
|
type varnishlog_log_t;
|
||
|
logging_log_file(varnishlog_log_t)
|
||
|
|
||
|
########################################
|
||
|
#
|
||
|
# Local policy
|
||
|
#
|
||
|
|
||
|
allow varnishd_t self:capability { kill dac_read_search dac_override ipc_lock setuid setgid chown fowner fsetid };
|
||
|
dontaudit varnishd_t self:capability sys_tty_config;
|
||
|
allow varnishd_t self:process { execmem signal };
|
||
|
allow varnishd_t self:fifo_file rw_fifo_file_perms;
|
||
|
allow varnishd_t self:tcp_socket { accept listen };
|
||
|
|
||
|
allow varnishd_t varnishd_etc_t:dir list_dir_perms;
|
||
|
allow varnishd_t varnishd_etc_t:file read_file_perms;
|
||
|
allow varnishd_t varnishd_etc_t:lnk_file read_lnk_file_perms;
|
||
|
|
||
|
manage_dirs_pattern(varnishd_t, varnishd_tmp_t, varnishd_tmp_t)
|
||
|
manage_files_pattern(varnishd_t, varnishd_tmp_t, varnishd_tmp_t)
|
||
|
files_tmp_filetrans(varnishd_t, varnishd_tmp_t, { file dir })
|
||
|
allow varnishd_t varnishd_tmp_t:file map;
|
||
|
|
||
|
manage_dirs_pattern(varnishd_t, varnishd_var_lib_t, varnishd_var_lib_t)
|
||
|
manage_files_pattern(varnishd_t, varnishd_var_lib_t, varnishd_var_lib_t)
|
||
|
files_var_lib_filetrans(varnishd_t, varnishd_var_lib_t, { dir file })
|
||
|
|
||
|
manage_files_pattern(varnishd_t, varnishd_var_run_t, varnishd_var_run_t)
|
||
|
files_pid_filetrans(varnishd_t, varnishd_var_run_t, file)
|
||
|
|
||
|
can_exec(varnishd_t, varnishd_var_lib_t)
|
||
|
|
||
|
kernel_read_system_state(varnishd_t)
|
||
|
|
||
|
corecmd_exec_bin(varnishd_t)
|
||
|
corecmd_exec_shell(varnishd_t)
|
||
|
|
||
|
corenet_all_recvfrom_unlabeled(varnishd_t)
|
||
|
corenet_all_recvfrom_netlabel(varnishd_t)
|
||
|
corenet_tcp_sendrecv_generic_if(varnishd_t)
|
||
|
corenet_tcp_sendrecv_generic_node(varnishd_t)
|
||
|
corenet_tcp_sendrecv_all_ports(varnishd_t)
|
||
|
corenet_tcp_bind_generic_node(varnishd_t)
|
||
|
|
||
|
corenet_sendrecv_http_server_packets(varnishd_t)
|
||
|
corenet_tcp_bind_http_port(varnishd_t)
|
||
|
corenet_sendrecv_http_client_packets(varnishd_t)
|
||
|
corenet_tcp_connect_http_port(varnishd_t)
|
||
|
corenet_tcp_sendrecv_http_port(varnishd_t)
|
||
|
|
||
|
corenet_sendrecv_http_cache_server_packets(varnishd_t)
|
||
|
corenet_tcp_bind_http_cache_port(varnishd_t)
|
||
|
corenet_sendrecv_http_cache_client_packets(varnishd_t)
|
||
|
corenet_tcp_connect_http_cache_port(varnishd_t)
|
||
|
corenet_tcp_sendrecv_http_cache_port(varnishd_t)
|
||
|
|
||
|
corenet_sendrecv_varnishd_server_packets(varnishd_t)
|
||
|
corenet_tcp_bind_varnishd_port(varnishd_t)
|
||
|
corenet_tcp_sendrecv_varnishd_port(varnishd_t)
|
||
|
|
||
|
dev_read_urand(varnishd_t)
|
||
|
dev_read_sysfs(varnishd_t)
|
||
|
|
||
|
fs_getattr_all_fs(varnishd_t)
|
||
|
|
||
|
auth_use_nsswitch(varnishd_t)
|
||
|
|
||
|
logging_send_syslog_msg(varnishd_t)
|
||
|
|
||
|
sysnet_read_config(varnishd_t)
|
||
|
|
||
|
tunable_policy(`varnishd_connect_any',`
|
||
|
corenet_sendrecv_all_client_packets(varnishd_t)
|
||
|
corenet_tcp_connect_all_ports(varnishd_t)
|
||
|
corenet_sendrecv_all_server_packets(varnishd_t)
|
||
|
corenet_tcp_bind_all_ports(varnishd_t)
|
||
|
corenet_tcp_sendrecv_all_ports(varnishd_t)
|
||
|
')
|
||
|
|
||
|
optional_policy(`
|
||
|
dbus_system_bus_client(varnishd_t)
|
||
|
dbus_connect_system_bus(varnishd_t)
|
||
|
')
|
||
|
|
||
|
#######################################
|
||
|
#
|
||
|
# Log local policy
|
||
|
#
|
||
|
|
||
|
allow varnishlog_t self:process { execmem };
|
||
|
|
||
|
manage_files_pattern(varnishlog_t, varnishlog_var_run_t, varnishlog_var_run_t)
|
||
|
files_pid_filetrans(varnishlog_t, varnishlog_var_run_t, file)
|
||
|
|
||
|
manage_dirs_pattern(varnishlog_t, varnishlog_log_t, varnishlog_log_t)
|
||
|
append_files_pattern(varnishlog_t, varnishlog_log_t, varnishlog_log_t)
|
||
|
create_files_pattern(varnishlog_t, varnishlog_log_t, varnishlog_log_t)
|
||
|
setattr_files_pattern(varnishlog_t, varnishlog_log_t, varnishlog_log_t)
|
||
|
logging_log_filetrans(varnishlog_t, varnishlog_log_t, { file dir })
|
||
|
|
||
|
varnishd_read_config(varnishlog_t)
|
||
|
varnishd_read_lib_files(varnishlog_t)
|