Commit | Line | Data |
---|---|---|
8de51304 H |
1 | <?php |
2 | /* | |
3 | Harvie 2oo9 - http://blog.harvie.cz/ | |
4 | ||
5 | This simple script allows you to encrypt you webpages/etc. | |
6 | using EncFS (you need to have EncFS installed of course). | |
7 | ||
8 | You need write permissions to mountpoint for www server | |
9 | and maybe add www server's user to the fuse group: | |
10 | ||
11 | gpasswd fuse -a www-data | |
12 | or | |
13 | gpasswd fuse -a http | |
14 | ||
15 | If you want this script to mount EncFS to be accessible by | |
16 | other users, you can add user_allow_other to /etc/fuse.conf | |
17 | */ | |
18 | ||
19 | if(trim($_SERVER['HTTPS']) == '') { | |
20 | die('<h1>Error: Cannot use EncFS without TLS!</h1>Use https:// instead of http://'); | |
21 | } | |
22 | ||
23 | function encfs_mount($what, $where, $password, $arguments='') { | |
24 | system('/bin/echo '.escapeshellarg($password).' | /usr/bin/encfs -S '.escapeshellarg($what).' '.escapeshellarg($where)." $arguments".' 2>&1'); | |
25 | flush(); | |
26 | } | |
27 | ||
28 | function encfs_unmount($where) { | |
29 | system('/usr/bin/fusermount -zu '.escapeshellarg($where).' 2>&1'); | |
30 | flush(); | |
31 | } | |
32 |