aboutsummaryrefslogtreecommitdiff
blob: 2852f6b47bb870c4b4433c20cc0c96d6e30d0083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
policy_module(bitcoin, 0.1)

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

## <desc>
##	<p>
##	Determine whether the bitcoin daemon can bind
##	to all unreserved ports or not.
##	</p>
## </desc>
gen_tunable(bitcoin_bind_all_unreserved_ports, false)

type bitcoin_t;
type bitcoin_exec_t;
init_daemon_domain(bitcoin_t, bitcoin_exec_t)

type bitcoin_initrc_exec_t;
init_script_file(bitcoin_initrc_exec_t)

type bitcoin_etc_t;
files_config_file(bitcoin_etc_t)
init_script_readable_type(bitcoin_etc_t)

type bitcoin_log_t;
logging_log_file(bitcoin_log_t)

type bitcoin_var_lib_t;
files_type(bitcoin_var_lib_t)
init_script_readable_type(bitcoin_var_lib_t)

type bitcoin_runtime_t alias bitcoin_var_run_t;
files_runtime_file(bitcoin_runtime_t)

type bitcoin_tmp_t;
files_tmp_file(bitcoin_tmp_t)

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

allow bitcoin_t self:process signal_perms;
allow bitcoin_t self:netlink_route_socket { write getattr read bind create nlmsg_read };
allow bitcoin_t self:tcp_socket create_stream_socket_perms;

read_files_pattern(bitcoin_t, bitcoin_etc_t, bitcoin_etc_t)
read_lnk_files_pattern(bitcoin_t, bitcoin_etc_t, bitcoin_etc_t)
#list_dirs_pattern(bitcoin_t, bitcoin_etc_t, bitcoin_etc_t)

allow bitcoin_t bitcoin_tmp_t:file { create_file_perms write_file_perms };
files_tmp_filetrans(bitcoin_t, bitcoin_tmp_t, file)

allow bitcoin_t bitcoin_var_lib_t:lnk_file read_lnk_file_perms;
manage_files_pattern(bitcoin_t, bitcoin_var_lib_t, bitcoin_var_lib_t)
manage_dirs_pattern(bitcoin_t, bitcoin_var_lib_t, bitcoin_var_lib_t)

kernel_read_system_state(bitcoin_t)
kernel_read_vm_sysctls(bitcoin_t)

corenet_all_recvfrom_netlabel(bitcoin_t)
corenet_all_recvfrom_unlabeled(bitcoin_t)

corenet_sendrecv_bitcoin_server_packets(bitcoin_t)
# TODO why bind and connect simultaneously? If needed, perhaps also bitcoin_client_packets
corenet_tcp_bind_bitcoin_port(bitcoin_t)
corenet_tcp_connect_bitcoin_port(bitcoin_t)
corenet_tcp_connect_http_port(bitcoin_t)
corenet_tcp_bind_generic_node(bitcoin_t)
corenet_tcp_sendrecv_generic_if(bitcoin_t)
corenet_tcp_sendrecv_generic_node(bitcoin_t)
#corenet_sendrecv_dns_server_packets(bitcoin_t)
#corenet_udp_bind_dns_port(bitcoin_t)

dev_read_sysfs(bitcoin_t)
dev_read_urand(bitcoin_t)

domain_use_interactive_fds(bitcoin_t)

files_read_etc_runtime_files(bitcoin_t)
files_read_usr_files(bitcoin_t)

fs_getattr_xattr_fs(bitcoin_t)
#fs_associate(bitcoin_var_lib_t)

auth_use_nsswitch(bitcoin_t)

miscfiles_read_localization(bitcoin_t)

userdom_use_user_terminals(bitcoin_t)

tunable_policy(`bitcoin_bind_all_unreserved_ports',`
        corenet_tcp_bind_all_unreserved_ports(bitcoin_t)
')