TechnicPack / TechnicSolder

PHP web app that brings differential updates to the Technic Launcher and Technic Platform
https://docs.solder.io/
Other
169 stars 167 forks source link

Permission Denied Error for solderlog on any action #675

Closed BinaryAura closed 5 years ago

BinaryAura commented 5 years ago

Solder Repo Hash:

Operating System and version: Fedora 30 (Server)

PHP version: php 7.3.7 using workaround; error_reporting(E_ALL ^ E_DEPRECATED) at top of app.php

Composer version: Composer 1.9.0

Server type: LEMP

Type of database: SQLite 3

Type of hosting: Personal Shared

Link to the affected install's public url: https://solder.binaryaura.net

https://repo.binaryaura.net/solder ---------------------------------------------------------

After any action settings, adding mods, modpacks, etc I get the following error:

Error in exception handler: The stream or file "/var/www/solder.binaryaura.net/TechnicSolder/app/storage/logs/solderlog-2019-08-09.txt" could not be opened: failed to open stream: Permission denied in /var/www/solder.binaryaura.net/TechnicSolder/bootstrap/compiled.php:7173

This is similar to issue #655, I went ahead and made this issue because I'm using LEMP and that thread has gone stale and still open.

I have ran the check.php as indicated in that thread, but it returned nginx, as expected. I attempted making ../app/storage/logs 777 and making the folder it was referring to in the error with 777 as well, neither fixed the error.

This absolutely baffles me: "Permission denied" with 775 and 777

Nginx: nginx.conf: https://pastebin.com/g49wTnhj php.conf: https://pastebin.com/RtA1derF solder.binaryaura.net: https://pastebin.com/c8fpgQLs repo.binaryaura.net: https://pastebin.com/8LngdBsw

php: www.conf: https://pastebin.com/UMWZHXHp summary: LEMP tutorial setup runs under nginx

Solder: app.php: https://pastebin.com/3gXZqshx database.php: https://pastebin.com/XjK1VhdK solder.php: https://pastebin.com/5eXrBNi7 summary: repo: https://repo.binaryaura.net/solder solder: https://solder.binaryaura.net sqlite 3 defaults

Permissions: project directory: solder-www-perm.txt repo directory: repo-www-perm.txt summary: 775 and nginx:web everywhere nginx and jadunker is in web

Any help here would be appreciated.

BinaryAura commented 5 years ago

I inserted debug_print_backtrace() on line 7173 and got the attache backtrace. The first line says: General error: 8 attempt to write a readonly database in /var/www/solder.binaryaura.net/TechnicSolder/vendor/laravel/framework/src/Illuminate/Database/Connection.php:391

BinaryAura commented 5 years ago

After a bit of research I found this: https://stackoverflow.com/questions/3319112/sqlite-error-attempt-to-write-a-readonly-database-during-insert So I ran: setenforce 0 and tried again and it worked. I would prefer not to leave it off but, I'm not too familiar with selinux though.

Pyker commented 5 years ago

Make sure the app/database/production.sqlite has the right filesystem permissions.

BinaryAura commented 5 years ago

It has 775 I believe it is a SELinux issue. Running setenforce 0, and trying what caused a Permission Denied before goes through.

BinaryAura commented 5 years ago

Okay I'm having 2 SELinux issues. The first is the log. This is what shows on #655 as well. The solution to it was to run

sudo chcon -Rv -t httpd_sys_rw_content_t /var/www/solder.binaryaura.net/TechnicSolder/app/storage
Pyker commented 5 years ago

Cheers, glad to see it's fixed now.

BinaryAura commented 5 years ago

Second problem was very similar. Fixed via

sudo chcon -Rv -t httpd_sys_rw_content_t /var/www/solder.binaryaura.net/TechnicSolder/app/database
BinaryAura commented 5 years ago

For anyone also having similar issues, this site helped me considerably: https://serversforhackers.com/c/battling-selinux-cast

BinaryAura commented 5 years ago

When bringing up the Build Management Screen I get:

[2019-08-10 16:58:58] production.ERROR: Curl error for https://www.technicpack.net/api/minecraft:  [] []
[2019-08-10 16:58:58] production.ERROR: Curl error for https://launchermeta.mojang.com/mc/game/version_manifest.json:  [] []
Pyker commented 5 years ago

Both of the endpoints are working for me, as expected. Is there something preventing your server from successfully making the HTTPS request?

BinaryAura commented 5 years ago

Of coarse... SELinux again selinux-strikes again..txt

Pyker commented 5 years ago

I guess this issue is solved now, then?

BinaryAura commented 5 years ago

Yeah. sudo setsebool -P httpd_can_network_connect 1 Sorry for making issues like this, but the feedback helps.

BinaryAura commented 5 years ago

Also the irc.synirc.net isn't responding

Pyker commented 5 years ago

SynIRC isn't ours. Maybe it's yet another SELinux issue?

BinaryAura commented 5 years ago

Doubtful, I'm browsing on a windows. ... I just throw-up a little in my mouth.