Chris PeBenito 17de1b
Chris PeBenito c12621
policy_module(tor, 1.5.2)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type tor_t;
Chris PeBenito 17de1b
type tor_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(tor_t, tor_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# etc/tor
Chris PeBenito 17de1b
type tor_etc_t;
Chris PeBenito 17de1b
files_config_file(tor_etc_t)
Chris PeBenito 17de1b
Chris PeBenito e87221
type tor_initrc_exec_t;
Chris PeBenito e87221
init_script_file(tor_initrc_exec_t)
Chris PeBenito e87221
Chris PeBenito 17de1b
# var/lib/tor
Chris PeBenito 17de1b
type tor_var_lib_t;
Chris PeBenito 17de1b
files_type(tor_var_lib_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito 17de1b
type tor_var_log_t;
Chris PeBenito 17de1b
logging_log_file(tor_var_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid files
Chris PeBenito 17de1b
type tor_var_run_t;
Chris PeBenito 17de1b
files_pid_file(tor_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# tor local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito e87221
allow tor_t self:capability { setgid setuid };
Chris PeBenito 0b36a2
allow tor_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow tor_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow tor_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
allow tor_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# configuration files
Chris PeBenito c0868a
allow tor_t tor_etc_t:dir list_dir_perms;
Chris PeBenito 0bfccd
read_files_pattern(tor_t, tor_etc_t, tor_etc_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(tor_t, tor_etc_t, tor_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# var/lib/tor files
Chris PeBenito 0bfccd
manage_dirs_pattern(tor_t, tor_var_lib_t, tor_var_lib_t)
Chris PeBenito 0bfccd
manage_files_pattern(tor_t, tor_var_lib_t, tor_var_lib_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(tor_t, tor_var_lib_t, tor_var_lib_t)
Chris PeBenito 0bfccd
files_usr_filetrans(tor_t, tor_var_lib_t, file)
Chris PeBenito 0bfccd
files_var_filetrans(tor_t, tor_var_lib_t, { file dir sock_file })
Chris PeBenito 0bfccd
files_var_lib_filetrans(tor_t, tor_var_lib_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# log files
Chris PeBenito c0868a
allow tor_t tor_var_log_t:dir setattr;
Chris PeBenito 0bfccd
manage_files_pattern(tor_t, tor_var_log_t, tor_var_log_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(tor_t, tor_var_log_t, tor_var_log_t)
Chris PeBenito 0bfccd
logging_log_filetrans(tor_t, tor_var_log_t, { sock_file file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# pid file
Chris PeBenito 0bfccd
manage_files_pattern(tor_t, tor_var_run_t, tor_var_run_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(tor_t, tor_var_run_t, tor_var_run_t)
Chris PeBenito 0bfccd
files_pid_filetrans(tor_t, tor_var_run_t, { file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 13d7ce
kernel_read_system_state(tor_t)
Chris PeBenito 13d7ce
Chris PeBenito 17de1b
# networking basics
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(tor_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(tor_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(tor_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(tor_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(tor_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_reserved_ports(tor_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(tor_t)
Chris PeBenito 17de1b
corenet_tcp_bind_tor_port(tor_t)
Chris PeBenito 17de1b
corenet_sendrecv_tor_server_packets(tor_t)
Chris PeBenito 17de1b
# TOR will need to connect to various ports
Chris PeBenito 17de1b
corenet_tcp_connect_all_ports(tor_t)
Chris PeBenito 17de1b
corenet_sendrecv_all_client_packets(tor_t)
Chris PeBenito 17de1b
# ... especially including port 80 and other privileged ports
Chris PeBenito 17de1b
corenet_tcp_connect_all_reserved_ports(tor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# tor uses crypto and needs random
Chris PeBenito 17de1b
dev_read_urand(tor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(tor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(tor_t)
Chris PeBenito 13d7ce
files_read_etc_runtime_files(tor_t)
Chris PeBenito 13d7ce
Chris PeBenito e87221
auth_use_nsswitch(tor_t)
Chris PeBenito e87221
Chris PeBenito 17de1b
miscfiles_read_localization(tor_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(tor_t)
Chris PeBenito 17de1b
')