diff --git a/README.md b/README.md index 6cf23cd8..92b85522 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/test/ci-build.sh b/test/ci-build.sh index 799f13b2..91ac44d5 100755 --- a/test/ci-build.sh +++ b/test/ci-build.sh @@ -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) diff --git a/util/install_helper.sh b/util/install_helper.sh index 76f2b47f..4c6f9dc3 100755 --- a/util/install_helper.sh +++ b/util/install_helper.sh @@ -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 diff --git a/util/meson.build b/util/meson.build index a77775c3..db18aed8 100644 --- a/util/meson.build +++ b/util/meson.build @@ -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')))