|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0251df |
policy_module(tor,1.2.0)
|
|
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 |
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 |
17de1b |
allow tor_t self:fifo_file { read write };
|
|
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 |
c0868a |
read_files_pattern(tor_t,tor_etc_t,tor_etc_t)
|
|
Chris PeBenito |
c0868a |
read_lnk_files_pattern(tor_t,tor_etc_t,tor_etc_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# var/lib/tor files
|
|
Chris PeBenito |
c0868a |
manage_dirs_pattern(tor_t,tor_var_lib_t,tor_var_lib_t)
|
|
Chris PeBenito |
c0868a |
manage_files_pattern(tor_t,tor_var_lib_t,tor_var_lib_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern(tor_t,tor_var_lib_t,tor_var_lib_t)
|
|
Chris PeBenito |
17de1b |
files_usr_filetrans(tor_t,tor_var_lib_t,file)
|
|
Chris PeBenito |
17de1b |
files_var_filetrans(tor_t,tor_var_lib_t,{ file dir sock_file })
|
|
Chris PeBenito |
17de1b |
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 |
c0868a |
manage_files_pattern(tor_t,tor_var_log_t,tor_var_log_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern(tor_t,tor_var_log_t,tor_var_log_t)
|
|
Chris PeBenito |
17de1b |
logging_log_filetrans(tor_t,tor_var_log_t,{ sock_file file dir })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# pid file
|
|
Chris PeBenito |
c0868a |
manage_files_pattern(tor_t,tor_var_run_t,tor_var_run_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern(tor_t,tor_var_run_t,tor_var_run_t)
|
|
Chris PeBenito |
17de1b |
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 |
17de1b |
corenet_non_ipsec_sendrecv(tor_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_if(tor_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_nodes(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 |
17de1b |
corenet_tcp_bind_all_nodes(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 |
17de1b |
libs_use_ld_so(tor_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs(tor_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization(tor_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
sysnet_dns_name_resolve(tor_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
seutil_sigchld_newrole(tor_t)
|
|
Chris PeBenito |
17de1b |
')
|