aboutsummaryrefslogtreecommitdiff
blob: fd2b6cc1e61a69ab44dad9cebebd5ede85c00556 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
## <summary>Run Windows programs in Linux.</summary>

########################################
## <summary>
##	Role access for wine.
## </summary>
## <param name="role">
##	<summary>
##	Role allowed access.
##	</summary>
## </param>
## <param name="domain">
##	<summary>
##	User domain for the role.
##	</summary>
## </param>
#
interface(`wine_role',`
	gen_require(`
		attribute_role wine_roles;
		type wine_exec_t, wine_t, wine_tmp_t;
		type wine_home_t;
	')

	roleattribute $1 wine_roles;

	domtrans_pattern($2, wine_exec_t, wine_t)

	allow wine_t $2:unix_stream_socket connectto;
	allow wine_t $2:process signull;

	ps_process_pattern($2, wine_t)
	allow $2 wine_t:process { ptrace signal_perms };

	allow $2 wine_t:fd use;
	allow $2 wine_t:shm { associate getattr };
	allow $2 wine_t:shm rw_shm_perms;
	allow $2 wine_t:unix_stream_socket connectto;

	allow $2 { wine_tmp_t wine_home_t }:dir { manage_dir_perms relabel_dir_perms };
	allow $2 { wine_tmp_t wine_home_t }:file { manage_file_perms relabel_file_perms };
	allow $2 wine_home_t:lnk_file { manage_lnk_file_perms relabel_lnk_file_perms };
	userdom_user_home_dir_filetrans($2, wine_home_t, dir, ".wine")
')

#######################################
## <summary>
##	The role template for the wine module.
## </summary>
## <desc>
##	<p>
##	This template creates a derived domains which are used
##	for wine 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(`wine_role_template',`
	gen_require(`
		type wine_exec_t;
	')

	type $1_wine_t;
	userdom_user_application_domain($1_wine_t, wine_exec_t)
	role $2 types $1_wine_t;

	allow $1_wine_t self:process { execmem execstack };

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

	domtrans_pattern($3, wine_exec_t, $1_wine_t)

	corecmd_bin_domtrans($1_wine_t, $3)

	userdom_unpriv_usertype($1, $1_wine_t)
	userdom_manage_user_tmpfs_files($1_wine_t)

	domain_mmap_low($1_wine_t)

	tunable_policy(`wine_mmap_zero_ignore',`
		dontaudit $1_wine_t self:memprotect mmap_zero;
	')

	optional_policy(`
		xserver_role($1_r, $1_wine_t)
	')
')

########################################
## <summary>
##	Execute the wine program in the wine domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
#
interface(`wine_domtrans',`
	gen_require(`
		type wine_t, wine_exec_t;
	')

	corecmd_search_bin($1)
	domtrans_pattern($1, wine_exec_t, wine_t)
')

########################################
## <summary>
##	Execute wine in the wine domain,
##	and allow the specified role
##	the wine domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	Role allowed access.
##	</summary>
## </param>
#
interface(`wine_run',`
	gen_require(`
		attribute_role wine_roles;
	')

	wine_domtrans($1)
	roleattribute $2 wine_roles;
')

########################################
## <summary>
##	Read and write wine Shared
##	memory segments.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`wine_rw_shm',`
	gen_require(`
		type wine_t;
	')

	allow $1 wine_t:shm rw_shm_perms;
')