aboutsummaryrefslogtreecommitdiff
blob: 34fad1c57b7d246194b5d7dc8d9441ac991acebf (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
policy_module(rtorrent, 1.0.0)

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

## <desc>
## <p>
## Allow rtorrent to use dht.
## The correspondig port must be rtorrent_udp_port_t.
## </p>
## </desc>
gen_tunable(rtorrent_use_dht, true)

## <desc>
## <p>
## Allow rtorrent to use rsync, for example in a hook.
## </p>
## </desc>
gen_tunable(rtorrent_use_rsync, false)


type rtorrent_t;
type rtorrent_exec_t;
userdom_user_application_domain(rtorrent_t, rtorrent_exec_t)

type rtorrent_home_t;
userdom_user_home_content(rtorrent_home_t)

type rtorrent_session_t;
userdom_user_home_content(rtorrent_session_t)

########################################
#
# rtorrent local policy
#

allow rtorrent_t self:process signal;
allow rtorrent_t self:netlink_route_socket r_netlink_socket_perms;
allow rtorrent_t self:tcp_socket create_stream_socket_perms;

read_files_pattern(rtorrent_t, rtorrent_home_t, rtorrent_home_t)

manage_dirs_pattern(rtorrent_t, rtorrent_session_t, rtorrent_session_t)
manage_files_pattern(rtorrent_t, rtorrent_session_t, rtorrent_session_t)
allow rtorrent_t rtorrent_session_t:file map;

corenet_tcp_bind_generic_node(rtorrent_t)
corenet_tcp_bind_rtorrent_port(rtorrent_t)
corenet_tcp_connect_all_ports(rtorrent_t)

domain_use_interactive_fds(rtorrent_t)

files_list_home(rtorrent_t)
files_list_tmp(rtorrent_t)
files_list_var(rtorrent_t)
files_read_etc_files(rtorrent_t)

fs_getattr_xattr_fs(rtorrent_t)

kernel_read_system_state(rtorrent_t)

miscfiles_read_generic_certs(rtorrent_t)
miscfiles_read_localization(rtorrent_t)

sysnet_read_config(rtorrent_t)

userdom_list_user_home_dirs(rtorrent_t)
userdom_use_user_ptys(rtorrent_t)

tunable_policy(`rtorrent_use_dht',`
	allow rtorrent_t self:udp_socket create_stream_socket_perms;

	corenet_udp_bind_generic_node(rtorrent_t)
	corenet_udp_bind_rtorrent_port(rtorrent_t)
')

tunable_policy(`rtorrent_use_rsync',`
	allow rtorrent_t self:unix_stream_socket { create connect write read };

	corecmd_exec_bin(rtorrent_t)
	corecmd_exec_shell(rtorrent_t)

	corenet_sendrecv_rsync_client_packets(rtorrent_t)
	corenet_tcp_connect_rsync_port(rtorrent_t)

	rsync_exec(rtorrent_t)
')

optional_policy(`
	xdg_manage_downloads_home(rtorrent_t)
')