|
Chris PeBenito |
29af4c |
policy_module(tor, 1.7.0)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
25d81d |
## <desc>
|
|
Chris PeBenito |
25d81d |
##
|
|
Chris PeBenito |
25d81d |
## Allow tor daemon to bind
|
|
Chris PeBenito |
25d81d |
## tcp sockets to all unreserved ports.
|
|
Chris PeBenito |
25d81d |
##
|
|
Chris PeBenito |
25d81d |
## </desc>
|
|
Chris PeBenito |
25d81d |
gen_tunable(tor_bind_all_unreserved_ports, false)
|
|
Chris PeBenito |
25d81d |
|
|
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 |
339235 |
allow tor_t self:capability { setgid setuid sys_tty_config };
|
|
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 |
25d81d |
files_read_usr_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 |
25d81d |
tunable_policy(`tor_bind_all_unreserved_ports', `
|
|
Chris PeBenito |
25d81d |
corenet_tcp_bind_all_unreserved_ports(tor_t)
|
|
Chris PeBenito |
25d81d |
')
|
|
Chris PeBenito |
25d81d |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
seutil_sigchld_newrole(tor_t)
|
|
Chris PeBenito |
17de1b |
')
|