From b55959c5909b3c32aca18f0c77eced134b38db56 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 BUG: 1287878 Change-Id: I015fe27e4c6ff36a030e3480b23141aca2d91fc2 Signed-off-by: Manikandan Selvaganesh Reviewed-on: http://review.gluster.org/12871 Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat --- 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 0db77263373..bcaef37c3b6 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