YunoHost-Apps / wallabag2_ynh

Wallabag v2 package for YunoHost
https://www.wallabag.org/
GNU Affero General Public License v3.0
62 stars 14 forks source link

Access denied to assets #31

Closed nicofrand closed 7 years ago

nicofrand commented 7 years ago

I just installed the app and the first page I am redirected to is the quickstart page. The text is displayed but all the assets (JS, CSS, images, etc.) are not.

When I check the logs I have several errors about Permission denied:

2017/04/22 13:50:41 [crit] 4361#0: *476 stat() "/var/www/wallabag2/web/js/routing" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /js/routing?callback=fos.Router.setData HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:41 [crit] 4361#0: *477 stat() "/var/www/wallabag2/web/bundles/wallabagcore/themes/material/js/material.min.js" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /bundles/wallabagcore/themes/material/js/material.min.js HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:41 [crit] 4361#0: *475 stat() "/var/www/wallabag2/web/ynhpanel.js" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /ynhpanel.js HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:42 [crit] 4361#0: *478 stat() "/var/www/wallabag2/web/bundles/wallabagcore/themes/_global/img/logo-square.png" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /bundles/wallabagcore/themes/_global/img/logo-square.png HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:42 [crit] 4361#0: *476 stat() "/var/www/wallabag2/web/bundles/wallabagcore/themes/material/js/material.min.js" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /bundles/wallabagcore/themes/material/js/material.min.js HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:42 [crit] 4361#0: *478 stat() "/var/www/wallabag2/web/ynhpanel.js" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /ynhpanel.js HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"
2017/04/22 13:50:43 [crit] 4361#0: *476 stat() "/var/www/wallabag2/web/bundles/wallabagcore/themes/_global/img/logo-square.png" failed (13: Permission denied), client: 109.8.157.161, server: wb.nicofrand.eu, request: "GET /bundles/wallabagcore/themes/_global/img/logo-square.png HTTP/1.1", host: "wb.nicofrand.eu", referrer: "https://wb.nicofrand.eu/quickstart"

Here are the permissions on the top directory (and it is always the same user and group everywhere I check):

root@nicofrand:/var/www/wallabag2# ls -l
total 408
drwxr-xr-x  5 wallabag2 wallabag2   4096 Apr 22 13:48 app
drwxr-xr-x  2 wallabag2 wallabag2   4096 Apr 22 13:48 bin
-rw-r--r--  1 wallabag2 wallabag2   6561 Mar  2 15:30 build.xml
-rw-r--r--  1 wallabag2 wallabag2    468 Mar  2 15:30 Capfile
-rw-r--r--  1 wallabag2 wallabag2  59344 Mar  2 15:30 CHANGELOG.md
-rw-r--r--  1 wallabag2 wallabag2   4745 Mar  2 15:30 composer.json
-rw-r--r--  1 wallabag2 wallabag2 241053 Mar  2 15:32 composer.lock
-rw-r--r--  1 wallabag2 wallabag2   1066 Mar  2 15:30 COPYING.md
-rw-r--r--  1 wallabag2 wallabag2    282 Mar  2 15:30 CREDITS.md
drwxr-xr-x  4 wallabag2 wallabag2   4096 Apr 22 13:48 data
drwxr-xr-x  6 wallabag2 wallabag2   4096 Apr 22 13:48 docker
-rw-r--r--  1 wallabag2 wallabag2   1543 Mar  2 15:30 docker-compose.yml
drwxr-xr-x  7 wallabag2 wallabag2   4096 Apr 22 13:48 docs
-rw-r--r--  1 wallabag2 wallabag2    160 Mar  2 15:30 Gemfile
-rw-r--r--  1 wallabag2 wallabag2    777 Mar  2 15:30 Gemfile.lock
-rw-r--r--  1 wallabag2 wallabag2   6434 Mar  2 15:30 Gruntfile.js
-rwxr-xr-x  1 wallabag2 wallabag2   1157 Mar  2 15:30 Makefile
-rw-r--r--  1 wallabag2 wallabag2   2853 Mar  2 15:30 package.json
-rw-r--r--  1 wallabag2 wallabag2   1029 Mar  2 15:30 phpunit.xml.dist
-rw-r--r--  1 wallabag2 wallabag2   1465 Mar  2 15:30 README.md
-rw-r--r--  1 wallabag2 wallabag2   3228 Mar  2 15:30 RELEASE_PROCESS.md
drwxr-xr-x  2 wallabag2 wallabag2   4096 Apr 22 13:48 scripts
drwxr-xr-x  3 wallabag2 wallabag2   4096 Apr 22 13:48 src
drwxr-xr-x  3 wallabag2 wallabag2   4096 Apr 22 13:48 tests
drwxr-xr-x  5 wallabag2 wallabag2   4096 Apr 22 13:48 var
drwxr-xr-x 51 wallabag2 wallabag2   4096 Apr 22 13:48 vendor
drwxr-xr-x  6 wallabag2 wallabag2   4096 Mar  2 15:30 web

I am not sure which user/group/chmod should be applied here ?

nicofrand commented 7 years ago

Weird, https://github.com/YunoHost-Apps/wallabag2_ynh/blob/master/scripts/install#L65 should have set the user to www-data… Tried it but did not work. That works with the following rights (recursive) though but kind of dangerous I guess:

drwxrwxr-x 14 www-data wallabag2 4096 Apr 22 13:48 wallabag2
JimboJoe commented 7 years ago

Actually you're not looking on the right branch, as you tried the ongoing PR #28 . Thanks for reporting: I had induced a regression when using mktemp -d here. We have to fix the rights on /var/www/wallabag2 which are only 600 by default. It should be now fixed by commit 6f9e1ac. Could you please test it?

nicofrand commented 7 years ago

New try:

Thanks a lot for all this great work !

nicofrand commented 7 years ago

Feel free to close my two tickets once the code_refactoring branch is merged into master !

JimboJoe commented 7 years ago

Don't worry, provided the commit names include "fixes #...", they'll get automatically closed when the PR is merged ;-)

nicofrand commented 7 years ago

Actually, I am not sure but, could you test to enable the "import images locally" with this fix and check that the images are correctly downloaded ? Seems to me that there is still a permission issue…

JimboJoe commented 7 years ago

Doesn't look like a permission issue for me; yet, you have to set the field "URL of your wallabag instance" to make it work (otherwise the images URL are wrong). Can you confirm that? I've completed install/upgrade with that setting in https://github.com/YunoHost-Apps/wallabag2_ynh/pull/28/commits/fd00882e7ca02d4c0eb1247b13405f5b294ddb48.

nicofrand commented 7 years ago

I tried setting chmod 777 and it then worked. So that is a permission issue

Le 28 avr. 2017 5:43 PM, JimboJoe notifications@github.com a écrit :

Doesn't look like a permission issue for me; yet, you have to set the field "URL of your wallabag instance" to make it work (otherwise the images URL are wrong). Can you confirm that? I've completed install/upgrade with that setting in fd00882.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

JimboJoe commented 7 years ago

Can't reproduce. Do you have the same permissions?


root@yunohost:~# ll /var/www/wallabag2/web/assets/
total 4
drwxr-xr-x 3 wallabag2 wallabag2 4096 Apr 28 15:55 images
nicofrand commented 7 years ago

I don't remember the rights but I had www-data as owner (I probably left some errors from a previous install), nevermind. Thanks for the help again

28 avril 2017 17:59 "JimboJoe" a écrit: Can't reproduce. Do you have the same permissions?

root@yunohost:~# ll /var/www/wallabag2/web/assets/ total 4 drwxr-xr-x 3 wallabag2 wallabag2 4096 Apr 28 15:55 images  

—

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub (https://github.com/YunoHost-Apps/wallabag2_ynh/issues/31#issuecomment-298037203), or mute the thread (https://github.com/notifications/unsubscribe-auth/ADQrqhEfmlqJ7c9Sn_VGnoFQEGReZt2Zks5r0gzRgaJpZM4NFEFj).