mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
mount_service: allow installation as a setuid program
Allow installation of the mount service helper as a setuid program so that regular users can access containerized filesystem drivers. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
This commit is contained in:
committed by
Bernd Schubert
parent
f127c2de34
commit
16b8bb980c
@@ -98,6 +98,9 @@ Security implications
|
||||
|
||||
The *fusermount3* program is installed setuid root. This is done to
|
||||
allow normal users to mount their own filesystem implementations.
|
||||
If built, the *fuservicemount3* program will also be installed setuid
|
||||
root so that normal users can access containerized filesystem
|
||||
implementations.
|
||||
|
||||
To limit the harm that malicious users can do this way, *fusermount3*
|
||||
enforces the following limitations:
|
||||
|
||||
@@ -75,11 +75,18 @@ non_sanitized_build()
|
||||
|
||||
# libfuse will first try the install path and then system defaults
|
||||
sudo chmod 4755 ${PREFIX_DIR}/bin/fusermount3
|
||||
test -x "${PREFIX_DIR}/sbin/fuservicemount3" && \
|
||||
sudo chmod 4755 ${PREFIX_DIR}/sbin/fuservicemount3
|
||||
|
||||
# also needed for some of the tests
|
||||
sudo chown root:root util/fusermount3
|
||||
sudo chmod 4755 util/fusermount3
|
||||
|
||||
if [ -x util/fuservicemount3 ]; then
|
||||
sudo chown root:root util/fuservicemount3
|
||||
sudo chmod 4755 util/fuservicemount3
|
||||
fi
|
||||
|
||||
${TEST_CMD}
|
||||
popd
|
||||
rm -fr build-${CC}
|
||||
@@ -117,11 +124,18 @@ sanitized_build()
|
||||
ninja
|
||||
sudo env PATH=$PATH ninja install
|
||||
sudo chmod 4755 ${PREFIX_DIR}/bin/fusermount3
|
||||
test -x "${PREFIX_DIR}/sbin/fuservicemount3" && \
|
||||
sudo chmod 4755 ${PREFIX_DIR}/sbin/fuservicemount3
|
||||
|
||||
# also needed for some of the tests
|
||||
sudo chown root:root util/fusermount3
|
||||
sudo chmod 4755 util/fusermount3
|
||||
|
||||
if [ -x util/fuservicemount3 ]; then
|
||||
sudo chown root:root util/fuservicemount3
|
||||
sudo chmod 4755 util/fuservicemount3
|
||||
fi
|
||||
|
||||
# Test as root and regular user
|
||||
sudo env PATH=$PATH ${TEST_CMD}
|
||||
# Cleanup temporary files (since they are now owned by root)
|
||||
|
||||
@@ -11,6 +11,7 @@ bindir="$2"
|
||||
udevrulesdir="$3"
|
||||
useroot="$4"
|
||||
initscriptdir="$5"
|
||||
sbindir="$6"
|
||||
|
||||
# Both sysconfdir and bindir are absolute paths (since they are joined
|
||||
# with --prefix in meson.build), but need to be interpreted relative
|
||||
@@ -31,6 +32,11 @@ if $useroot; then
|
||||
chown root:root "${DESTDIR}${bindir}/fusermount3"
|
||||
chmod u+s "${DESTDIR}${bindir}/fusermount3"
|
||||
|
||||
if [ -e "${DESTDIR}${sbindir}/fuservicemount3" ]; then
|
||||
chown root:root "${DESTDIR}${sbindir}/fuservicemount3"
|
||||
chmod u+s "${DESTDIR}${sbindir}/fuservicemount3"
|
||||
fi
|
||||
|
||||
if test ! -e "${DESTDIR}/dev/fuse"; then
|
||||
mkdir -p "${DESTDIR}/dev"
|
||||
mknod "${DESTDIR}/dev/fuse" -m 0666 c 10 229
|
||||
|
||||
+2
-1
@@ -47,4 +47,5 @@ meson.add_install_script('install_helper.sh',
|
||||
join_paths(get_option('prefix'), get_option('bindir')),
|
||||
udevrulesdir,
|
||||
'@0@'.format(get_option('useroot')),
|
||||
get_option('initscriptdir'))
|
||||
get_option('initscriptdir'),
|
||||
join_paths(get_option('prefix'), get_option('sbindir')))
|
||||
|
||||
Reference in New Issue
Block a user