aboutsummaryrefslogtreecommitdiff
blob: 25b702dbb019d8825c1fbd61f39943c1a5dac3e3 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
## <summary>X Window Managers.</summary>

#######################################
## <summary>
##	The role template for the wm module.
## </summary>
## <desc>
##	<p>
##	This template creates a derived domains which are used
##	for window manager applications.
##	</p>
## </desc>
## <param name="role_prefix">
##	<summary>
##	The prefix of the user domain (e.g., user
##	is the prefix for user_t).
##	</summary>
## </param>
## <param name="user_role">
##	<summary>
##	The role associated with the user domain.
##	</summary>
## </param>
## <param name="user_domain">
##	<summary>
##	The type of the user domain.
##	</summary>
## </param>
#
template(`wm_role_template',`
	gen_require(`
		attribute wm_domain;
		type wm_exec_t;
	')

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

	type $1_wm_t, wm_domain;
	userdom_user_application_domain($1_wm_t, wm_exec_t)
	role $2 types $1_wm_t;

	########################################
	#
	# Policy
	#

	allow $1_wm_t $3:unix_stream_socket connectto;
	allow $3 $1_wm_t:unix_stream_socket connectto;

	allow $3 $1_wm_t:process { ptrace signal_perms };
	ps_process_pattern($3, $1_wm_t)

	allow $1_wm_t $3:process { signull sigkill };

	domtrans_pattern($3, wm_exec_t, $1_wm_t)

	corecmd_bin_domtrans($1_wm_t, $3)
	corecmd_shell_domtrans($1_wm_t, $3)

	mls_file_read_all_levels($1_wm_t)
	mls_file_write_all_levels($1_wm_t)
	mls_xwin_read_all_levels($1_wm_t)
	mls_xwin_write_all_levels($1_wm_t)
	mls_fd_use_all_levels($1_wm_t)

	auth_use_nsswitch($1_wm_t)

	optional_policy(`
		dbus_spec_session_bus_client($1, $1_wm_t)
		dbus_system_bus_client($1_wm_t)

		optional_policy(`
			wm_dbus_chat($1, $3)
		')
	')

	optional_policy(`
		pulseaudio_run($1_wm_t, $2)
	')

	optional_policy(`
		xserver_role($2, $1_wm_t)
		xserver_manage_core_devices($1_wm_t)
	')
')

########################################
## <summary>
##	Execute wm in the caller domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`wm_exec',`
	gen_require(`
		type wm_exec_t;
	')

	corecmd_search_bin($1)
	can_exec($1, wm_exec_t)
')

########################################
## <summary>
##	Send and receive messages from
##	specified wm over dbus.
## </summary>
## <param name="role_prefix">
##	<summary>
##	The prefix of the user domain (e.g., user
##	is the prefix for user_t).
##	</summary>
## </param>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`wm_dbus_chat',`
	gen_require(`
		type $1_wm_t;
		class dbus send_msg;
	')

	allow $2 $1_wm_t:dbus send_msg;
	allow $1_wm_t $2:dbus send_msg;
')