aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-security/refpolicy/refpolicy-2.20140311/poky-policy-fix-nfsd_t-to-mount_nfsd_fs_t.patch
blob: f04ebec8c051936925a6b783f313d23c8e3c8a4d (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
From 054a2d81a42bc127d29a916c64b43ad5a7c97f21 Mon Sep 17 00:00:00 2001
From: Xin Ouyang <Xin.Ouyang@windriver.com>
Date: Fri, 23 Aug 2013 12:01:53 +0800
Subject: [PATCH] fix policy for nfsserver to mount nfsd_fs_t.

Upstream-Status: Pending

Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
---
 policy/modules/contrib/rpc.te       |    5 +++++
 policy/modules/contrib/rpcbind.te   |    5 +++++
 policy/modules/kernel/filesystem.te |    1 +
 policy/modules/kernel/kernel.te     |    2 ++
 4 files changed, 13 insertions(+)

--- a/policy/modules/contrib/rpc.te
+++ b/policy/modules/contrib/rpc.te
@@ -263,6 +263,11 @@ tunable_policy(`nfs_export_all_ro',`
 
 optional_policy(`
 	mount_exec(nfsd_t)
+	# Should domtrans to mount_t while mounting nfsd_fs_t.
+	mount_domtrans(nfsd_t)
+	# nfsd_t need to chdir to /var/lib/nfs and read files.
+	files_list_var(nfsd_t)
+	rpc_read_nfs_state_data(nfsd_t)
 ')
 
 ########################################
--- a/policy/modules/contrib/rpcbind.te
+++ b/policy/modules/contrib/rpcbind.te
@@ -70,6 +70,11 @@ logging_send_syslog_msg(rpcbind_t)
 
 miscfiles_read_localization(rpcbind_t)
 
+# nfsd_t would not be allowed to send unix_stream_socket to rpcbind_t,
+# because the are running in different level. So add rules to allow this.
+mls_socket_read_all_levels(rpcbind_t)
+mls_socket_write_all_levels(rpcbind_t)
+
 ifdef(`distro_debian',`
 	term_dontaudit_use_unallocated_ttys(rpcbind_t)
 ')
--- a/policy/modules/kernel/filesystem.te
+++ b/policy/modules/kernel/filesystem.te
@@ -119,6 +119,7 @@ genfscon mvfs / gen_context(system_u:obj
 
 type nfsd_fs_t;
 fs_type(nfsd_fs_t)
+files_mountpoint(nfsd_fs_t)
 genfscon nfsd / gen_context(system_u:object_r:nfsd_fs_t,s0)
 
 type oprofilefs_t;
--- a/policy/modules/kernel/kernel.te
+++ b/policy/modules/kernel/kernel.te
@@ -293,6 +293,8 @@ mls_process_read_up(kernel_t)
 mls_process_write_down(kernel_t)
 mls_file_write_all_levels(kernel_t)
 mls_file_read_all_levels(kernel_t)
+mls_socket_write_all_levels(kernel_t)
+mls_fd_use_all_levels(kernel_t)
 
 ifdef(`distro_redhat',`
 	# Bugzilla 222337