Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load plugins wich need external applications if partition is mounted with noexec flag #997

Closed
DipSwitch opened this issue Jan 24, 2015 · 4 comments

Comments

@DipSwitch
Copy link
Contributor

OpenMediaVault mounts it's NAS filesystem with the noexec flag. So if I where to install ruTorrent on in a Shared Folder this would make ruTorrent unable to load it's plugins due to the usage of test.sh

image

This could be avoided by letting /bin/sh load and execute test.sh instead of executing test.sh itself.

DipSwitch added a commit to DipSwitch/ruTorrent that referenced this issue Jan 24, 2015
@Greqs
Copy link

Greqs commented Jan 24, 2015

Try:

chmod 777 -R /var/www/rutorrent/share

If your rutorrent share folder is in above location

@DipSwitch
Copy link
Contributor Author

That doesn't work since it's not permitted to start test.sh

root@epicserver:/rutorrent/php # su www-data -c ./test.sh
sh: 1: ./test.sh: Permission denied
root@epicserver:/rutorrent/php # ./test.sh
bash: ./test.sh: Permission denied
root@epicserver:/rutorrent/php # su www-data -c 'sh ./test.sh && echo $?'
0

@DipSwitch
Copy link
Contributor Author

dipswitch@epicserver:~/dev/ruTorrent $ mount | grep md0p1
/dev/md0p1 on /media/218a6a64-a854-454b-9ce0-703f8d90b008 type ext4 (rw,noexec,relatime,user_xattr,acl,barrier=1,stripe=384,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group,_netdev)

@DipSwitch
Copy link
Contributor Author

Oke, after a fresh look I found out why the test wouldn't succeed without a double call to sh

$req = new rXMLRPCRequest(new rXMLRPCCommand("execute", array( "sh", addslash($path)."test.sh", $exe, $st, $add)));

There was not suppose to be a dot between $st and $add since they where two arguments. And since we don't want sh to execute a command via the shell interpreter we don't have to escapeshellarg the arguments... So now they log.error=... prints:

sh -c /usr/bin/id -u ; /usr/bin/id -G ; echo ~

---
Captured output:
1002
100 33 37 1001
/media/218a6a64-a854-454b-9ce0-703f8d90b008/torrents
--- Success ---

sh /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/php/test.sh php /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/share/settings/989902797  '/usr/bin/php'
--- Success ---

sh /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/php/test.sh curl /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/share/settings/1574361650  '/usr/bin/curl'
--- Success ---

sh /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/php/test.sh pgrep /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/share/settings/476520996  '/usr/bin/pgrep'
--- Success ---

sh /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/php/test.sh unzip /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/share/settings/822823404  '/usr/bin/unzip'
--- Success ---

sh /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/php/test.sh unrar /media/218a6a64-a854-454b-9ce0-703f8d90b008/rutorrent/share/settings/1324848663  '/usr/bin/unrar'
--- Success ---

The plugins load and there is no execution denial on the test.sh file although there is a noexec options on the mounted file system.

DipSwitch added a commit to DipSwitch/ruTorrent that referenced this issue Jan 27, 2015
Novik added a commit that referenced this issue Jan 29, 2015
work around for file system which is marked as noexec fixes #997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants