From 21b32ba1430e4a0e664423a4a7bf038a2da428bc Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 2 Dec 2015 21:19:56 +0100 Subject: fuse: pass default SElinux mount options on to the kernel In order to set default SElinux contexts on a Gluster mount, the standard SElinux mount options need to be passed to the kernel. The mount(8) manual page lists "context", "fscontext", "defcontext" and "rootcontext" as valid options. Backport of http://review.gluster.org/#/c/12858/ Cherry-picked from commit 5e81233f0a3c153e03c437a164ac2ca21314bdec > BUG: 1287763 > Change-Id: I015fe27e4c6ff36a030e3480b23141aca2d91fc2 > Signed-off-by: Niels de Vos > Reviewed-on: http://review.gluster.org/12858 > Tested-by: NetBSD Build System > Tested-by: Gluster Build System > Reviewed-by: Humble Devassy Chirammal > Reviewed-by: Manikandan Selvaganesh > Signed-off-by: Manikandan Selvaganesh BUG: 1287877 Change-Id: I015fe27e4c6ff36a030e3480b23141aca2d91fc2 Signed-off-by: Manikandan Selvaganesh Reviewed-on: http://review.gluster.org/12870 Reviewed-by: Niels de Vos Tested-by: NetBSD Build System Tested-by: Gluster Build System --- xlators/mount/fuse/utils/mount.glusterfs.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 112dc0a225b..ae3a075f9a8 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -467,6 +467,11 @@ with_options() [ $value = "false" ] ; then no_root_squash=1; fi ;; + "context"|"fscontext"|"defcontext"|"rootcontext") + # standard SElinux mount options to pass to the kernel + [ -z "$fuse_mountopts" ] || fuse_mountopts="$fuse_mountopts," + fuse_mountopts="${fuse_mountopts}$key=\"$value\"" + ;; *) warn "Invalid option: $key" exit 1 -- cgit