diff --git a/core/src/plugins/meta.mount/class.FilesystemMounter.php b/core/src/plugins/meta.mount/class.FilesystemMounter.php index fa261ed096..1bc7d8af30 100755 --- a/core/src/plugins/meta.mount/class.FilesystemMounter.php +++ b/core/src/plugins/meta.mount/class.FilesystemMounter.php @@ -122,6 +122,12 @@ public function mountFS() $this->logDebug("FSMounter::mountFS Should mount" . $user); $repo = $this->repository; + if(isset($this->options["MOUNT_DEVIL"]) && !empty($this->options["MOUNT_DEVIL"]) && $this->options["MOUNT_DEVIL"]) { + $udevil = "udevil "; + }else{ + $udevil = ""; + } + $MOUNT_TYPE = $this->options["FILESYSTEM_TYPE"]; $MOUNT_POINT = $this->getOption("MOUNT_POINT", $user, $password); $MOUNT_POINT_ROOT = $this->getOption("MOUNT_POINT", "", ""); @@ -144,7 +150,7 @@ public function mountFS() $UNC_PATH = $this->getOption("UNC_PATH", $user, $password, false); $MOUNT_OPTIONS = $this->getOption("MOUNT_OPTIONS", $user, $password, false); - $cmd = "mount -t " .$MOUNT_TYPE. (empty( $MOUNT_OPTIONS )? " " : " -o " .escapeshellarg($MOUNT_OPTIONS). " " ) .escapeshellarg($UNC_PATH). " " .escapeshellarg($MOUNT_POINT); + $cmd = $udevil."mount -t " .$MOUNT_TYPE. (empty( $MOUNT_OPTIONS )? " " : " -o " .escapeshellarg($MOUNT_OPTIONS). " " ) .escapeshellarg($UNC_PATH). " " .escapeshellarg($MOUNT_POINT); $res = null; if($this->getOption("MOUNT_ENV_PASSWD") == true){ putenv("PASSWD=$password"); @@ -183,7 +189,12 @@ public function umountFS() list($user, $password) = $this->getCredentials(); $MOUNT_POINT = $this->getOption("MOUNT_POINT", $user, $password); - system("umount ".escapeshellarg($MOUNT_POINT), $res); + if(isset($this->options["MOUNT_DEVIL"]) && !empty($this->options["MOUNT_DEVIL"]) && $this->options["MOUNT_DEVIL"]) { + $udevil = "udevil "; + }else{ + $udevil = ""; + } + system($udevil."umount ".escapeshellarg($MOUNT_POINT), $res); if($this->getOption("REMOVE_MOUNTPOINT_ON_UNMOUNT") == true && $res == 0 && !$this->isAlreadyMounted() ){ // Remove mount point $testRm = @rmdir($MOUNT_POINT); diff --git a/core/src/plugins/meta.mount/manifest.xml b/core/src/plugins/meta.mount/manifest.xml index ebae769857..1f6e1f9a25 100644 --- a/core/src/plugins/meta.mount/manifest.xml +++ b/core/src/plugins/meta.mount/manifest.xml @@ -1,33 +1,34 @@ + xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd" mixins="credentials_consumer"> - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/core/src/plugins/meta.mount/metamount_udevil.png b/core/src/plugins/meta.mount/metamount_udevil.png new file mode 100755 index 0000000000..f0679a8487 Binary files /dev/null and b/core/src/plugins/meta.mount/metamount_udevil.png differ diff --git a/core/src/plugins/meta.mount/plugin_doc.html b/core/src/plugins/meta.mount/plugin_doc.html index ec865dc669..8b6cca2a61 100644 --- a/core/src/plugins/meta.mount/plugin_doc.html +++ b/core/src/plugins/meta.mount/plugin_doc.html @@ -1,9 +1,38 @@

Linux Only : Generic purpose meta plugin that is triggered before the repository is opened, and can be configured to mount any filesystem and unmount it when the user either switch to another repository or logs out.

-

- If you have permissions issues, you can use the "sudo" parameter to sudo all system operations. - In that case, make sure to set the sudoers permission accordingly: apache user (www-data or httpd generaly) must be allowed to - perform a mount operation using sudo. -

-

- To strengthen the security, use the parameter to pass password via the system environment and not via the command line itself. Sudo file must also be adapted to be allowed for that ( something like defaults@pydio-*-app* env_keep += "PASSWD"). -

\ No newline at end of file +

+ Update: version 6.2.1 +
Due to security reason, we removed 'sudo' parameter on version 6.2.0 and use 'udevil' as an alternative. udevil is a command line program which mounts and unmounts removable devices without requirement of 'sudo'. + For more information: https://ignorantguru.github.io/udevil/ +
+
Installation +
+ Debian 8 / Ubuntu 14: +
sudo apt-get install udevil +
+
CentOS/RedHat: +
Can use self-extracting installer: bash udevil-x.x.x-installer.sh See: https://ignorantguru.github.io/udevil/ +
+
+ After installation, you can configure udevil in /etc/udevil/udevil.conf to allow mount points and protocols +
Testing by using command to mount in terminal +
udevil mount smb://pydio@192.168.0.3/share /media/test/abc +
then: +
udevil umount smb://pydio@192.168.0.3/share /media/test/abc +
Note: Make sure that the permission of mount point should be owned by apache when you test from Pydio. +
Warning: Passing password via system evr PASSWD is not supported in 'udevil'. +

+
+Configuration to mount samba with udevil +
+
+

+ Version 6.0.8 +

+

+ If you have permissions issues, you can use the "sudo" parameter to sudo all system operations. + In that case, make sure to set the sudoers permission accordingly: apache user (www-data or httpd generaly) must be allowed to + perform a mount operation using sudo. +

+

+ To strengthen the security, use the parameter to pass password via the system environment and not via the command line itself. Sudo file must also be adapted to be allowed for that ( something like defaults@pydio-*-app* env_keep += "PASSWD"). +

\ No newline at end of file